SF.net SVN: geany: [1341] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Mon Feb 26 13:32:34 UTC 2007


Revision: 1341
          http://svn.sourceforge.net/geany/?rev=1341&view=rev
Author:   eht16
Date:     2007-02-26 05:32:34 -0800 (Mon, 26 Feb 2007)

Log Message:
-----------
Fixed wrong sensitiveness of custom commands menu items.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/tools.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2007-02-25 18:59:08 UTC (rev 1340)
+++ trunk/ChangeLog	2007-02-26 13:32:34 UTC (rev 1341)
@@ -1,3 +1,8 @@
+2007-02-26  Enrico Tröger  <enrico.troeger at uvena.de>
+
+ * src/tools.c: Fixed wrong sensitiveness of custom commands menu items.
+
+
 2007-02-25  Enrico Tröger  <enrico.troeger at uvena.de>
 
  * geany.glade, doc/geany.docbook, src/geany.h, src/interface.c,

Modified: trunk/src/tools.c
===================================================================
--- trunk/src/tools.c	2007-02-25 18:59:08 UTC (rev 1340)
+++ trunk/src/tools.c	2007-02-26 13:32:34 UTC (rev 1341)
@@ -681,7 +681,7 @@
 		GSList *result_list = NULL;
 		gint i = 0;
 		gint len = 0;
-		gchar **result;
+		gchar **result = NULL;
 		const gchar *text;
 
 		while (children != NULL)
@@ -702,21 +702,27 @@
 			}
 			children = children->next;
 		}
-		// create a new null-terminated array
-		result = g_new(gchar*, len + 1);
-		while (result_list != NULL)
+		// create a new null-terminated array but only if there any commands defined
+		if (len > 0)
 		{
-			result[i] = (gchar*) result_list->data;
+			result = g_new(gchar*, len + 1);
+			while (result_list != NULL)
+			{
+				result[i] = (gchar*) result_list->data;
 
-			result_list = result_list->next;
-			i++;
+				result_list = result_list->next;
+				i++;
+			}
+			result[len] = NULL; // null-terminate the array
 		}
-		g_slist_free(result_list);
-		g_list_free(children);
-		result[len] = NULL; // null-terminate the array
+		// set the new array
 		g_strfreev(app->custom_commands);
 		app->custom_commands = result;
+		// rebuild the menu items
 		tools_create_insert_custom_command_menu_items();
+
+		g_slist_free(result_list);
+		g_list_free(children);
 	}
 	gtk_widget_destroy(dialog);
 }
@@ -732,7 +738,7 @@
 
 	if (! DOC_IDX_VALID(idx)) return;
 
-	enable = sci_can_copy(doc_list[idx].sci);
+	enable = sci_can_copy(doc_list[idx].sci) && (app->custom_commands != NULL);
 
 	children = gtk_container_get_children(GTK_CONTAINER(user_data));
 	len = g_list_length(children);


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