static void
stock_items_init (void)
{
- static GtkStockItem items[] =
+ typedef struct
{
- { STOCK_BOOKMARKS },
- { STOCK_CONSOLE },
- { STOCK_EXTENSION },
- { STOCK_NEWS_FEED },
- { STOCK_LOCK_OPEN },
- { STOCK_LOCK_SECURE },
- { STOCK_LOCK_BROKEN },
- { STOCK_PAGE_HOLDER },
- { STOCK_SCRIPT },
- { STOCK_STYLE },
- { STOCK_TRANSFER },
- { STOCK_USER_TRASH },
-
- { STOCK_BOOKMARK, N_("_Bookmark"), 0, 0, NULL },
- { STOCK_BOOKMARK_ADD, N_("_Add Bookmark"), 0, 0, NULL },
- { STOCK_FORM_FILL, N_("_Form Fill"), 0, 0, NULL },
- { STOCK_HOMEPAGE, N_("_Homepage"), 0, 0, NULL },
- { STOCK_TAB_NEW, N_("New _Tab"), 0, 0, NULL },
- { STOCK_WINDOW_NEW, N_("New _Window"), 0, 0, NULL },
+ gchar* stock_id;
+ gchar* label;
+ GdkModifierType modifier;
+ guint keyval;
+ gchar* fallback;
+ } FatStockItem;
+
+ static FatStockItem items[] =
+ {
+ { STOCK_EXTENSION, NULL, 0, 0, GTK_STOCK_CONVERT },
+ { STOCK_NEWS_FEED, NULL, 0, 0, GTK_STOCK_INDEX },
+ { STOCK_SCRIPT, NULL, 0, 0, GTK_STOCK_EXECUTE },
+ { STOCK_STYLE, NULL, 0, 0, GTK_STOCK_SELECT_COLOR },
+ { STOCK_TRANSFER, NULL, 0, 0, GTK_STOCK_SAVE },
+
+ { STOCK_BOOKMARK, N_("_Bookmark"), 0, 0, GTK_STOCK_FILE },
+ { STOCK_BOOKMARKS, N_("_Bookmarks"), 0, 0, GTK_STOCK_DIRECTORY },
+ { STOCK_BOOKMARK_ADD, N_("_Add Bookmark"), 0, 0, GTK_STOCK_ADD },
+ { STOCK_CONSOLE, N_("_Console"), 0, 0, GTK_STOCK_DIALOG_WARNING },
+ { STOCK_EXTENSIONS, N_("_Extensions"), 0, 0, GTK_STOCK_CONVERT },
+ { STOCK_HISTORY, N_("_History"), 0, 0, GTK_STOCK_SORT_ASCENDING },
+ { STOCK_HOMEPAGE, N_("_Homepage"), 0, 0, GTK_STOCK_HOME },
+ { STOCK_PAGE_HOLDER, N_("_Pageholder"), 0, 0, GTK_STOCK_ORIENTATION_PORTRAIT },
+ { STOCK_SCRIPTS, N_("_Userscripts"), 0, 0, GTK_STOCK_EXECUTE },
+ { STOCK_STYLES, N_("User_styles"), 0, 0, GTK_STOCK_SELECT_COLOR },
+ { STOCK_TAB_NEW, N_("New _Tab"), 0, 0, GTK_STOCK_ADD },
+ { STOCK_TRANSFERS, N_("_Transfers"), 0, 0, GTK_STOCK_SAVE },
+ { STOCK_USER_TRASH, N_("_Closed Tabs and Windows"), 0, 0, "gtk-undo-ltr" },
+ { STOCK_WINDOW_NEW, N_("New _Window"), 0, 0, GTK_STOCK_ADD },
#if !GTK_CHECK_VERSION(2, 10, 0)
{ GTK_STOCK_SELECT_ALL, N_("Select _All"), 0, 0, NULL },
#endif
{ GTK_STOCK_LEAVE_FULLSCREEN, N_("_Leave Fullscreen"), 0, 0, NULL },
#endif
};
+
GtkIconSource* icon_source;
GtkIconSet* icon_set;
GtkIconFactory* factory = gtk_icon_factory_new ();
for (i = 0; i < (guint)G_N_ELEMENTS (items); i++)
{
+ icon_set = gtk_icon_set_new ();
icon_source = gtk_icon_source_new ();
+ if (items[i].fallback)
+ {
+ gtk_icon_source_set_icon_name (icon_source, items[i].fallback);
+ items[i].fallback = NULL;
+ gtk_icon_set_add_source (icon_set, icon_source);
+ }
gtk_icon_source_set_icon_name (icon_source, items[i].stock_id);
- icon_set = gtk_icon_set_new ();
gtk_icon_set_add_source (icon_set, icon_source);
gtk_icon_source_free (icon_source);
gtk_icon_factory_add (factory, items[i].stock_id, icon_set);
gtk_icon_set_unref (icon_set);
}
- gtk_stock_add_static (items, G_N_ELEMENTS (items));
+ gtk_stock_add ((GtkStockItem*)items, G_N_ELEMENTS (items));
gtk_icon_factory_add_default (factory);
g_object_unref (factory);
}
/* Custom stock items
We should distribute these
- Names should match with epiphany and/ or xdg spec
- NOTE: Those uncommented were replaced with remotely related icons
- in order to reduce the amount of warnings */
+ Names should match with epiphany and/ or xdg spec */
-#define STOCK_BOOKMARK GTK_STOCK_FILE /* "stock_bookmark" "bookmark-web" */
+#define STOCK_BOOKMARK "stock_bookmark"
#define STOCK_BOOKMARKS "vcard"
#define STOCK_CONSOLE "terminal"
-#define STOCK_EXTENSION GTK_STOCK_EXECUTE /* "extension" */
-#define STOCK_FORM_FILL GTK_STOCK_JUSTIFY_FILL /* "insert-text" "form-fill" */
+#define STOCK_EXTENSION "extension"
+#define STOCK_EXTENSIONS "extension"
#define STOCK_HISTORY "document-open-recent"
#define STOCK_NEWS_FEED "news-feed"
-#define STOCK_PAGE_HOLDER GTK_STOCK_CONVERT
+#define STOCK_PAGE_HOLDER "page-holder"
#define STOCK_STYLE "gnome-settings-theme"
+#define STOCK_STYLES "gnome-settings-theme"
#define STOCK_TRANSFER "package"
+#define STOCK_TRANSFERS "package"
/* We assume that these legacy icon names are usually present */
#define STOCK_BOOKMARK_ADD "stock_add-bookmark"
#define STOCK_HOMEPAGE GTK_STOCK_HOME
#define STOCK_IMAGE "gnome-mime-image"
-#define STOCK_LOCK_OPEN "stock_lock-open"
-#define STOCK_LOCK_SECURE "stock_lock"
-#define STOCK_LOCK_BROKEN "stock_lock-broken"
#define STOCK_NETWORK_OFFLINE "network-offline"
#define STOCK_SCRIPT "stock_script"
+#define STOCK_SCRIPTS "stock_script"
#define STOCK_SEND "stock_mail-send"
#define STOCK_TAB_NEW "stock_new-tab"
#define STOCK_USER_TRASH "gnome-stock-trash"
GtkWidget* statusbar;
GtkWidget* progressbar;
- const gchar* stock_news_feed;
-
gchar* statusbar_text;
MidoriWebSettings* settings;
GList* tab_titles;
/* if (web_view && midori_web_view_get_news_feeds (MIDORI_WEB_VIEW (web_view)))
gtk_icon_entry_set_icon_from_stock (GTK_ICON_ENTRY (
gtk_bin_get_child (GTK_BIN (browser->location))),
- GTK_ICON_ENTRY_SECONDARY, browser->stock_news_feed);
+ GTK_ICON_ENTRY_SECONDARY, STOCK_NEWS_FEED);
else
gtk_icon_entry_set_icon_from_pixbuf (GTK_ICON_ENTRY (
gtk_bin_get_child (GTK_BIN (browser->location))),
MidoriBrowser* browser)
{
midori_location_action_set_secondary_icon (MIDORI_LOCATION_ACTION (
- _action_by_name (browser, "Location")), browser->stock_news_feed);
+ _action_by_name (browser, "Location")), STOCK_NEWS_FEED);
}
static gboolean
menuitem = gtk_image_menu_item_new_with_label (title);
/* FIXME: Get the real icon */
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (
- menuitem), gtk_image_new_from_stock (browser->stock_news_feed,
+ menuitem), gtk_image_new_from_stock (STOCK_NEWS_FEED,
GTK_ICON_SIZE_MENU));
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
g_object_set_data (G_OBJECT (menuitem), "uri", (gchar*)uri);
N_("Open in Page_holder..."), "",
N_("Open the current page in the pageholder"), G_CALLBACK (_action_open_in_panel_activate) },
{ "Trash", STOCK_USER_TRASH,
- N_("Closed Tabs and Windows"), "",
+ NULL, "",
/* N_("Reopen a previously closed tab or window"), G_CALLBACK (_action_trash_activate) }, */
N_("Reopen a previously closed tab or window"), NULL },
{ "TrashEmpty", GTK_STOCK_CLEAR,
gtk_window_set_icon_name (GTK_WINDOW (browser), "midori");
else
gtk_window_set_icon_name (GTK_WINDOW (browser), "web-browser");
- if (gtk_icon_theme_has_icon (icon_theme, STOCK_NEWS_FEED))
- browser->stock_news_feed = STOCK_NEWS_FEED;
- else
- browser->stock_news_feed = GTK_STOCK_INDEX;
}
}
GtkToolItem* toolitem;
GtkRcStyle* rcstyle;
- browser->stock_news_feed = GTK_STOCK_INDEX;
-
/* Setup the window metrics */
g_signal_connect (browser, "realize",
G_CALLBACK (midori_browser_realize_cb), browser);
"stock-id", GTK_STOCK_JUMP_TO,
"tooltip", _("Open a particular location"),
/* FIXME: Due to a bug in GtkIconEntry we need to set an initial icon */
- "secondary-icon", browser->stock_news_feed,
+ "secondary-icon", STOCK_NEWS_FEED,
NULL);
g_object_connect (action,
"signal::activate",
gtk_widget_show_all (toolbar);
midori_panel_append_page (MIDORI_PANEL (browser->panel),
box, toolbar,
- STOCK_BOOKMARKS, _("Bookmarks"), _("_Bookmarks"));
+ STOCK_BOOKMARKS, _("Bookmarks"));
/* Transfers */
GtkWidget* panel = midori_web_view_new ();
gtk_widget_show (panel);
midori_panel_append_page (MIDORI_PANEL (browser->panel),
panel, NULL,
- STOCK_TRANSFER, _("Transfers"), _("_Transfers"));
+ STOCK_TRANSFERS, _("Transfers"));
/* Console */
browser->panel_console = midori_console_new ();
gtk_widget_show (toolbar);
midori_panel_append_page (MIDORI_PANEL (browser->panel),
browser->panel_console, toolbar,
- STOCK_CONSOLE, _("Console"), _("_Console"));
+ STOCK_CONSOLE, _("Console"));
/* History */
panel = midori_web_view_new ();
gtk_widget_show (panel);
midori_panel_append_page (MIDORI_PANEL (browser->panel),
panel, NULL,
- STOCK_HISTORY, _("History"), _("_History"));
+ STOCK_HISTORY, _("History"));
/* Pageholder */
browser->panel_pageholder = g_object_new (MIDORI_TYPE_WEB_VIEW,
gtk_widget_show (browser->panel_pageholder);
midori_panel_append_page (MIDORI_PANEL (browser->panel),
browser->panel_pageholder, NULL,
- STOCK_PAGE_HOLDER, _("Pageholder"), _("_Pageholder"));
+ STOCK_PAGE_HOLDER, _("Pageholder"));
/* Userscripts */
panel = midori_addons_new (GTK_WIDGET (browser), MIDORI_ADDON_USER_SCRIPTS);
gtk_widget_show (toolbar);
midori_panel_append_page (MIDORI_PANEL (browser->panel),
panel, toolbar,
- STOCK_SCRIPT, _("Userscripts"), _("_Userscripts"));
+ STOCK_SCRIPTS, _("Userscripts"));
/* Userstyles */
/*panel = midori_addons_new (GTK_WIDGET (browser), MIDORI_ADDON_USER_STYLES);
gtk_widget_show (panel);
gtk_widget_show (toolbar);
midori_panel_append_page (MIDORI_PANEL (browser->panel),
panel, toolbar,
- STOCK_STYLE, _("Userstyles"), _("_Userstyles"));*/
+ STOCK_STYLES, _("Userstyles"));*/
/* Extensions */
panel = midori_addons_new (GTK_WIDGET (browser), MIDORI_ADDON_EXTENSIONS);
gtk_widget_show (toolbar);
midori_panel_append_page (MIDORI_PANEL (browser->panel),
panel, toolbar,
- STOCK_EXTENSION, _("Extensions"), _("_Extensions"));
+ STOCK_EXTENSIONS, _("Extensions"));
/* Notebook, containing all web_views */
browser->notebook = gtk_notebook_new ();
* @panel: a #MidoriPanel
* @child: the child widget
* @toolbar: a toolbar widget, or %NULL
- * @icon: a stock ID or icon name, or %NULL
- * @label: a string to use as the label, or %NULL
- * @mnemonic: a string to use as a mnemonic, or %NULL
+ * @stock_id: a stock ID
+ * @label: a string to use as the label
*
* Appends a new page to the panel. If @toolbar is specified it will
* be packaged above @child.
*
- * If @icon is an icon name, the according image is used as an
- * icon for 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.
*
* Return value: the index of the new page, or -1
midori_panel_append_page (MidoriPanel* panel,
GtkWidget* child,
GtkWidget* toolbar,
- const gchar* icon,
- const gchar* label,
- const gchar* mnemonic)
+ const gchar* stock_id,
+ const gchar* label)
{
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 (GTK_IS_WIDGET (child), -1);
g_return_val_if_fail (!toolbar || GTK_IS_WIDGET (toolbar), -1);
+ g_return_val_if_fail (stock_id != NULL, -1);
+ g_return_val_if_fail (label != NULL, -1);
scrolled = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),
n = midori_panel_page_num (panel, child);
- 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*)label);
toolitem = gtk_radio_tool_button_new (panel->group);
panel->group = gtk_radio_tool_button_get_group (GTK_RADIO_TOOL_BUTTON (
toolitem));
- gtk_tool_button_set_label (GTK_TOOL_BUTTON (toolitem), text);
- if (icon)
- {
- image = gtk_image_new_from_icon_name (icon, GTK_ICON_SIZE_BUTTON);
- gtk_tool_button_set_icon_widget (GTK_TOOL_BUTTON (toolitem), image);
- }
+ image = gtk_image_new_from_stock (stock_id, GTK_ICON_SIZE_BUTTON);
+ gtk_tool_button_set_icon_widget (GTK_TOOL_BUTTON (toolitem), image);
+ gtk_tool_button_set_label (GTK_TOOL_BUTTON (toolitem), label);
g_object_set_data (G_OBJECT (toolitem), "page", child);
g_signal_connect (toolitem, "clicked",
G_CALLBACK (midori_panel_menu_item_activate_cb), panel);
if (panel->menu)
{
- menuitem = gtk_image_menu_item_new_with_mnemonic (text_mnemonic);
- if (icon)
- {
- image = gtk_image_new_from_icon_name (icon, GTK_ICON_SIZE_MENU);
- gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menuitem),
- image);
- }
- gtk_widget_show_all (menuitem);
+ menuitem = gtk_image_menu_item_new_from_stock (stock_id, NULL);
+ gtk_widget_show (menuitem);
g_object_set_data (G_OBJECT (menuitem), "page", child);
g_object_set_data (G_OBJECT (menuitem), "toolitem", toolitem);
g_signal_connect (menuitem, "activate",
midori_panel_append_page (MidoriPanel* panel,
GtkWidget* child,
GtkWidget* toolbar,
- const gchar* icon,
- const gchar* label,
- const gchar* mnemonic);
+ const gchar* stock_id,
+ const gchar* label);
gint
midori_panel_get_current_page (MidoriPanel* panel);