Kaydet (Commit) ff9c673e authored tarafından Nick Treleaven's avatar Nick Treleaven

Apply patch from Yura Siamashka to speed up removing several

workspace object's tags without updating the workspace until
necessary (thanks).


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2164 ea778897-0a13-0410-b9d1-a72fbfd435f5
üst d4764a2b
......@@ -4,6 +4,12 @@
doc/geany.html:
Add 'Make in base path' project file preference, on by default.
Add project_get_base_path(), separated from project_get_make_dir().
* src/dialogs.c, src/plugindata.h, src/document.c,
tagmanager/tm_project.c, tagmanager/tm_workspace.c,
tagmanager/include/tm_workspace.h:
Apply patch from Yura Siamashka to speed up removing several
workspace object's tags without updating the workspace until
necessary (thanks).
2008-01-11 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
......
......@@ -426,7 +426,7 @@ on_file_save_dialog_response (GtkDialog *dialog,
g_free(old_filename);
}
// create a new tm_source_file object otherwise tagmanager won't work correctly
tm_workspace_remove_object(doc_list[idx].tm_file, TRUE);
tm_workspace_remove_object(doc_list[idx].tm_file, TRUE, TRUE);
doc_list[idx].tm_file = NULL;
g_free(doc_list[idx].file_name);
}
......
......@@ -494,7 +494,7 @@ gboolean document_remove(guint page_num)
g_free(doc_list[idx].encoding);
g_free(doc_list[idx].saved_encoding.encoding);
g_free(doc_list[idx].file_name);
tm_workspace_remove_object(doc_list[idx].tm_file, TRUE);
tm_workspace_remove_object(doc_list[idx].tm_file, TRUE, TRUE);
doc_list[idx].is_valid = FALSE;
doc_list[idx].sci = NULL;
......@@ -1943,7 +1943,7 @@ void document_set_filetype(gint idx, filetype *type)
// delete tm file object to force creation of a new one
if (doc_list[idx].tm_file != NULL)
{
tm_workspace_remove_object(doc_list[idx].tm_file, TRUE);
tm_workspace_remove_object(doc_list[idx].tm_file, TRUE, TRUE);
doc_list[idx].tm_file = NULL;
}
highlighting_set_styles(doc_list[idx].sci, type->id);
......
......@@ -93,12 +93,12 @@
/* The API version should be incremented whenever any plugin data types below are
* modified or appended to. */
static const gint api_version = 37;
static const gint api_version = 38;
/* The ABI version should be incremented whenever existing fields in the plugin
* data types below have to be changed or reordered. It should stay the same if fields
* are only appended, as this doesn't affect existing fields. */
static const gint abi_version = 19;
static const gint abi_version = 20;
/* This performs runtime checks that try to ensure:
* 1. Geany ABI data types are compatible with this plugin.
......@@ -373,7 +373,7 @@ typedef struct TagManagerFuncs
gboolean (*source_file_update) (TMWorkObject *source_file, gboolean force,
gboolean recurse, gboolean update_parent);
void (*work_object_free) (gpointer work_object);
gboolean (*workspace_remove_object) (TMWorkObject *w, gboolean do_free);
gboolean (*workspace_remove_object) (TMWorkObject *w, gboolean do_free, gboolean update);
}
TagManagerFuncs;
......
......@@ -79,9 +79,10 @@ TMWorkObject *tm_workspace_find_object(TMWorkObject *work_object, const char *fi
/*! Removes a member object from the workspace if it exists.
\param work_object Pointer to the work object to be removed.
\param free Whether the work object is to be freed as well.
\param update Whether to update workspace objects.
\return TRUE on success, FALSE on failure (e.g. the work object does not exist).
*/
gboolean tm_workspace_remove_object(TMWorkObject *work_object, gboolean free);
gboolean tm_workspace_remove_object(TMWorkObject *work_object, gboolean free, gboolean update);
/*! Loads the global tag list from the specified file. The global tag list should
have been first created using tm_workspace_create_global_tags().
......
......@@ -139,7 +139,7 @@ void tm_project_destroy(TMProject *project)
tm_source_file_free(project->file_list->pdata[i]);
g_ptr_array_free(project->file_list, TRUE);
}
tm_workspace_remove_object(TM_WORK_OBJECT(project), FALSE);
tm_workspace_remove_object(TM_WORK_OBJECT(project), FALSE, TRUE);
g_free(project->dir);
tm_work_object_destroy(&(project->work_object));
}
......@@ -175,7 +175,7 @@ gboolean tm_project_add_file(TMProject *project, const char *file_name
#ifdef TM_DEBUG
g_message("%s moved from workspace to project", path);
#endif
tm_workspace_remove_object(source_file, FALSE);
tm_workspace_remove_object(source_file, FALSE, TRUE);
}
else if (TM_WORK_OBJECT(project) == source_file->parent)
{
......
......@@ -98,12 +98,14 @@ gboolean tm_workspace_add_object(TMWorkObject *work_object)
return TRUE;
}
gboolean tm_workspace_remove_object(TMWorkObject *w, gboolean do_free)
gboolean tm_workspace_remove_object(TMWorkObject *w, gboolean do_free, gboolean update)
{
guint i;
if ((NULL == theWorkspace) || (NULL == theWorkspace->work_objects)
|| (NULL == w))
return FALSE;
for (i=0; i < theWorkspace->work_objects->len; ++i)
{
if (theWorkspace->work_objects->pdata[i] == w)
......@@ -111,10 +113,12 @@ gboolean tm_workspace_remove_object(TMWorkObject *w, gboolean do_free)
if (do_free)
tm_work_object_free(w);
g_ptr_array_remove_index_fast(theWorkspace->work_objects, i);
tm_workspace_update(TM_WORK_OBJECT(theWorkspace), TRUE, FALSE, FALSE);
if (update)
tm_workspace_update(TM_WORK_OBJECT(theWorkspace), TRUE, FALSE, FALSE);
return TRUE;
}
}
return FALSE;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment