Use mnemonics in panel menu items
This commit is contained in:
parent
9a8c7d047f
commit
cb0dd889e0
5 changed files with 45 additions and 21 deletions
|
@ -34,16 +34,20 @@ stock_items_init (void)
|
||||||
{
|
{
|
||||||
static GtkStockItem items[] =
|
static GtkStockItem items[] =
|
||||||
{
|
{
|
||||||
|
{ STOCK_BOOKMARKS },
|
||||||
|
{ STOCK_CONSOLE },
|
||||||
{ STOCK_EXTENSION },
|
{ STOCK_EXTENSION },
|
||||||
{ STOCK_NEWS_FEED },
|
{ STOCK_NEWS_FEED },
|
||||||
{ STOCK_LOCK_OPEN },
|
{ STOCK_LOCK_OPEN },
|
||||||
{ STOCK_LOCK_SECURE },
|
{ STOCK_LOCK_SECURE },
|
||||||
{ STOCK_LOCK_BROKEN },
|
{ STOCK_LOCK_BROKEN },
|
||||||
|
{ STOCK_PAGE_HOLDER },
|
||||||
{ STOCK_SCRIPT },
|
{ STOCK_SCRIPT },
|
||||||
{ STOCK_THEME },
|
{ STOCK_STYLE },
|
||||||
|
{ STOCK_TRANSFER },
|
||||||
{ STOCK_USER_TRASH },
|
{ STOCK_USER_TRASH },
|
||||||
|
|
||||||
{ STOCK_BOOKMARK, N_("Bookmark"), 0, 0, NULL },
|
{ STOCK_BOOKMARK, N_("_Bookmark"), 0, 0, NULL },
|
||||||
{ STOCK_BOOKMARK_ADD, N_("_Add Bookmark"), 0, 0, NULL },
|
{ STOCK_BOOKMARK_ADD, N_("_Add Bookmark"), 0, 0, NULL },
|
||||||
{ STOCK_FORM_FILL, N_("_Form Fill"), 0, 0, NULL },
|
{ STOCK_FORM_FILL, N_("_Form Fill"), 0, 0, NULL },
|
||||||
{ STOCK_HOMEPAGE, N_("_Homepage"), 0, 0, NULL },
|
{ STOCK_HOMEPAGE, N_("_Homepage"), 0, 0, NULL },
|
||||||
|
|
|
@ -30,9 +30,15 @@ KatzeXbelItem* bookmarks;
|
||||||
in order to reduce the amount of warnings */
|
in order to reduce the amount of warnings */
|
||||||
|
|
||||||
#define STOCK_BOOKMARK GTK_STOCK_FILE /* "stock_bookmark" "bookmark-web" */
|
#define STOCK_BOOKMARK GTK_STOCK_FILE /* "stock_bookmark" "bookmark-web" */
|
||||||
|
#define STOCK_BOOKMARKS "vcard"
|
||||||
|
#define STOCK_CONSOLE "terminal"
|
||||||
#define STOCK_EXTENSION GTK_STOCK_EXECUTE /* "extension" */
|
#define STOCK_EXTENSION GTK_STOCK_EXECUTE /* "extension" */
|
||||||
#define STOCK_FORM_FILL GTK_STOCK_JUSTIFY_FILL /* "insert-text" "form-fill" */
|
#define STOCK_FORM_FILL GTK_STOCK_JUSTIFY_FILL /* "insert-text" "form-fill" */
|
||||||
|
#define STOCK_HISTORY "document-open-recent"
|
||||||
#define STOCK_NEWS_FEED "news-feed"
|
#define STOCK_NEWS_FEED "news-feed"
|
||||||
|
#define STOCK_PAGE_HOLDER GTK_STOCK_CONVERT
|
||||||
|
#define STOCK_STYLE "gnome-settings-theme"
|
||||||
|
#define STOCK_TRANSFER "package"
|
||||||
|
|
||||||
/* We assume that these legacy icon names are usually present */
|
/* We assume that these legacy icon names are usually present */
|
||||||
|
|
||||||
|
@ -46,7 +52,6 @@ KatzeXbelItem* bookmarks;
|
||||||
#define STOCK_SCRIPT "stock_script"
|
#define STOCK_SCRIPT "stock_script"
|
||||||
#define STOCK_SEND "stock_mail-send"
|
#define STOCK_SEND "stock_mail-send"
|
||||||
#define STOCK_TAB_NEW "stock_new-tab"
|
#define STOCK_TAB_NEW "stock_new-tab"
|
||||||
#define STOCK_THEME "gnome-settings-theme"
|
|
||||||
#define STOCK_USER_TRASH "gnome-stock-trash"
|
#define STOCK_USER_TRASH "gnome-stock-trash"
|
||||||
#define STOCK_WINDOW_NEW "stock_new-window"
|
#define STOCK_WINDOW_NEW "stock_new-window"
|
||||||
|
|
||||||
|
|
|
@ -3491,14 +3491,14 @@ midori_browser_init (MidoriBrowser* browser)
|
||||||
gtk_widget_show_all (toolbar);
|
gtk_widget_show_all (toolbar);
|
||||||
midori_panel_append_page (MIDORI_PANEL (browser->panel),
|
midori_panel_append_page (MIDORI_PANEL (browser->panel),
|
||||||
box, toolbar,
|
box, toolbar,
|
||||||
"vcard", _("Bookmarks"));
|
STOCK_BOOKMARKS, _("Bookmarks"), _("_Bookmarks"));
|
||||||
|
|
||||||
/* Transfers */
|
/* Transfers */
|
||||||
GtkWidget* panel = midori_web_view_new ();
|
GtkWidget* panel = midori_web_view_new ();
|
||||||
gtk_widget_show (panel);
|
gtk_widget_show (panel);
|
||||||
midori_panel_append_page (MIDORI_PANEL (browser->panel),
|
midori_panel_append_page (MIDORI_PANEL (browser->panel),
|
||||||
panel, NULL,
|
panel, NULL,
|
||||||
"package", _("Transfers"));
|
STOCK_TRANSFER, _("Transfers"), _("_Transfers"));
|
||||||
|
|
||||||
/* Console */
|
/* Console */
|
||||||
browser->panel_console = midori_console_new ();
|
browser->panel_console = midori_console_new ();
|
||||||
|
@ -3507,14 +3507,14 @@ midori_browser_init (MidoriBrowser* browser)
|
||||||
gtk_widget_show (toolbar);
|
gtk_widget_show (toolbar);
|
||||||
midori_panel_append_page (MIDORI_PANEL (browser->panel),
|
midori_panel_append_page (MIDORI_PANEL (browser->panel),
|
||||||
browser->panel_console, toolbar,
|
browser->panel_console, toolbar,
|
||||||
"terminal", _("Console"));
|
STOCK_CONSOLE, _("Console"), _("_Console"));
|
||||||
|
|
||||||
/* History */
|
/* History */
|
||||||
panel = midori_web_view_new ();
|
panel = midori_web_view_new ();
|
||||||
gtk_widget_show (panel);
|
gtk_widget_show (panel);
|
||||||
midori_panel_append_page (MIDORI_PANEL (browser->panel),
|
midori_panel_append_page (MIDORI_PANEL (browser->panel),
|
||||||
panel, NULL,
|
panel, NULL,
|
||||||
"document-open-recent", _("History"));
|
STOCK_HISTORY, _("History"), _("_History"));
|
||||||
|
|
||||||
/* Pageholder */
|
/* Pageholder */
|
||||||
browser->panel_pageholder = g_object_new (MIDORI_TYPE_WEB_VIEW,
|
browser->panel_pageholder = g_object_new (MIDORI_TYPE_WEB_VIEW,
|
||||||
|
@ -3523,7 +3523,7 @@ midori_browser_init (MidoriBrowser* browser)
|
||||||
gtk_widget_show (browser->panel_pageholder);
|
gtk_widget_show (browser->panel_pageholder);
|
||||||
midori_panel_append_page (MIDORI_PANEL (browser->panel),
|
midori_panel_append_page (MIDORI_PANEL (browser->panel),
|
||||||
browser->panel_pageholder, NULL,
|
browser->panel_pageholder, NULL,
|
||||||
GTK_STOCK_CONVERT, _("Pageholder"));
|
STOCK_PAGE_HOLDER, _("Pageholder"), _("_Pageholder"));
|
||||||
|
|
||||||
/* Userscripts */
|
/* Userscripts */
|
||||||
panel = midori_addons_new (GTK_WIDGET (browser), MIDORI_ADDON_USER_SCRIPTS);
|
panel = midori_addons_new (GTK_WIDGET (browser), MIDORI_ADDON_USER_SCRIPTS);
|
||||||
|
@ -3532,7 +3532,7 @@ midori_browser_init (MidoriBrowser* browser)
|
||||||
gtk_widget_show (toolbar);
|
gtk_widget_show (toolbar);
|
||||||
midori_panel_append_page (MIDORI_PANEL (browser->panel),
|
midori_panel_append_page (MIDORI_PANEL (browser->panel),
|
||||||
panel, toolbar,
|
panel, toolbar,
|
||||||
STOCK_SCRIPT, _("Userscripts"));
|
STOCK_SCRIPT, _("Userscripts"), _("_Userscripts"));
|
||||||
/* Userstyles */
|
/* Userstyles */
|
||||||
/*panel = midori_addons_new (GTK_WIDGET (browser), MIDORI_ADDON_USER_STYLES);
|
/*panel = midori_addons_new (GTK_WIDGET (browser), MIDORI_ADDON_USER_STYLES);
|
||||||
gtk_widget_show (panel);
|
gtk_widget_show (panel);
|
||||||
|
@ -3540,7 +3540,7 @@ midori_browser_init (MidoriBrowser* browser)
|
||||||
gtk_widget_show (toolbar);
|
gtk_widget_show (toolbar);
|
||||||
midori_panel_append_page (MIDORI_PANEL (browser->panel),
|
midori_panel_append_page (MIDORI_PANEL (browser->panel),
|
||||||
panel, toolbar,
|
panel, toolbar,
|
||||||
"", _("Userstyles"));*/
|
STOCK_STYLE, _("Userstyles"), _("_Userstyles"));*/
|
||||||
|
|
||||||
/* Extensions */
|
/* Extensions */
|
||||||
panel = midori_addons_new (GTK_WIDGET (browser), MIDORI_ADDON_EXTENSIONS);
|
panel = midori_addons_new (GTK_WIDGET (browser), MIDORI_ADDON_EXTENSIONS);
|
||||||
|
@ -3549,7 +3549,7 @@ midori_browser_init (MidoriBrowser* browser)
|
||||||
gtk_widget_show (toolbar);
|
gtk_widget_show (toolbar);
|
||||||
midori_panel_append_page (MIDORI_PANEL (browser->panel),
|
midori_panel_append_page (MIDORI_PANEL (browser->panel),
|
||||||
panel, toolbar,
|
panel, toolbar,
|
||||||
STOCK_EXTENSION, _("Extensions"));
|
STOCK_EXTENSION, _("Extensions"), _("_Extensions"));
|
||||||
|
|
||||||
/* Notebook, containing all web_views */
|
/* Notebook, containing all web_views */
|
||||||
browser->notebook = gtk_notebook_new ();
|
browser->notebook = gtk_notebook_new ();
|
||||||
|
|
|
@ -339,6 +339,7 @@ midori_panel_menu_item_activate_cb (GtkWidget* widget,
|
||||||
* @toolbar: a toolbar widget, or %NULL
|
* @toolbar: a toolbar widget, or %NULL
|
||||||
* @icon: a stock ID or icon name, or %NULL
|
* @icon: a stock ID or icon name, or %NULL
|
||||||
* @label: a string to use as the label, or %NULL
|
* @label: a string to use as the label, or %NULL
|
||||||
|
* @mnemonic: a string to use as a mnemonic, or %NULL
|
||||||
*
|
*
|
||||||
* Appends a new page to the panel. If @toolbar is specified it will
|
* Appends a new page to the panel. If @toolbar is specified it will
|
||||||
* be packaged above @child.
|
* be packaged above @child.
|
||||||
|
@ -348,6 +349,9 @@ midori_panel_menu_item_activate_cb (GtkWidget* widget,
|
||||||
*
|
*
|
||||||
* If @label is given, it is used as the label of this page.
|
* If @label is given, it is used as the label of this page.
|
||||||
*
|
*
|
||||||
|
* If @mnemonic is given, it is used in labels with mnemonics
|
||||||
|
* such as menu items. See gtk_label_new_with_mnemonic().
|
||||||
|
*
|
||||||
* In the case of an error, -1 is returned.
|
* In the case of an error, -1 is returned.
|
||||||
*
|
*
|
||||||
* Return value: the index of the new page, or -1
|
* Return value: the index of the new page, or -1
|
||||||
|
@ -357,20 +361,30 @@ midori_panel_append_page (MidoriPanel* panel,
|
||||||
GtkWidget* child,
|
GtkWidget* child,
|
||||||
GtkWidget* toolbar,
|
GtkWidget* toolbar,
|
||||||
const gchar* icon,
|
const gchar* icon,
|
||||||
const gchar* label)
|
const gchar* label,
|
||||||
|
const gchar* mnemonic)
|
||||||
{
|
{
|
||||||
|
GtkWidget* scrolled;
|
||||||
|
GtkWidget* widget;
|
||||||
|
GObjectClass* gobject_class;
|
||||||
|
guint n;
|
||||||
|
const gchar* text;
|
||||||
|
const gchar* text_mnemonic;
|
||||||
|
GtkToolItem* toolitem;
|
||||||
|
GtkWidget* image;
|
||||||
|
GtkWidget* menuitem;
|
||||||
|
|
||||||
g_return_val_if_fail (MIDORI_IS_PANEL (panel), -1);
|
g_return_val_if_fail (MIDORI_IS_PANEL (panel), -1);
|
||||||
g_return_val_if_fail (GTK_IS_WIDGET (child), -1);
|
g_return_val_if_fail (GTK_IS_WIDGET (child), -1);
|
||||||
g_return_val_if_fail (!toolbar || GTK_IS_WIDGET (toolbar), -1);
|
g_return_val_if_fail (!toolbar || GTK_IS_WIDGET (toolbar), -1);
|
||||||
|
|
||||||
GtkWidget* scrolled = gtk_scrolled_window_new (NULL, NULL);
|
scrolled = gtk_scrolled_window_new (NULL, NULL);
|
||||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),
|
||||||
GTK_POLICY_AUTOMATIC,
|
GTK_POLICY_AUTOMATIC,
|
||||||
GTK_POLICY_AUTOMATIC);
|
GTK_POLICY_AUTOMATIC);
|
||||||
GTK_WIDGET_SET_FLAGS (scrolled, GTK_CAN_FOCUS);
|
GTK_WIDGET_SET_FLAGS (scrolled, GTK_CAN_FOCUS);
|
||||||
gtk_widget_show (scrolled);
|
gtk_widget_show (scrolled);
|
||||||
GtkWidget* widget;
|
gobject_class = G_OBJECT_GET_CLASS (child);
|
||||||
GObjectClass* gobject_class = G_OBJECT_GET_CLASS (child);
|
|
||||||
if (GTK_WIDGET_CLASS (gobject_class)->set_scroll_adjustments_signal)
|
if (GTK_WIDGET_CLASS (gobject_class)->set_scroll_adjustments_signal)
|
||||||
widget = child;
|
widget = child;
|
||||||
else
|
else
|
||||||
|
@ -387,13 +401,13 @@ midori_panel_append_page (MidoriPanel* panel,
|
||||||
gtk_widget_show (toolbar);
|
gtk_widget_show (toolbar);
|
||||||
gtk_container_add (GTK_CONTAINER (panel->toolbook), toolbar);
|
gtk_container_add (GTK_CONTAINER (panel->toolbook), toolbar);
|
||||||
|
|
||||||
guint n = midori_panel_page_num (panel, child);
|
n = midori_panel_page_num (panel, child);
|
||||||
|
|
||||||
const gchar* text = label ? label : _("Untitled");
|
text = label ? label : _("Untitled");
|
||||||
|
text_mnemonic = mnemonic ? mnemonic : _("_Untitled");
|
||||||
g_object_set_data (G_OBJECT (child), "label", (gchar*)text);
|
g_object_set_data (G_OBJECT (child), "label", (gchar*)text);
|
||||||
|
|
||||||
GtkWidget* image;
|
toolitem = gtk_radio_tool_button_new (panel->group);
|
||||||
GtkToolItem* toolitem = gtk_radio_tool_button_new (panel->group);
|
|
||||||
panel->group = gtk_radio_tool_button_get_group (GTK_RADIO_TOOL_BUTTON (
|
panel->group = gtk_radio_tool_button_get_group (GTK_RADIO_TOOL_BUTTON (
|
||||||
toolitem));
|
toolitem));
|
||||||
gtk_tool_button_set_label (GTK_TOOL_BUTTON (toolitem), text);
|
gtk_tool_button_set_label (GTK_TOOL_BUTTON (toolitem), text);
|
||||||
|
@ -410,7 +424,7 @@ midori_panel_append_page (MidoriPanel* panel,
|
||||||
|
|
||||||
if (panel->menu)
|
if (panel->menu)
|
||||||
{
|
{
|
||||||
GtkWidget* menuitem = gtk_image_menu_item_new_with_label (text);
|
menuitem = gtk_image_menu_item_new_with_mnemonic (text_mnemonic);
|
||||||
if (icon)
|
if (icon)
|
||||||
{
|
{
|
||||||
image = gtk_image_new_from_icon_name (icon, GTK_ICON_SIZE_MENU);
|
image = gtk_image_new_from_icon_name (icon, GTK_ICON_SIZE_MENU);
|
||||||
|
|
|
@ -58,7 +58,8 @@ midori_panel_append_page (MidoriPanel* panel,
|
||||||
GtkWidget* child,
|
GtkWidget* child,
|
||||||
GtkWidget* toolbar,
|
GtkWidget* toolbar,
|
||||||
const gchar* icon,
|
const gchar* icon,
|
||||||
const gchar* label);
|
const gchar* label,
|
||||||
|
const gchar* mnemonic);
|
||||||
|
|
||||||
gint
|
gint
|
||||||
midori_panel_get_current_page (MidoriPanel* panel);
|
midori_panel_get_current_page (MidoriPanel* panel);
|
||||||
|
|
Loading…
Reference in a new issue