[Commits] example-extension.c 1.2 1.3

miras at claws-mail.org miras at claws-mail.org
Tue Dec 13 11:41:50 CET 2011


Update of /home/claws-mail/contacts/extensions/example/src
In directory claws-mail:/tmp/cvs-serv21616/extensions/example/src

Modified Files:
	example-extension.c 
Log Message:
2011-12-13 [mir]	0.6.0cvs42

	* extensions/example/src/example-extension.c
	    Improve example for adding new menu items.

Index: example-extension.c
===================================================================
RCS file: /home/claws-mail/contacts/extensions/example/src/example-extension.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- example-extension.c	9 Dec 2011 23:01:21 -0000	1.2
+++ example-extension.c	13 Dec 2011 10:41:48 -0000	1.3
@@ -55,25 +55,45 @@
 	GtkWidget *menu;
 	MenuItem* menu_item;
 	
-	//root = gtk_image_menu_item_new_with_mnemonic("_Test1");
+	// Add a menu item into the file menu
 	menu = gtk_image_menu_item_new_with_mnemonic("_Test2");
     g_signal_connect(menu, "activate",
             G_CALLBACK(my_cb), (gpointer) mainwindow);
     menu_item = menu_item_new();
     menu_item->menu = CONTACTS_MAIN_MENU;
     menu_item->parent = "file";
-    //menu_item->sublabel = "_Test1";
     menu_item->submenu = FALSE;
 	add_menu_item(GTK_IMAGE_MENU_ITEM(menu), menu_item);
 
+	// Add a menu item into the context menu of contact
 	menu = gtk_image_menu_item_new_with_mnemonic("_Test3");
     g_signal_connect(menu, "activate",
             G_CALLBACK(my_cb), (gpointer) mainwindow);
     menu_item = menu_item_new();
     menu_item->menu = CONTACTS_CONTACT_MENU;
-    menu_item->parent = "_Menu1";
     menu_item->submenu = FALSE;
 	add_menu_item(GTK_IMAGE_MENU_ITEM(menu), menu_item);
+
+	// Add a menu item into the menu bar
+	menu = gtk_image_menu_item_new_with_mnemonic("_Zest2");
+    g_signal_connect(menu, "activate",
+            G_CALLBACK(my_cb), mainwindow);
+    menu_item = menu_item_new();
+    menu_item->menu = CONTACTS_MAIN_MENU;
+    menu_item->parent = "_Menu";
+    menu_item->submenu = FALSE;
+	add_menu_item(GTK_IMAGE_MENU_ITEM(menu), menu_item);
+
+	// Add another menu item into the menu bar. This time as a submenu
+	menu = gtk_image_menu_item_new_with_mnemonic("_Yest1");
+    g_signal_connect(menu, "activate",
+            G_CALLBACK(my_cb), mainwindow);
+    menu_item = menu_item_new();
+    menu_item->menu = CONTACTS_MAIN_MENU;
+    menu_item->parent = "_Menu";
+    menu_item->sublabel = "_Test1";
+    menu_item->submenu = TRUE;
+	add_menu_item(GTK_IMAGE_MENU_ITEM(menu), menu_item);
 }
 
 /**
@@ -85,7 +105,7 @@
  */
 gint extension_init(guint id) {
 	my_id = id;
-	gchar* error;
+	gchar* error = NULL;
 	
 	register_hook_function(my_id, EXTENSION_AFTER_INIT_HOOK, setup, &error);
 	return 0;



More information about the Commits mailing list