[Commits] menu.c 1.5.2.46 1.5.2.47 menu.h 1.4.2.26 1.4.2.27

colin at claws-mail.org colin at claws-mail.org
Wed Aug 29 11:33:04 CEST 2012


Update of /home/claws-mail/claws/src/gtk
In directory srv:/tmp/cvs-serv4178/src/gtk

Modified Files:
      Tag: gtk2
	menu.c menu.h 
Log Message:
2012-08-29 [colin]	3.8.1cvs40

	* src/mainwindow.c
	* src/messageview.c
	* src/mimeview.c
	* src/mimeview.h
	* src/summaryview.c
	* src/textview.c
	* src/gtk/menu.c
	* src/gtk/menu.h
		Move the hardcoded mimeview shortcuts to standard menus.

Index: menu.h
===================================================================
RCS file: /home/claws-mail/claws/src/gtk/menu.h,v
retrieving revision 1.4.2.26
retrieving revision 1.4.2.27
diff -u -d -r1.4.2.26 -r1.4.2.27
--- menu.h	27 May 2012 17:31:06 -0000	1.4.2.26
+++ menu.h	29 Aug 2012 09:33:02 -0000	1.4.2.27
@@ -93,7 +93,7 @@
 void cm_toggle_menu_set_active(gchar *menu, gboolean active);
 void cm_menu_set_sensitive_full(GtkUIManager *gui_manager, gchar *menu, gboolean sensitive);
 void cm_toggle_menu_set_active_full(GtkUIManager *gui_manager, gchar *menu, gboolean active);
-
+gchar *cm_menu_item_get_shortcut(GtkUIManager *gui_manager, gchar *menu);
 #if !GTK_CHECK_VERSION(3, 0, 0)
 gint menu_find_option_menu_index(GtkCMOptionMenu *optmenu, gpointer data,
 				 GCompareFunc func);

Index: menu.c
===================================================================
RCS file: /home/claws-mail/claws/src/gtk/menu.c,v
retrieving revision 1.5.2.46
retrieving revision 1.5.2.47
diff -u -d -r1.5.2.46 -r1.5.2.47
--- menu.c	7 Jul 2012 07:09:35 -0000	1.5.2.46
+++ menu.c	29 Aug 2012 09:33:02 -0000	1.5.2.47
@@ -106,6 +106,33 @@
 	g_free(path);
 }
 
+gchar *cm_menu_item_get_shortcut(GtkUIManager *gui_manager, gchar *menu)
+{
+	GtkWidget *widget;
+	gchar *path = g_strdup_printf("/%s/", menu);
+	const gchar *accel = NULL;
+	GtkAccelKey key;
+
+	widget = gtk_ui_manager_get_widget(gui_manager, path);
+	if( !GTK_IS_WIDGET(widget) ) {
+		g_message("Blah, '%s' is not a widget.\n", path);
+	}
+
+	if( !GTK_IS_MENU_ITEM(widget) ) {
+		g_message("Blah, '%s' is not a menu item.\n", path);
+	}
+
+	g_free(path);
+
+	accel = gtk_menu_item_get_accel_path(GTK_MENU_ITEM(widget));
+
+	if (accel && gtk_accel_map_lookup_entry(accel, &key))
+		return gtk_accelerator_get_label (key.accel_key, key.accel_mods);
+	else
+		return g_strdup(_("None"));
+
+}
+
 void cm_toggle_menu_set_active_full(GtkUIManager *gui_manager, gchar *menu, gboolean active)
 {
 	GtkWidget *widget;



More information about the Commits mailing list