Branch: refs/heads/master
Author: Nick Treleaven <nick.treleaven(a)btinternet.com>
Committer: Nick Treleaven <nick.treleaven(a)btinternet.com>
Date: Fri, 31 Oct 2014 17:26:24 UTC
Commit: 4e5ed012f29f57f1e82c0bca23ea621f8504a7f5
https://github.com/geany/geany/commit/4e5ed012f29f57f1e82c0bca23ea621f8504a…
Log Message:
-----------
Recommend Glade 3.8.5, add link for fishman ctags fork
Modified Paths:
--------------
HACKING
Modified: HACKING
12 lines changed, 9 insertions(+), 3 deletions(-)
===================================================================
@@ -161,6 +161,10 @@ Glade
Add user-interface widgets to the Glade 3 file ``data/geany.glade``.
Callbacks for the user-interface should go in ``src/callbacks.c``.
+Use Glade 3.8.5. The 3.8 series still supports GTK+ 2, and earlier
+point releases did not preserve the order of XML elements, leading to
+unmanageable diffs.
+
GTK versions & API documentation
--------------------------------
Geany requires GTK >= 2.16 and GLib >= 2.20. API symbols from newer
@@ -616,11 +620,13 @@ Adding a TagManager parser
^^^^^^^^^^^^^^^^^^^^^^^^^^
This assumes the filetype for Geany already exists.
-First write or find a CTags compatible parser, foo.c. Note that there
-are some language patches for CTags at:
+First write or find a CTags compatible parser, foo.c. Check this fork:
+https://github.com/fishman/ctags
+
+There may be some unmerged language patches for CTags at:
http://sf.net/projects/ctags - see the tracker.
-(You can also try the Anjuta project's tagmanager codebase.)
+(You can also try the Anjuta project's anjuta-tags codebase.)
.. note::
From Geany 1.22 GLib's GRegex engine is used instead of POSIX
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
Branch: refs/heads/master
Author: Jiří Techet <techet(a)gmail.com>
Committer: Jiří Techet <techet(a)gmail.com>
Date: Fri, 31 Oct 2014 01:03:13 UTC
Commit: d7ed48f86be3957afb155edcb5a9c16afdc4054f
https://github.com/geany/geany/commit/d7ed48f86be3957afb155edcb5a9c16afdc40…
Log Message:
-----------
Fix a problem in tm_tags_remove_file_tags() when more tags of the same name exist
Modified Paths:
--------------
tagmanager/src/tm_tag.c
Modified: tagmanager/src/tm_tag.c
4 lines changed, 3 insertions(+), 1 deletions(-)
===================================================================
@@ -831,7 +831,9 @@ void tm_tags_remove_file_tags(TMSourceFile *source_file, GPtrArray *tags_array)
{
/* we cannot set the pointer to NULL now because the search wouldn't work */
g_ptr_array_add(to_delete, found);
- break;
+ /* no break - if there are multiple tags of the same name, we would
+ * always find the first instance and wouldn't remove others; duplicates
+ * in the to_delete list aren't a problem */
}
found++;
}
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
Branch: refs/heads/master
Author: Jiří Techet <techet(a)gmail.com>
Committer: Jiří Techet <techet(a)gmail.com>
Date: Thu, 30 Oct 2014 21:08:17 UTC
Commit: 0285ec28a5c813cd5c82b1ad390b584e122c1873
https://github.com/geany/geany/commit/0285ec28a5c813cd5c82b1ad390b584e122c1…
Log Message:
-----------
Move tm_source_file_update() to tm_workspace.c
The placement of this function in tm_source_file is not right - by moving
it to the workspace we can make the source file unaware of the existence
of the workspace (no inclusion of tm_workspace.h in tm_source_file any
more). Also change tm_source_file_new() so it doesn't offer the source file
update.
After this change
* TMWorkspace knows TMSourceFile and TMTag
* TMSourceFile knows TMTag
* TMTag knows TMSourceFile
Modified Paths:
--------------
plugins/geanyfunctions.h
src/document.c
src/plugindata.h
src/plugins.c
tagmanager/src/tm_source_file.c
tagmanager/src/tm_source_file.h
tagmanager/src/tm_workspace.c
tagmanager/src/tm_workspace.h
Modified: plugins/geanyfunctions.h
4 lines changed, 2 insertions(+), 2 deletions(-)
===================================================================
@@ -348,8 +348,8 @@
geany_functions->p_tm->tm_source_file_new
#define tm_workspace_add_source_file \
geany_functions->p_tm->tm_workspace_add_source_file
-#define tm_source_file_update \
- geany_functions->p_tm->tm_source_file_update
+#define tm_workspace_update_source_file \
+ geany_functions->p_tm->tm_workspace_update_source_file
#define tm_source_file_free \
geany_functions->p_tm->tm_source_file_free
#define tm_workspace_remove_source_file \
Modified: src/document.c
4 lines changed, 2 insertions(+), 2 deletions(-)
===================================================================
@@ -2483,7 +2483,7 @@ void document_update_tags(GeanyDocument *doc)
/* lookup the name rather than using filetype name to support custom filetypes */
name = tm_source_file_get_lang_name(doc->file_type->lang);
- doc->tm_file = tm_source_file_new(locale_filename, FALSE, name);
+ doc->tm_file = tm_source_file_new(locale_filename, name);
g_free(locale_filename);
if (doc->tm_file && !tm_workspace_add_source_file(doc->tm_file))
@@ -2516,7 +2516,7 @@ void document_update_tags(GeanyDocument *doc)
/* Parse Scintilla's buffer directly using TagManager
* Note: this buffer *MUST NOT* be modified */
buffer_ptr = (guchar *) scintilla_send_message(doc->editor->sci, SCI_GETCHARACTERPOINTER, 0, 0);
- tm_source_file_buffer_update(doc->tm_file, buffer_ptr, len, TRUE);
+ tm_workspace_update_source_file_buffer(doc->tm_file, buffer_ptr, len, TRUE);
sidebar_update_tag_list(doc, TRUE);
document_highlight_tags(doc);
Modified: src/plugindata.h
4 lines changed, 2 insertions(+), 2 deletions(-)
===================================================================
@@ -599,9 +599,9 @@ SearchFuncs;
typedef struct TagManagerFuncs
{
gchar* (*tm_get_real_path) (const gchar *file_name);
- TMSourceFile* (*tm_source_file_new) (const char *file_name, gboolean update, const char *name);
+ TMSourceFile* (*tm_source_file_new) (const char *file_name, const char *name);
gboolean (*tm_workspace_add_source_file) (TMSourceFile *source_file);
- void (*tm_source_file_update) (TMSourceFile *source_file, gboolean update_workspace);
+ void (*tm_workspace_update_source_file) (TMSourceFile *source_file, gboolean update_workspace);
void (*tm_source_file_free) (TMSourceFile *source_file);
gboolean (*tm_workspace_remove_source_file) (TMSourceFile *source_file, gboolean do_free, gboolean update);
void (*tm_workspace_update) (void);
Modified: src/plugins.c
2 lines changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -291,7 +291,7 @@ static TagManagerFuncs tagmanager_funcs = {
&tm_get_real_path,
&tm_source_file_new,
&tm_workspace_add_source_file,
- &tm_source_file_update,
+ &tm_workspace_update_source_file,
&tm_source_file_free,
&tm_workspace_remove_source_file,
&tm_workspace_update
Modified: tagmanager/src/tm_source_file.c
102 lines changed, 6 insertions(+), 96 deletions(-)
===================================================================
@@ -30,9 +30,8 @@
#include "entry.h"
#include "parse.h"
#include "read.h"
-#define LIBCTAGS_DEFINED
-#include "tm_workspace.h"
+#define LIBCTAGS_DEFINED
#include "tm_source_file.h"
#include "tm_tag.h"
@@ -143,7 +142,7 @@ static void tm_source_file_set_tag_arglist(const char *tag_name, const char *arg
/* Initializes a TMSourceFile structure from a file name. */
static gboolean tm_source_file_init(TMSourceFile *source_file, const char *file_name,
- gboolean update, const char* name)
+ const char* name)
{
struct stat s;
int status;
@@ -190,21 +189,18 @@ static gboolean tm_source_file_init(TMSourceFile *source_file, const char *file_
else
source_file->lang = getNamedLanguage(name);
- if (update)
- tm_source_file_update(source_file, FALSE);
return TRUE;
}
/** Initializes a TMSourceFile structure and returns a pointer to it.
* @param file_name The file name.
- * @param update Update the tag array of the file.
* @param name Name of the used programming language, NULL for autodetection.
* @return The created TMSourceFile object.
* */
-TMSourceFile *tm_source_file_new(const char *file_name, gboolean update, const char *name)
+TMSourceFile *tm_source_file_new(const char *file_name, const char *name)
{
TMSourceFile *source_file = g_new(TMSourceFile, 1);
- if (TRUE != tm_source_file_init(source_file, file_name, update, name))
+ if (TRUE != tm_source_file_init(source_file, file_name, name))
{
g_free(source_file);
return NULL;
@@ -243,9 +239,8 @@ void tm_source_file_free(TMSourceFile *source_file)
/* Parses the source file and regenarates the tags.
@param source_file The source file to parse
@return TRUE on success, FALSE on failure
- @see tm_source_file_update()
*/
-static gboolean tm_source_file_parse(TMSourceFile *source_file)
+gboolean tm_source_file_parse(TMSourceFile *source_file)
{
const char *file_name;
gboolean status = TRUE;
@@ -306,9 +301,8 @@ static gboolean tm_source_file_parse(TMSourceFile *source_file)
@param text_buf The text buffer to parse
@param buf_size The size of text_buf.
@return TRUE on success, FALSE on failure
- @see tm_source_file_update()
*/
-static gboolean tm_source_file_buffer_parse(TMSourceFile *source_file, guchar* text_buf, gint buf_size)
+gboolean tm_source_file_buffer_parse(TMSourceFile *source_file, guchar* text_buf, gint buf_size)
{
const char *file_name;
gboolean status = TRUE;
@@ -380,90 +374,6 @@ static gboolean tm_source_file_buffer_parse(TMSourceFile *source_file, guchar* t
return status;
}
-/** Updates the source file by reparsing. The tags array and
- the tags themselves are destroyed and re-created, hence any other tag arrays
- pointing to these tags should be rebuilt as well. All sorting information is
- also lost. The language parameter is automatically set the first time the file
- is parsed.
- @param source_file The source file to update.
- @param update_workspace If set to TRUE, sends an update signal to the workspace if required. You should
- always set this to TRUE if you are calling this function directly.
-*/
-void tm_source_file_update(TMSourceFile *source_file, gboolean update_workspace)
-{
-#ifdef TM_DEBUG
- g_message("Source file updating based on source file %s", source_file->file_name);
-#endif
-
- if (update_workspace)
- {
- /* tm_source_file_parse() deletes the tag objects - remove the tags from
- * workspace while they exist and can be scanned */
- tm_workspace_remove_file_tags(source_file);
- }
- tm_source_file_parse(source_file);
- tm_tags_sort(source_file->tags_array, NULL, FALSE);
- if (update_workspace)
- {
-#ifdef TM_DEBUG
- g_message("Updating workspace from source file");
-#endif
- tm_workspace_merge_file_tags(source_file);
- }
-#ifdef TM_DEBUG
- else
- g_message("Skipping workspace update because update_workspace is %s",
- update_workspace?"TRUE":"FALSE");
-
-#endif
-}
-
-
-/* Updates the source file by reparsing the text-buffer passed as parameter.
- Ctags will use a parsing based on buffer instead of on files.
- You should call this function when you don't want a previous saving of the file
- you're editing. It's useful for a "real-time" updating of the tags.
- The tags array and the tags themselves are destroyed and re-created, hence any
- other tag arrays pointing to these tags should be rebuilt as well. All sorting
- information is also lost. The language parameter is automatically set the first
- time the file is parsed.
- @param source_file The source file to update with a buffer.
- @param text_buf A text buffer. The user should take care of allocate and free it after
- the use here.
- @param buf_size The size of text_buf.
- @param update_workspace If set to TRUE, sends an update signal to the workspace if required. You should
- always set this to TRUE if you are calling this function directly.
- @return TRUE if the file was parsed, FALSE otherwise.
-*/
-void tm_source_file_buffer_update(TMSourceFile *source_file, guchar* text_buf,
- gint buf_size, gboolean update_workspace)
-{
-#ifdef TM_DEBUG
- g_message("Buffer updating based on source file %s", source_file->file_name);
-#endif
-
- if (update_workspace)
- {
- /* tm_source_file_parse() deletes the tag objects - remove the tags from
- * workspace while they exist and can be scanned */
- tm_workspace_remove_file_tags(source_file);
- }
- tm_source_file_buffer_parse (source_file, text_buf, buf_size);
- tm_tags_sort(source_file->tags_array, NULL, FALSE);
- if (update_workspace)
- {
-#ifdef TM_DEBUG
- g_message("Updating workspace from buffer..");
-#endif
- tm_workspace_merge_file_tags(source_file);
- }
-#ifdef TM_DEBUG
- else
- g_message("Skipping workspace update because update_workspace is %s",
- update_workspace?"TRUE":"FALSE");
-
-#endif
-}
/* Gets the name associated with the language index.
@param lang The language index.
Modified: tagmanager/src/tm_source_file.h
11 lines changed, 5 insertions(+), 6 deletions(-)
===================================================================
@@ -44,9 +44,7 @@ typedef struct
GPtrArray *tags_array; /**< Tags obtained by parsing the object */
} TMSourceFile;
-TMSourceFile *tm_source_file_new(const char *file_name, gboolean update, const char *name);
-
-void tm_source_file_update(TMSourceFile *source_file, gboolean update_workspace);
+TMSourceFile *tm_source_file_new(const char *file_name, const char *name);
void tm_source_file_free(TMSourceFile *source_file);
@@ -55,13 +53,14 @@ gchar *tm_get_real_path(const gchar *file_name);
#ifdef GEANY_PRIVATE
-void tm_source_file_buffer_update(TMSourceFile *source_file, guchar* text_buf,
- gint buf_size, gboolean update_workspace);
-
const gchar *tm_source_file_get_lang_name(gint lang);
gint tm_source_file_get_named_lang(const gchar *name);
+gboolean tm_source_file_parse(TMSourceFile *source_file);
+
+gboolean tm_source_file_buffer_parse(TMSourceFile *source_file, guchar* text_buf, gint buf_size);
+
#endif /* GEANY_PRIVATE */
#ifdef __cplusplus
Modified: tagmanager/src/tm_workspace.c
102 lines changed, 94 insertions(+), 8 deletions(-)
===================================================================
@@ -107,6 +107,12 @@ gboolean tm_workspace_add_source_file(TMSourceFile *source_file)
return TRUE;
}
+static void tm_workspace_remove_file_tags(TMSourceFile *source_file)
+{
+ if (theWorkspace->tags_array != NULL)
+ tm_tags_remove_file_tags(source_file, theWorkspace->tags_array);
+}
+
/** Removes a member object from the workspace if it exists.
@param source_file Pointer to the source file to be removed.
@param do_free Whether the source file is to be freed as well.
@@ -447,7 +453,8 @@ gboolean tm_workspace_create_global_tags(const char *pre_process, const char **i
temp_file2 = temp_file;
temp_file = NULL;
}
- source_file = tm_source_file_new(temp_file2, TRUE, tm_source_file_get_lang_name(lang));
+ source_file = tm_source_file_new(temp_file2, tm_source_file_get_lang_name(lang));
+ tm_workspace_update_source_file(source_file, FALSE);
if (NULL == source_file)
{
g_unlink(temp_file2);
@@ -537,13 +544,7 @@ static void tm_workspace_recreate_tags_array(void)
tm_tags_sort(theWorkspace->tags_array, sort_attrs, TRUE);
}
-void tm_workspace_remove_file_tags(TMSourceFile *source_file)
-{
- if (theWorkspace->tags_array != NULL)
- tm_tags_remove_file_tags(source_file, theWorkspace->tags_array);
-}
-
-void tm_workspace_merge_file_tags(TMSourceFile *source_file)
+static void tm_workspace_merge_file_tags(TMSourceFile *source_file)
{
TMTagAttrType sort_attrs[] = { tm_tag_attr_name_t, tm_tag_attr_file_t,
tm_tag_attr_scope_t, tm_tag_attr_type_t, tm_tag_attr_arglist_t, 0};
@@ -561,6 +562,91 @@ void tm_workspace_merge_file_tags(TMSourceFile *source_file)
}
}
+/** Updates the source file by reparsing. The tags array and
+ the tags themselves are destroyed and re-created, hence any other tag arrays
+ pointing to these tags should be rebuilt as well. All sorting information is
+ also lost. The language parameter is automatically set the first time the file
+ is parsed.
+ @param source_file The source file to update.
+ @param update_workspace If set to TRUE, sends an update signal to the workspace if required. You should
+ always set this to TRUE if you are calling this function directly.
+*/
+void tm_workspace_update_source_file(TMSourceFile *source_file, gboolean update_workspace)
+{
+#ifdef TM_DEBUG
+ g_message("Source file updating based on source file %s", source_file->file_name);
+#endif
+
+ if (update_workspace)
+ {
+ /* tm_source_file_parse() deletes the tag objects - remove the tags from
+ * workspace while they exist and can be scanned */
+ tm_workspace_remove_file_tags(source_file);
+ }
+ tm_source_file_parse(source_file);
+ tm_tags_sort(source_file->tags_array, NULL, FALSE);
+ if (update_workspace)
+ {
+#ifdef TM_DEBUG
+ g_message("Updating workspace from source file");
+#endif
+ tm_workspace_merge_file_tags(source_file);
+ }
+#ifdef TM_DEBUG
+ else
+ g_message("Skipping workspace update because update_workspace is %s",
+ update_workspace?"TRUE":"FALSE");
+
+#endif
+}
+
+
+/* Updates the source file by reparsing the text-buffer passed as parameter.
+ Ctags will use a parsing based on buffer instead of on files.
+ You should call this function when you don't want a previous saving of the file
+ you're editing. It's useful for a "real-time" updating of the tags.
+ The tags array and the tags themselves are destroyed and re-created, hence any
+ other tag arrays pointing to these tags should be rebuilt as well. All sorting
+ information is also lost. The language parameter is automatically set the first
+ time the file is parsed.
+ @param source_file The source file to update with a buffer.
+ @param text_buf A text buffer. The user should take care of allocate and free it after
+ the use here.
+ @param buf_size The size of text_buf.
+ @param update_workspace If set to TRUE, sends an update signal to the workspace if required. You should
+ always set this to TRUE if you are calling this function directly.
+ @return TRUE if the file was parsed, FALSE otherwise.
+*/
+void tm_workspace_update_source_file_buffer(TMSourceFile *source_file, guchar* text_buf,
+ gint buf_size, gboolean update_workspace)
+{
+#ifdef TM_DEBUG
+ g_message("Buffer updating based on source file %s", source_file->file_name);
+#endif
+
+ if (update_workspace)
+ {
+ /* tm_source_file_parse() deletes the tag objects - remove the tags from
+ * workspace while they exist and can be scanned */
+ tm_workspace_remove_file_tags(source_file);
+ }
+ tm_source_file_buffer_parse (source_file, text_buf, buf_size);
+ tm_tags_sort(source_file->tags_array, NULL, FALSE);
+ if (update_workspace)
+ {
+#ifdef TM_DEBUG
+ g_message("Updating workspace from buffer..");
+#endif
+ tm_workspace_merge_file_tags(source_file);
+ }
+#ifdef TM_DEBUG
+ else
+ g_message("Skipping workspace update because update_workspace is %s",
+ update_workspace?"TRUE":"FALSE");
+
+#endif
+}
+
/** Calls tm_source_file_update() for all workspace member source files and creates
workspace tag array. Use if you want to globally refresh the workspace.
*/
Modified: tagmanager/src/tm_workspace.h
9 lines changed, 5 insertions(+), 4 deletions(-)
===================================================================
@@ -38,6 +38,8 @@ gboolean tm_workspace_add_source_file(TMSourceFile *source_file);
gboolean tm_workspace_remove_source_file(TMSourceFile *source_file, gboolean do_free, gboolean update);
+void tm_workspace_update_source_file(TMSourceFile *source_file, gboolean update_workspace);
+
void tm_workspace_update(void);
@@ -64,11 +66,10 @@ const GPtrArray *tm_workspace_find_scope_members(const GPtrArray *file_tags,
const TMTag *tm_get_current_tag(GPtrArray *file_tags, const gulong line, const guint tag_types);
-void tm_workspace_free(void);
-
-void tm_workspace_merge_file_tags(TMSourceFile *source_file);
+void tm_workspace_update_source_file_buffer(TMSourceFile *source_file, guchar* text_buf,
+ gint buf_size, gboolean update_workspace);
-void tm_workspace_remove_file_tags(TMSourceFile *source_file);
+void tm_workspace_free(void);
#ifdef TM_DEBUG
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
Branch: refs/heads/master
Author: Jiří Techet <techet(a)gmail.com>
Committer: Jiří Techet <techet(a)gmail.com>
Date: Thu, 30 Oct 2014 21:08:17 UTC
Commit: 43b8ab8d236850bec929d981d05122dfabca99c7
https://github.com/geany/geany/commit/43b8ab8d236850bec929d981d05122dfabca9…
Log Message:
-----------
Only keep the minimal set of parameter in the TM API calls
Avoid "utility" parameters like do_free for which we already have API calls
and which actually don't perform any free if the source file isn't
in TM. Clarify when to set the update_workspace parameter.
Modified Paths:
--------------
src/dialogs.c
src/document.c
src/plugindata.h
tagmanager/src/tm_workspace.c
tagmanager/src/tm_workspace.h
Modified: src/dialogs.c
3 lines changed, 2 insertions(+), 1 deletions(-)
===================================================================
@@ -502,7 +502,8 @@ static gboolean handle_save_as(const gchar *utf8_filename, gboolean rename_file)
document_rename_file(doc, utf8_filename);
}
/* create a new tm_source_file object otherwise tagmanager won't work correctly */
- tm_workspace_remove_source_file(doc->tm_file, TRUE, TRUE);
+ tm_workspace_remove_source_file(doc->tm_file, TRUE);
+ tm_source_file_free(doc->tm_file);
doc->tm_file = NULL;
}
success = document_save_file_as(doc, utf8_filename);
Modified: src/document.c
6 lines changed, 4 insertions(+), 2 deletions(-)
===================================================================
@@ -714,7 +714,8 @@ static gboolean remove_page(guint page_num)
g_free(doc->priv->saved_encoding.encoding);
g_free(doc->file_name);
g_free(doc->real_path);
- tm_workspace_remove_source_file(doc->tm_file, TRUE, !main_status.quitting);
+ tm_workspace_remove_source_file(doc->tm_file, !main_status.quitting);
+ tm_source_file_free(doc->tm_file);
if (doc->priv->tag_tree)
gtk_widget_destroy(doc->priv->tag_tree);
@@ -2617,7 +2618,8 @@ static void document_load_config(GeanyDocument *doc, GeanyFiletype *type,
/* delete tm file object to force creation of a new one */
if (doc->tm_file != NULL)
{
- tm_workspace_remove_source_file(doc->tm_file, TRUE, TRUE);
+ tm_workspace_remove_source_file(doc->tm_file, TRUE);
+ tm_source_file_free(doc->tm_file);
doc->tm_file = NULL;
}
/* load tags files before highlighting (some lexers highlight global typenames) */
Modified: src/plugindata.h
2 lines changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -603,7 +603,7 @@ typedef struct TagManagerFuncs
gboolean (*tm_workspace_add_source_file) (TMSourceFile *source_file);
void (*tm_workspace_update_source_file) (TMSourceFile *source_file, gboolean update_workspace);
void (*tm_source_file_free) (TMSourceFile *source_file);
- gboolean (*tm_workspace_remove_source_file) (TMSourceFile *source_file, gboolean do_free, gboolean update);
+ gboolean (*tm_workspace_remove_source_file) (TMSourceFile *source_file, gboolean update);
void (*tm_workspace_update) (void);
}
TagManagerFuncs;
Modified: tagmanager/src/tm_workspace.c
26 lines changed, 13 insertions(+), 13 deletions(-)
===================================================================
@@ -92,7 +92,8 @@ const TMWorkspace *tm_get_workspace(void)
return theWorkspace;
}
-/** Adds a source file to the workspace.
+/** Adds a source file to the workspace. At some point, tm_workspace_update_source_file()
+ has to be called to create the source file's tag array.
@param source_file The source file to add to the workspace.
@return TRUE on success, FALSE on failure (e.g. object already exixts).
*/
@@ -113,28 +114,25 @@ static void tm_workspace_remove_file_tags(TMSourceFile *source_file)
tm_tags_remove_file_tags(source_file, theWorkspace->tags_array);
}
-/** Removes a member object from the workspace if it exists.
+/** Removes a source file from the workspace if it exists.
@param source_file Pointer to the source file to be removed.
- @param do_free Whether the source file is to be freed as well.
- @param update Whether to update workspace objects.
+ @param update_workspace Whether to update workspace objects. Has to be TRUE unless
+ tm_workspace_update() is called later.
@return TRUE on success, FALSE on failure (e.g. the source file does not exist).
*/
-gboolean tm_workspace_remove_source_file(TMSourceFile *source_file, gboolean do_free, gboolean update)
+gboolean tm_workspace_remove_source_file(TMSourceFile *source_file, gboolean update_workspace)
{
guint i;
if ((NULL == theWorkspace) || (NULL == theWorkspace->source_files)
|| (NULL == source_file))
return FALSE;
-
for (i=0; i < theWorkspace->source_files->len; ++i)
{
if (theWorkspace->source_files->pdata[i] == source_file)
{
- if (update)
+ if (update_workspace)
tm_workspace_remove_file_tags(source_file);
- if (do_free)
- tm_source_file_free(source_file);
g_ptr_array_remove_index_fast(theWorkspace->source_files, i);
return TRUE;
}
@@ -568,8 +566,8 @@ static void tm_workspace_merge_file_tags(TMSourceFile *source_file)
also lost. The language parameter is automatically set the first time the file
is parsed.
@param source_file The source file to update.
- @param update_workspace If set to TRUE, sends an update signal to the workspace if required. You should
- always set this to TRUE if you are calling this function directly.
+ @param update_workspace Whether to update workspace objects. Has to be TRUE unless
+ tm_workspace_update() is called later.
*/
void tm_workspace_update_source_file(TMSourceFile *source_file, gboolean update_workspace)
{
@@ -647,8 +645,10 @@ void tm_workspace_update_source_file_buffer(TMSourceFile *source_file, guchar* t
#endif
}
-/** Calls tm_source_file_update() for all workspace member source files and creates
- workspace tag array. Use if you want to globally refresh the workspace.
+/** Recreates workspace tag array from all member TMSourceFile objects. Use if you
+ want to globally refresh the workspace. This function does not call tm_source_file_update()
+ which should be called before this function on source files which need to be
+ reparsed.
*/
void tm_workspace_update(void)
{
Modified: tagmanager/src/tm_workspace.h
2 lines changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -36,7 +36,7 @@ typedef struct
gboolean tm_workspace_add_source_file(TMSourceFile *source_file);
-gboolean tm_workspace_remove_source_file(TMSourceFile *source_file, gboolean do_free, gboolean update);
+gboolean tm_workspace_remove_source_file(TMSourceFile *source_file, gboolean update_workspace);
void tm_workspace_update_source_file(TMSourceFile *source_file, gboolean update_workspace);
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).