SF.net SVN: geany: [2164] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Fri Jan 11 17:09:24 UTC 2008


Revision: 2164
          http://geany.svn.sourceforge.net/geany/?rev=2164&view=rev
Author:   ntrel
Date:     2008-01-11 09:09:23 -0800 (Fri, 11 Jan 2008)

Log Message:
-----------
Apply patch from Yura Siamashka to speed up removing several
workspace object's tags without updating the workspace until
necessary (thanks).

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/dialogs.c
    trunk/src/document.c
    trunk/src/plugindata.h
    trunk/tagmanager/include/tm_workspace.h
    trunk/tagmanager/tm_project.c
    trunk/tagmanager/tm_workspace.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2008-01-11 16:53:25 UTC (rev 2163)
+++ trunk/ChangeLog	2008-01-11 17:09:23 UTC (rev 2164)
@@ -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>

Modified: trunk/src/dialogs.c
===================================================================
--- trunk/src/dialogs.c	2008-01-11 16:53:25 UTC (rev 2163)
+++ trunk/src/dialogs.c	2008-01-11 17:09:23 UTC (rev 2164)
@@ -426,7 +426,7 @@
 						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);
 				}

Modified: trunk/src/document.c
===================================================================
--- trunk/src/document.c	2008-01-11 16:53:25 UTC (rev 2163)
+++ trunk/src/document.c	2008-01-11 17:09:23 UTC (rev 2164)
@@ -494,7 +494,7 @@
 		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 @@
 		// 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);

Modified: trunk/src/plugindata.h
===================================================================
--- trunk/src/plugindata.h	2008-01-11 16:53:25 UTC (rev 2163)
+++ trunk/src/plugindata.h	2008-01-11 17:09:23 UTC (rev 2164)
@@ -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 @@
 	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;
 

Modified: trunk/tagmanager/include/tm_workspace.h
===================================================================
--- trunk/tagmanager/include/tm_workspace.h	2008-01-11 16:53:25 UTC (rev 2163)
+++ trunk/tagmanager/include/tm_workspace.h	2008-01-11 17:09:23 UTC (rev 2164)
@@ -79,9 +79,10 @@
 /*! 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().

Modified: trunk/tagmanager/tm_project.c
===================================================================
--- trunk/tagmanager/tm_project.c	2008-01-11 16:53:25 UTC (rev 2163)
+++ trunk/tagmanager/tm_project.c	2008-01-11 17:09:23 UTC (rev 2164)
@@ -139,7 +139,7 @@
 			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 @@
 #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)
 				{

Modified: trunk/tagmanager/tm_workspace.c
===================================================================
--- trunk/tagmanager/tm_workspace.c	2008-01-11 16:53:25 UTC (rev 2163)
+++ trunk/tagmanager/tm_workspace.c	2008-01-11 17:09:23 UTC (rev 2164)
@@ -98,12 +98,14 @@
 	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 @@
 			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;
 }
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list