From c236e4da9ecd46ac16cad7563aa19c6d481abf3a Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Wed, 11 Jul 2012 18:04:59 +0200 Subject: [PATCH] Drop compatibility layer for legacy icon names Fixes: https://bugs.launchpad.net/midori/+bug/988231 --- extensions/statusbar-features.c | 2 +- midori/main.c | 2 +- midori/midori-app.c | 101 +++++--------------------------- midori/midori-browser.c | 8 +-- midori/midori-stock.h | 37 +++--------- panels/midori-extensions.c | 2 +- panels/midori-transfers.c | 2 +- 7 files changed, 33 insertions(+), 121 deletions(-) diff --git a/extensions/statusbar-features.c b/extensions/statusbar-features.c index 4641723a..e2210d7f 100644 --- a/extensions/statusbar-features.c +++ b/extensions/statusbar-features.c @@ -160,7 +160,7 @@ statusbar_features_property_proxy (MidoriWebSettings* settings, if (!strcmp (property, "enable-scripts")) { g_object_set_data (G_OBJECT (button), "feature-label", _("Scripts")); - image = gtk_image_new_from_stock (STOCK_SCRIPTS, GTK_ICON_SIZE_MENU); + image = gtk_image_new_from_stock (STOCK_SCRIPT, GTK_ICON_SIZE_MENU); gtk_button_set_image (GTK_BUTTON (button), image); gtk_widget_set_tooltip_text (button, _("Enable scripts")); statusbar_features_toolbar_notify_toolbar_style_cb (toolbar, NULL, button); diff --git a/midori/main.c b/midori/main.c index b0206186..fe3a633e 100644 --- a/midori/main.c +++ b/midori/main.c @@ -678,7 +678,7 @@ midori_browser_show_preferences_cb (MidoriBrowser* browser, gtk_widget_reparent (g_list_nth_data (children, 0), scrolled); g_list_free (children); page = katze_preferences_add_category (preferences, - _("Extensions"), STOCK_EXTENSIONS); + _("Extensions"), STOCK_EXTENSION); gtk_box_pack_start (GTK_BOX (page), scrolled, TRUE, TRUE, 4); } diff --git a/midori/midori-app.c b/midori/midori-app.c index 816d465a..18642795 100644 --- a/midori/midori-app.c +++ b/midori/midori-app.c @@ -1405,38 +1405,24 @@ midori_app_setup (gchar** argument_vector) gsize i; gchar* executable; - typedef struct + static GtkStockItem items[] = { - const gchar* stock_id; - const gchar* label; - GdkModifierType modifier; - guint keyval; - const gchar* fallback; - } FatStockItem; - static FatStockItem items[] = - { - { STOCK_EXTENSION, NULL, 0, 0, GTK_STOCK_CONVERT }, - { STOCK_IMAGE, NULL, 0, 0, GTK_STOCK_ORIENTATION_PORTRAIT }, - { STOCK_WEB_BROWSER, NULL, 0, 0, "gnome-web-browser" }, - { 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_IMAGE }, + { STOCK_WEB_BROWSER }, + { STOCK_NEWS_FEED }, + { STOCK_STYLE }, - { STOCK_BOOKMARK, N_("_Bookmark"), 0, 0, GTK_STOCK_FILE }, - { STOCK_BOOKMARKS, N_("_Bookmarks"), GDK_CONTROL_MASK | GDK_SHIFT_MASK, GDK_KEY_B, GTK_STOCK_DIRECTORY }, - { STOCK_BOOKMARK_ADD, N_("Add Boo_kmark"), 0, 0, "stock_add-bookmark" }, - { STOCK_CONSOLE, N_("_Console"), 0, 0, GTK_STOCK_DIALOG_WARNING }, - { STOCK_EXTENSIONS, N_("_Extensions"), 0, 0, GTK_STOCK_CONVERT }, - { STOCK_HISTORY, N_("_History"), GDK_CONTROL_MASK | GDK_SHIFT_MASK, GDK_KEY_H, GTK_STOCK_SORT_ASCENDING }, - { STOCK_HOMEPAGE, N_("_Homepage"), 0, 0, GTK_STOCK_HOME }, - { STOCK_SCRIPTS, N_("_Userscripts"), 0, 0, GTK_STOCK_EXECUTE }, - { STOCK_TAB_NEW, N_("New _Tab"), 0, 0, GTK_STOCK_ADD }, - { STOCK_TRANSFERS, N_("_Transfers"), GDK_CONTROL_MASK | GDK_SHIFT_MASK, GDK_KEY_J, GTK_STOCK_SAVE }, - { STOCK_PLUGINS, N_("Netscape p_lugins"), 0, 0, GTK_STOCK_CONVERT }, - { STOCK_USER_TRASH, N_("_Closed Tabs"), 0, 0, "gtk-undo-ltr" }, - { STOCK_WINDOW_NEW, N_("New _Window"), 0, 0, GTK_STOCK_ADD }, - { GTK_STOCK_DIRECTORY, N_("New _Folder"), 0, 0, NULL }, + { STOCK_BOOKMARKS, N_("_Bookmarks"), GDK_CONTROL_MASK | GDK_SHIFT_MASK, GDK_KEY_B }, + { STOCK_BOOKMARK_ADD, N_("Add Boo_kmark") }, + { STOCK_EXTENSION, N_("_Extensions") }, + { STOCK_HISTORY, N_("_History"), GDK_CONTROL_MASK | GDK_SHIFT_MASK, GDK_KEY_H }, + { STOCK_SCRIPT, N_("_Userscripts") }, + { STOCK_STYLE, N_("User_styles") }, + { STOCK_TAB_NEW, N_("New _Tab") }, + { STOCK_TRANSFER, N_("_Transfers"), GDK_CONTROL_MASK | GDK_SHIFT_MASK, GDK_KEY_J }, + { STOCK_PLUGINS, N_("Netscape p_lugins") }, + { STOCK_USER_TRASH, N_("_Closed Tabs") }, + { STOCK_WINDOW_NEW, N_("New _Window") }, }; /* libSoup uses threads, therefore if WebKit is built with libSoup @@ -1469,12 +1455,6 @@ midori_app_setup (gchar** argument_vector) { 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); gtk_icon_set_add_source (icon_set, icon_source); gtk_icon_source_free (icon_source); @@ -1485,55 +1465,6 @@ midori_app_setup (gchar** argument_vector) gtk_icon_factory_add_default (factory); g_object_unref (factory); - #if HAVE_HILDON - /* Maemo doesn't theme stock icons. So we map platform icons - to stock icons. These are all monochrome toolbar icons. */ - typedef struct - { - const gchar* stock_id; - const gchar* icon_name; - } CompatItem; - static CompatItem compat_items[] = - { - { GTK_STOCK_ADD, "general_add" }, - { GTK_STOCK_BOLD, "general_bold" }, - { GTK_STOCK_CLOSE, "general_close_b" }, - { GTK_STOCK_DELETE, "general_delete" }, - { GTK_STOCK_DIRECTORY, "general_toolbar_folder" }, - { GTK_STOCK_FIND, "general_search" }, - { GTK_STOCK_FULLSCREEN, "general_fullsize_b" }, - { GTK_STOCK_GO_BACK, "general_back" }, - { GTK_STOCK_GO_FORWARD, "general_forward" }, - { GTK_STOCK_GO_UP, "filemanager_folder_up" }, - { GTK_STOCK_GOTO_FIRST, "pdf_viewer_first_page" }, - { GTK_STOCK_GOTO_LAST, "pdf_viewer_last_page" }, - { GTK_STOCK_INFO, "general_information" }, - { GTK_STOCK_ITALIC, "general_italic" }, - { GTK_STOCK_JUMP_TO, "general_move_to_folder" }, - { GTK_STOCK_PREFERENCES,"general_settings" }, - { GTK_STOCK_REFRESH, "general_refresh" }, - { GTK_STOCK_SAVE, "notes_save" }, - { GTK_STOCK_STOP, "general_stop" }, - { GTK_STOCK_UNDERLINE, "notes_underline" }, - { GTK_STOCK_ZOOM_IN, "pdf_zoomin" }, - { GTK_STOCK_ZOOM_OUT, "pdf_zoomout" }, - }; - - factory = gtk_icon_factory_new (); - for (i = 0; i < G_N_ELEMENTS (compat_items); i++) - { - icon_set = gtk_icon_set_new (); - icon_source = gtk_icon_source_new (); - gtk_icon_source_set_icon_name (icon_source, compat_items[i].icon_name); - gtk_icon_set_add_source (icon_set, icon_source); - gtk_icon_source_free (icon_source); - gtk_icon_factory_add (factory, compat_items[i].stock_id, icon_set); - gtk_icon_set_unref (icon_set); - } - gtk_icon_factory_add_default (factory); - g_object_unref (factory); - #endif - /* Preserve argument vector */ command_line = g_strdupv (argument_vector); #ifdef G_OS_WIN32 diff --git a/midori/midori-browser.c b/midori/midori-browser.c index bad4217c..3c32a18a 100644 --- a/midori/midori-browser.c +++ b/midori/midori-browser.c @@ -5595,8 +5595,8 @@ static const GtkActionEntry entries[] = NULL, "Right", /* i18n: Visit the following logical page, ie. in a forum or blog */ N_("Go to the next sub-page"), G_CALLBACK (_action_navigation_activate) }, - { "Homepage", STOCK_HOMEPAGE, - NULL, "Home", + { "Homepage", GTK_STOCK_HOME, + N_("_Homepage"), "Home", N_("Go to your homepage"), G_CALLBACK (_action_navigation_activate) }, { "TrashEmpty", GTK_STOCK_CLEAR, N_("Empty Trash"), "", @@ -5967,7 +5967,7 @@ midori_browser_realize_cb (GtkStyle* style, if (gtk_icon_theme_has_icon (icon_theme, "midori")) gtk_window_set_icon_name (GTK_WINDOW (browser), "midori"); else - gtk_window_set_icon_name (GTK_WINDOW (browser), "web-browser"); + gtk_window_set_icon_name (GTK_WINDOW (browser), STOCK_WEB_BROWSER); } } @@ -6192,7 +6192,7 @@ midori_browser_init (MidoriBrowser* browser) g_signal_connect (browser, "destroy", G_CALLBACK (midori_browser_destroy_cb), NULL); gtk_window_set_role (GTK_WINDOW (browser), "browser"); - gtk_window_set_icon_name (GTK_WINDOW (browser), "web-browser"); + gtk_window_set_icon_name (GTK_WINDOW (browser), STOCK_WEB_BROWSER); #if GTK_CHECK_VERSION (3, 4, 0) gtk_window_set_hide_titlebar_when_maximized (GTK_WINDOW (browser), TRUE); #endif diff --git a/midori/midori-stock.h b/midori/midori-stock.h index 7fe9f127..bd7287b2 100644 --- a/midori/midori-stock.h +++ b/midori/midori-stock.h @@ -12,42 +12,23 @@ #ifndef __MIDORI_STOCK_H__ #define __MIDORI_STOCK_H__ 1 -/* Custom stock items +/* Stock items */ - We should distribute these - Names should match with epiphany and/ or xdg spec */ - -#define STOCK_BOOKMARK "stock_bookmark" #define STOCK_BOOKMARKS "user-bookmarks" -#define STOCK_CONSOLE "terminal" #define STOCK_EXTENSION "extension" -#define STOCK_EXTENSIONS "extension" #define STOCK_HISTORY "document-open-recent" #define STOCK_WEB_BROWSER "web-browser" #define STOCK_NEWS_FEED "news-feed" -#define STOCK_STYLE "gnome-settings-theme" +#define STOCK_STYLE "preferences-desktop-theme" #define STOCK_TRANSFER "package" -#define STOCK_TRANSFERS "package" -#define STOCK_PLUGINS "gnome-mime-application-x-shockwave-flash" - +#define STOCK_PLUGINS "application-x-shockwave-flash" #define STOCK_BOOKMARK_ADD "bookmark-new" -#define STOCK_HOMEPAGE "go-home" -#define STOCK_IMAGE "gnome-mime-image" +#define STOCK_IMAGE "image-x-generic" #define STOCK_NETWORK_OFFLINE "network-offline" -#define STOCK_SCRIPT "stock_script" -#define STOCK_SCRIPTS "gnome-settings-theme" -#define STOCK_SEND "stock_mail-send" -#define STOCK_TAB_NEW "stock_new-tab" -#define STOCK_USER_TRASH "gnome-stock-trash" -#define STOCK_WINDOW_NEW "stock_new-window" - -#if defined (HAVE_HILDON) && HAVE_HILDON - #undef STOCK_BOOKMARKS - #define STOCK_BOOKMARKS "general_mybookmarks_folder" - #undef STOCK_NEWS_FEED - #define STOCK_NEWS_FEED "general_rss" - #undef STOCK_WEB_BROWSER - #define STOCK_WEB_BROWSER "general_web" -#endif +#define STOCK_SCRIPT "text-x-javascript" +#define STOCK_SEND "mail-send" +#define STOCK_TAB_NEW "tab-new" +#define STOCK_USER_TRASH "user-trash" +#define STOCK_WINDOW_NEW "window-new" #endif /* !__MIDORI_STOCK_H__ */ diff --git a/panels/midori-extensions.c b/panels/midori-extensions.c index c3e7182a..8121fbc0 100644 --- a/panels/midori-extensions.c +++ b/panels/midori-extensions.c @@ -93,7 +93,7 @@ midori_extensions_get_label (MidoriViewable* viewable) static const gchar* midori_extensions_get_stock_id (MidoriViewable* viewable) { - return STOCK_EXTENSIONS; + return STOCK_EXTENSION; } static GtkWidget* diff --git a/panels/midori-transfers.c b/panels/midori-transfers.c index 337e6ad9..1c90fe21 100644 --- a/panels/midori-transfers.c +++ b/panels/midori-transfers.c @@ -90,7 +90,7 @@ midori_transfers_get_label (MidoriViewable* viewable) static const gchar* midori_transfers_get_stock_id (MidoriViewable* viewable) { - return STOCK_TRANSFERS; + return STOCK_TRANSFER; } static void