Commit 4ee99734 authored by Vincent Untz's avatar Vincent Untz Committed by Vincent Untz
Browse files

don't use setup_menuitem(), but gtk_menu_item_new_with_mnemonic() since we

2007-07-01  Vincent Untz  <vuntz@gnome.org>

	* menu.[ch]: (create_item_context_menu): don't use setup_menuitem(),
	but gtk_menu_item_new_with_mnemonic() since we don't need what
	setup_menuitem() does
	(setup_menuitem): always create invisible mnemonic
	(create_submenu_entry): updated
	(create_menuitem): updated
	(setup_menu_item_with_icon): always create invisible mnemonic
	* panel-menu-items.c:
	* panel-recent.c: updated for
	setup_menuitem()/setup_menu_item_with_icon() change

svn path=/trunk/; revision=10511
parent 8b7b78f1
2007-07-01 Vincent Untz <vuntz@gnome.org>
* menu.[ch]: (create_item_context_menu): don't use setup_menuitem(),
but gtk_menu_item_new_with_mnemonic() since we don't need what
setup_menuitem() does
(setup_menuitem): always create invisible mnemonic
(create_submenu_entry): updated
(create_menuitem): updated
(setup_menu_item_with_icon): always create invisible mnemonic
* panel-menu-items.c:
* panel-recent.c: updated for
setup_menuitem()/setup_menu_item_with_icon() change
2007-07-01 Vincent Untz <vuntz@gnome.org>
 
* panel-toplevel.c: add two comments to help with understanding the
......
......@@ -930,65 +930,43 @@ create_item_context_menu (GtkWidget *item,
g_signal_connect (menu, "deactivate",
G_CALLBACK (restore_grabs), item);
menuitem = gtk_image_menu_item_new ();
setup_menuitem (menuitem,
panel_menu_icon_get_size (),
NULL,
_("Add this launcher to _panel"),
FALSE);
menuitem = gtk_menu_item_new_with_mnemonic (_("Add this launcher to _panel"));
g_signal_connect (menuitem, "activate",
G_CALLBACK (add_app_to_panel), entry);
gtk_widget_set_sensitive (menuitem, id_lists_writable);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
gtk_widget_show (menuitem);
menuitem = gtk_image_menu_item_new ();
setup_menuitem (menuitem,
panel_menu_icon_get_size (),
NULL,
_("Add this launcher to _desktop"),
FALSE);
menuitem = gtk_menu_item_new_with_mnemonic (_("Add this launcher to _desktop"));
g_signal_connect (menuitem, "activate",
G_CALLBACK (add_app_to_desktop), entry);
gtk_widget_set_sensitive (menuitem, id_lists_writable);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
gtk_widget_show (menuitem);
submenu = create_empty_menu ();
g_object_set_data (G_OBJECT (submenu), "menu_panel", panel_widget);
menuitem = gtk_image_menu_item_new ();
setup_menuitem (menuitem,
panel_menu_icon_get_size (),
NULL,
_("_Entire menu"),
FALSE);
menuitem = gtk_menu_item_new_with_mnemonic (_("_Entire menu"));
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), submenu);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
gtk_widget_show (menuitem);
menuitem = gtk_image_menu_item_new ();
setup_menuitem (menuitem,
panel_menu_icon_get_size (),
NULL,
_("Add this as _drawer to panel"),
FALSE);
menuitem = gtk_menu_item_new_with_mnemonic (_("Add this as _drawer to panel"));
g_signal_connect (menuitem, "activate",
G_CALLBACK (add_menudrawer_to_panel), entry);
gtk_widget_set_sensitive (menuitem, id_lists_writable);
gtk_menu_shell_append (GTK_MENU_SHELL (submenu), menuitem);
gtk_widget_show (menuitem);
menuitem = gtk_image_menu_item_new ();
setup_menuitem (menuitem,
panel_menu_icon_get_size (),
NULL,
_("Add this as _menu to panel"),
FALSE);
menuitem = gtk_menu_item_new_with_mnemonic (_("Add this as _menu to panel"));
g_signal_connect (menuitem, "activate",
G_CALLBACK (add_menu_to_panel), entry);
gtk_widget_set_sensitive (menuitem, id_lists_writable);
gtk_menu_shell_append (GTK_MENU_SHELL (submenu), menuitem);
gtk_widget_show (menuitem);
return menu;
}
......@@ -1204,26 +1182,21 @@ void
setup_menuitem (GtkWidget *menuitem,
GtkIconSize icon_size,
GtkWidget *image,
const char *title,
gboolean create_invisible_mnemonic)
const char *title)
{
GtkWidget *label;
char *_title;
if (create_invisible_mnemonic) {
char *_title;
label = g_object_new (GTK_TYPE_ACCEL_LABEL, NULL);
_title = menu_escape_underscores_and_prepend (title);
gtk_label_set_text_with_mnemonic (GTK_LABEL (label), _title);
g_free (_title);
/* this creates a label with an invisible mnemonic */
label = g_object_new (GTK_TYPE_ACCEL_LABEL, NULL);
_title = menu_escape_underscores_and_prepend (title);
gtk_label_set_text_with_mnemonic (GTK_LABEL (label), _title);
g_free (_title);
gtk_label_set_pattern (GTK_LABEL (label), "");
gtk_label_set_pattern (GTK_LABEL (label), "");
gtk_accel_label_set_accel_widget (GTK_ACCEL_LABEL (label),
menuitem);
} else
label = gtk_label_new_with_mnemonic (title);
gtk_accel_label_set_accel_widget (GTK_ACCEL_LABEL (label), menuitem);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_widget_show (label);
......@@ -1437,8 +1410,7 @@ create_submenu_entry (GtkWidget *menu,
setup_menuitem (menuitem,
panel_menu_icon_get_size (),
NULL,
gmenu_tree_directory_get_name (directory),
TRUE);
gmenu_tree_directory_get_name (directory));
if (gmenu_tree_directory_get_comment (directory))
panel_util_set_tooltip_text (menuitem,
......@@ -1446,6 +1418,8 @@ create_submenu_entry (GtkWidget *menu,
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
gtk_widget_show (menuitem);
return menuitem;
}
......@@ -1520,8 +1494,7 @@ create_menuitem (GtkWidget *menu,
panel_menu_icon_get_size (),
NULL,
alias_directory ? gmenu_tree_directory_get_name (alias_directory) :
gmenu_tree_entry_get_name (entry),
TRUE);
gmenu_tree_entry_get_name (entry));
if ((alias_directory &&
gmenu_tree_directory_get_comment (alias_directory)) ||
......@@ -1570,6 +1543,8 @@ create_menuitem (GtkWidget *menu,
g_signal_connect (menuitem, "activate",
G_CALLBACK (activate_app_def), entry);
gtk_widget_show (menuitem);
}
static void
......@@ -1747,14 +1722,13 @@ setup_menu_item_with_icon (GtkWidget *item,
GtkIconSize icon_size,
const char *icon_name,
const char *stock_id,
const char *title,
gboolean create_invisible_mnemonic)
const char *title)
{
if (icon_name || stock_id)
panel_load_menu_image_deferred (item, icon_size,
stock_id, icon_name, NULL);
setup_menuitem (item, icon_size, NULL, title, create_invisible_mnemonic);
setup_menuitem (item, icon_size, NULL, title);
}
static void
......
......@@ -32,14 +32,12 @@ G_BEGIN_DECLS
void setup_menuitem (GtkWidget *menuitem,
GtkIconSize icon_size,
GtkWidget *pixmap,
const char *title,
gboolean create_invisible_mnemonic);
const char *title);
void setup_menu_item_with_icon (GtkWidget *item,
GtkIconSize icon_size,
const char *icon_name,
const char *stock_id,
const char *title,
gboolean create_invisible_mnemonic);
const char *title);
GtkWidget *create_empty_menu (void);
GtkWidget *create_applications_menu (const char *menu_file,
......
......@@ -206,7 +206,7 @@ panel_menu_items_append_from_desktop (GtkWidget *menu,
item = gtk_image_menu_item_new ();
setup_menu_item_with_icon (item, panel_menu_icon_get_size (),
icon, NULL, name, TRUE);
icon, NULL, name);
panel_util_set_tooltip_text (item, comment);
......@@ -253,8 +253,7 @@ panel_menu_items_append_place_item (const char *icon_name,
panel_menu_icon_get_size (),
icon_name,
NULL,
title,
TRUE);
title);
panel_util_set_tooltip_text (item, tooltip);
......@@ -285,8 +284,7 @@ panel_menu_items_create_action_item_full (PanelActionButtonType action_type,
panel_menu_icon_get_size (),
panel_action_get_icon_name (action_type),
NULL,
label ? label : panel_action_get_text (action_type),
TRUE);
label ? label : panel_action_get_text (action_type));
panel_util_set_tooltip_text (item,
tooltip ?
......@@ -404,7 +402,7 @@ panel_place_menu_item_append_gtk_bookmarks (GtkWidget *menu)
item = gtk_image_menu_item_new ();
setup_menu_item_with_icon (item, panel_menu_icon_get_size (),
PANEL_ICON_BOOKMARKS, NULL,
_("Bookmarks"), TRUE);
_("Bookmarks"));
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
gtk_widget_show (item);
......@@ -524,7 +522,7 @@ panel_place_menu_item_append_volumes (GtkWidget *menu,
item = gtk_image_menu_item_new ();
setup_menu_item_with_icon (item, panel_menu_icon_get_size (),
icon, NULL, title, TRUE);
icon, NULL, title);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
gtk_widget_show (item);
......@@ -910,8 +908,7 @@ panel_place_menu_item_new (gboolean use_image)
setup_menuitem (GTK_WIDGET (menuitem),
image ? panel_menu_icon_get_size () : GTK_ICON_SIZE_INVALID,
image,
_("Places"),
TRUE);
_("Places"));
menuitem->priv->use_image = use_image;
......@@ -940,8 +937,7 @@ panel_desktop_menu_item_new (gboolean use_image,
setup_menuitem (GTK_WIDGET (menuitem),
image ? panel_menu_icon_get_size () : GTK_ICON_SIZE_INVALID,
image,
_("System"),
TRUE);
_("System"));
menuitem->priv->use_image = use_image;
......
......@@ -213,8 +213,7 @@ panel_recent_append_documents_menu (GtkWidget *top_menu,
panel_menu_icon_get_size (),
PANEL_ICON_RECENT,
NULL,
_("Recent Documents"),
TRUE);
_("Recent Documents"));
recent_menu = gtk_recent_chooser_menu_new_for_manager (manager);
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_item), recent_menu);
......@@ -253,8 +252,7 @@ panel_recent_append_documents_menu (GtkWidget *top_menu,
panel_menu_icon_get_size (),
NULL,
GTK_STOCK_CLEAR,
_("Clear Recent Documents"),
TRUE);
_("Clear Recent Documents"));
panel_util_set_tooltip_text (menu_item,
_("Clear all items from the recent documents list"));
gtk_menu_shell_append (GTK_MENU_SHELL (recent_menu), menu_item);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment