SF.net SVN: geany-plugins:[1935] trunk/geany-plugins/treebrowser

dimitrov-adrian at users.sourceforge.net dimitrov-adrian at xxxxx
Wed Feb 23 11:07:49 UTC 2011


Revision: 1935
          http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=1935&view=rev
Author:   dimitrov-adrian
Date:     2011-02-23 11:07:48 +0000 (Wed, 23 Feb 2011)

Log Message:
-----------
Fix an issue with tab switching with unsaved documents. (patch from Frank Lanitz, thanks)

Modified Paths:
--------------
    trunk/geany-plugins/treebrowser/ChangeLog
    trunk/geany-plugins/treebrowser/src/treebrowser.c

Modified: trunk/geany-plugins/treebrowser/ChangeLog
===================================================================
--- trunk/geany-plugins/treebrowser/ChangeLog	2011-02-14 22:41:50 UTC (rev 1934)
+++ trunk/geany-plugins/treebrowser/ChangeLog	2011-02-23 11:07:48 UTC (rev 1935)
@@ -37,9 +37,21 @@
 +-------------------------------+
 
 
+23-02-2011 	Adrian Dimitrov 		<dimitrov.adrian at gmail.com>
+
+	* src/treebrowser.c
+		Fix an issue with tab switching with unsaved documents.
+		(patch from Frank Lanitz, thanks)
+
+
 14-02-2011 	Adrian Dimitrov 		<dimitrov.adrian at gmail.com>
 
 	* src/treebrowser.c
+
+
+14-02-2011 	Adrian Dimitrov 		<dimitrov.adrian at gmail.com>
+
+	* src/treebrowser.c
 		Try to prevent from potentially frees string literals (reported by kugel)
 
 
@@ -181,6 +193,7 @@
 	* README
 		Try to add screenshot for the website
 
+
 09-10-2010 	Adrian Dimitrov 		<dimitrov.adrian at gmail.com>
 
 	* src/treebrowser.c
@@ -188,6 +201,7 @@
 	* README
 		Update and fixes website compitables
 
+
 09-10-2010 	Adrian Dimitrov 		<dimitrov.adrian at gmail.com>
 
 	* src/treebrowser.c

Modified: trunk/geany-plugins/treebrowser/src/treebrowser.c
===================================================================
--- trunk/geany-plugins/treebrowser/src/treebrowser.c	2011-02-14 22:41:50 UTC (rev 1934)
+++ trunk/geany-plugins/treebrowser/src/treebrowser.c	2011-02-23 11:07:48 UTC (rev 1935)
@@ -227,7 +227,7 @@
 {
 	int i = 0;
 
-	gboolean founded = FALSE;
+	gboolean found = FALSE;
 	gchar *diffed_path = "", *tmp = NULL;
 	gchar **src_segments = NULL, **find_segments = NULL;
 	guint src_segments_n = 0, find_segments_n = 0, n = 0;
@@ -244,22 +244,22 @@
 
 	for(i = 1; i<n; i++)
 		if (utils_str_equal(find_segments[i], src_segments[i]) != TRUE)
-		{
-			diffed_path = NULL;
 			break;
-		}
 		else
 		{
 			tmp = g_strconcat(diffed_path, G_DIR_SEPARATOR_S, find_segments[i], NULL);
 			diffed_path = g_strdup(tmp);
 			g_free(tmp);
-			founded = TRUE;
+			found = TRUE;
 		}
 
 	g_strfreev(src_segments);
 	g_strfreev(find_segments);
 
-	return (founded ? diffed_path : NULL);
+	if (found)
+		return diffed_path;
+	g_free(diffed_path);
+	return NULL;
 }
 
 /* Return: FALSE - if file is filtered and not shown, and TRUE - if file isn`t filtered, and have to be shown */
@@ -821,7 +821,7 @@
 
 	GeanyDocument	*doc 		= document_get_current();
 	gchar 			*path_current;
-	gchar			**path_segments;
+	gchar			**path_segments = NULL;
 	gchar 			*froot = NULL;
 
 	if (doc != NULL && doc->file_name != NULL && g_path_is_absolute(doc->file_name))
@@ -1120,18 +1120,17 @@
 static void
 on_menu_close_children(GtkMenuItem *menuitem, gchar *uri)
 {
-	guint nb_documents = geany->documents_array->len;
-	int i;
-	int uri_len=strlen(uri);
-	for(i=0; i<GEANY(documents_array)->len; i++)
+	guint i;
+	int uri_len = strlen(uri);
+	for (i=0; i < GEANY(documents_array)->len; i++)
 	{
-		if(documents[i]->is_valid)
+		if (documents[i]->is_valid)
 		{
 			/* the docuemnt filename shoudl always be longer than the uri when closing children
 			 * Compare the beginingin of the filename string to see if it matchs the uri*/
-			if(strlen(documents[i]->file_name)>uri_len)
+			if (strlen(documents[i]->file_name) > uri_len )
 			{
-				if(strncmp(uri,documents[i]->file_name,uri_len)==0)
+				if (strncmp(uri,documents[i]->file_name, uri_len)==0)
 					document_close(documents[i]);
 			}
 		}


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



More information about the Plugins-Commits mailing list