[Commits] extension-loader.c 1.8 1.9

miras at claws-mail.org miras at claws-mail.org
Sun Jan 1 03:06:03 CET 2012


Update of /home/claws-mail/contacts/src
In directory claws-mail:/tmp/cvs-serv26542/src

Modified Files:
	extension-loader.c 
Log Message:
2012-01-01 [mir]	0.6.0cvs66

	* src/extension-loader.c
	    Fix bug when inserting menu_items in
	    main menu.

Index: extension-loader.c
===================================================================
RCS file: /home/claws-mail/contacts/src/extension-loader.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- extension-loader.c	28 Dec 2011 00:52:05 -0000	1.8
+++ extension-loader.c	1 Jan 2012 02:06:01 -0000	1.9
@@ -448,38 +448,39 @@
 static GtkWidget* insert_sub_menu(GtkImageMenuItem* image_menu,
 								  MenuItem* menu_item,
 								  UserMenuItem* user_menu) {
-	GtkWidget *widget = NULL, *menu = NULL, *tmp;
+	GtkWidget *widget = NULL, *menu = NULL;
 	GSList* cur;
-	gboolean force = FALSE;
+	gboolean is_created = FALSE;
 
 	if (menu_item->submenu) {
-		for (cur = user_menu_items; cur && ! menu && ! force; cur = g_slist_next(cur)) {
+		for (cur = user_menu_items; cur && ! menu && ! is_created; cur = g_slist_next(cur)) {
 			UserMenuItem* item = (UserMenuItem *) cur->data;
 			if (utf8_collate((gchar *) item->parent, (gchar *) menu_item->parent) == 0) {
 				if (utf8_collate((gchar *) item->sublabel, (gchar *) menu_item->sublabel) == 0 ||
 					utf8_collate((gchar *) item->parent, (gchar *) item->sublabel) == 0) {
 					menu = item->menu;
-					debug_print("parent: %s sublabel: %s\n", item->parent, item->sublabel);
+					is_created = TRUE;
+					/*debug_print("parent: %s sublabel: %s\n", item->parent, item->sublabel);
 					if (utf8_collate((gchar *) item->parent, (gchar *) item->sublabel) == 0) {
 						force = TRUE;
 						debug_print("force\n");
-					}
+					}*/
 				}
 			}
 		}
-		if (! menu || force) {
-			if (force) {
+		if (! menu) {
+/*			if (force) {
 				tmp = create_menu_item(&widget, menu_item->sublabel);
 				gtk_menu_shell_append(GTK_MENU_SHELL(tmp), GTK_WIDGET(image_menu));
 			}
-			else
+			else*/
 				menu = create_menu_item(&widget, menu_item->sublabel);
-			user_menu->menu = (force)? tmp : menu;
+			user_menu->menu = /*(force)? tmp :*/ menu;
 			user_menu->sublabel = g_strdup(menu_item->sublabel);
 		}
 		if (menu) {
-			if (force) {
-				gtk_menu_shell_append(GTK_MENU_SHELL(menu), widget);
+			if (is_created) {
+				gtk_menu_shell_append(GTK_MENU_SHELL(menu), GTK_WIDGET(image_menu));
 				widget = NULL;
 			}
 			else {
@@ -576,9 +577,11 @@
 			g_free(menu);
 			menu = NULL;
 		}
-		gtk_menu_shell_insert(GTK_MENU_SHELL(mainwindow->file_menu),
+		if (menu_elem) {
+			gtk_menu_shell_insert(GTK_MENU_SHELL(mainwindow->file_menu),
 						  menu_elem, file_menu_count);
-		file_menu_count++;
+			file_menu_count++;
+		}
 	}	
 	else if (menu_item->parent && strcasecmp("tools", menu_item->parent) == 0) {
 		// add to 'Tools' 
@@ -589,7 +592,8 @@
 			g_free(menu);
 			menu = NULL;
 		}
-		gtk_menu_shell_append(GTK_MENU_SHELL(mainwindow->tools_menu), menu_elem);
+		if (menu_elem)
+			gtk_menu_shell_append(GTK_MENU_SHELL(mainwindow->tools_menu), menu_elem);
 	}
 	else if (menu_item->parent && strcasecmp("help", menu_item->parent) == 0) {
 		// add to 'Help' 
@@ -600,7 +604,8 @@
 			g_free(menu);
 			menu = NULL;
 		}
-		gtk_menu_shell_append(GTK_MENU_SHELL(mainwindow->help_menu), menu_elem);
+		if (menu_elem)
+			gtk_menu_shell_append(GTK_MENU_SHELL(mainwindow->help_menu), menu_elem);
 	}
 	else if (menu_item->menu == CONTACTS_MAIN_MENU) {
 		if (! menu_item->sublabel) {



More information about the Commits mailing list