Drop compatibility layer for legacy icon names

Fixes: https://bugs.launchpad.net/midori/+bug/988231
This commit is contained in:
Christian Dywan 2012-07-11 18:04:59 +02:00
parent 33cede91a7
commit c236e4da9e
7 changed files with 33 additions and 121 deletions

View file

@ -160,7 +160,7 @@ statusbar_features_property_proxy (MidoriWebSettings* settings,
if (!strcmp (property, "enable-scripts")) if (!strcmp (property, "enable-scripts"))
{ {
g_object_set_data (G_OBJECT (button), "feature-label", _("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_button_set_image (GTK_BUTTON (button), image);
gtk_widget_set_tooltip_text (button, _("Enable scripts")); gtk_widget_set_tooltip_text (button, _("Enable scripts"));
statusbar_features_toolbar_notify_toolbar_style_cb (toolbar, NULL, button); statusbar_features_toolbar_notify_toolbar_style_cb (toolbar, NULL, button);

View file

@ -678,7 +678,7 @@ midori_browser_show_preferences_cb (MidoriBrowser* browser,
gtk_widget_reparent (g_list_nth_data (children, 0), scrolled); gtk_widget_reparent (g_list_nth_data (children, 0), scrolled);
g_list_free (children); g_list_free (children);
page = katze_preferences_add_category (preferences, page = katze_preferences_add_category (preferences,
_("Extensions"), STOCK_EXTENSIONS); _("Extensions"), STOCK_EXTENSION);
gtk_box_pack_start (GTK_BOX (page), scrolled, TRUE, TRUE, 4); gtk_box_pack_start (GTK_BOX (page), scrolled, TRUE, TRUE, 4);
} }

View file

@ -1405,38 +1405,24 @@ midori_app_setup (gchar** argument_vector)
gsize i; gsize i;
gchar* executable; gchar* executable;
typedef struct static GtkStockItem items[] =
{ {
const gchar* stock_id; { STOCK_IMAGE },
const gchar* label; { STOCK_WEB_BROWSER },
GdkModifierType modifier; { STOCK_NEWS_FEED },
guint keyval; { STOCK_STYLE },
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_BOOKMARK, N_("_Bookmark"), 0, 0, GTK_STOCK_FILE }, { STOCK_BOOKMARKS, N_("_Bookmarks"), GDK_CONTROL_MASK | GDK_SHIFT_MASK, GDK_KEY_B },
{ STOCK_BOOKMARKS, N_("_Bookmarks"), GDK_CONTROL_MASK | GDK_SHIFT_MASK, GDK_KEY_B, GTK_STOCK_DIRECTORY }, { STOCK_BOOKMARK_ADD, N_("Add Boo_kmark") },
{ STOCK_BOOKMARK_ADD, N_("Add Boo_kmark"), 0, 0, "stock_add-bookmark" }, { STOCK_EXTENSION, N_("_Extensions") },
{ STOCK_CONSOLE, N_("_Console"), 0, 0, GTK_STOCK_DIALOG_WARNING }, { STOCK_HISTORY, N_("_History"), GDK_CONTROL_MASK | GDK_SHIFT_MASK, GDK_KEY_H },
{ STOCK_EXTENSIONS, N_("_Extensions"), 0, 0, GTK_STOCK_CONVERT }, { STOCK_SCRIPT, N_("_Userscripts") },
{ STOCK_HISTORY, N_("_History"), GDK_CONTROL_MASK | GDK_SHIFT_MASK, GDK_KEY_H, GTK_STOCK_SORT_ASCENDING }, { STOCK_STYLE, N_("User_styles") },
{ STOCK_HOMEPAGE, N_("_Homepage"), 0, 0, GTK_STOCK_HOME }, { STOCK_TAB_NEW, N_("New _Tab") },
{ STOCK_SCRIPTS, N_("_Userscripts"), 0, 0, GTK_STOCK_EXECUTE }, { STOCK_TRANSFER, N_("_Transfers"), GDK_CONTROL_MASK | GDK_SHIFT_MASK, GDK_KEY_J },
{ STOCK_TAB_NEW, N_("New _Tab"), 0, 0, GTK_STOCK_ADD }, { STOCK_PLUGINS, N_("Netscape p_lugins") },
{ STOCK_TRANSFERS, N_("_Transfers"), GDK_CONTROL_MASK | GDK_SHIFT_MASK, GDK_KEY_J, GTK_STOCK_SAVE }, { STOCK_USER_TRASH, N_("_Closed Tabs") },
{ STOCK_PLUGINS, N_("Netscape p_lugins"), 0, 0, GTK_STOCK_CONVERT }, { STOCK_WINDOW_NEW, N_("New _Window") },
{ 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 },
}; };
/* libSoup uses threads, therefore if WebKit is built with libSoup /* 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_set = gtk_icon_set_new ();
icon_source = gtk_icon_source_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_source_set_icon_name (icon_source, items[i].stock_id);
gtk_icon_set_add_source (icon_set, icon_source); gtk_icon_set_add_source (icon_set, icon_source);
gtk_icon_source_free (icon_source); gtk_icon_source_free (icon_source);
@ -1485,55 +1465,6 @@ midori_app_setup (gchar** argument_vector)
gtk_icon_factory_add_default (factory); gtk_icon_factory_add_default (factory);
g_object_unref (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 */ /* Preserve argument vector */
command_line = g_strdupv (argument_vector); command_line = g_strdupv (argument_vector);
#ifdef G_OS_WIN32 #ifdef G_OS_WIN32

View file

@ -5595,8 +5595,8 @@ static const GtkActionEntry entries[] =
NULL, "<Alt><Shift>Right", NULL, "<Alt><Shift>Right",
/* i18n: Visit the following logical page, ie. in a forum or blog */ /* i18n: Visit the following logical page, ie. in a forum or blog */
N_("Go to the next sub-page"), G_CALLBACK (_action_navigation_activate) }, N_("Go to the next sub-page"), G_CALLBACK (_action_navigation_activate) },
{ "Homepage", STOCK_HOMEPAGE, { "Homepage", GTK_STOCK_HOME,
NULL, "<Alt>Home", N_("_Homepage"), "<Alt>Home",
N_("Go to your homepage"), G_CALLBACK (_action_navigation_activate) }, N_("Go to your homepage"), G_CALLBACK (_action_navigation_activate) },
{ "TrashEmpty", GTK_STOCK_CLEAR, { "TrashEmpty", GTK_STOCK_CLEAR,
N_("Empty Trash"), "", N_("Empty Trash"), "",
@ -5967,7 +5967,7 @@ midori_browser_realize_cb (GtkStyle* style,
if (gtk_icon_theme_has_icon (icon_theme, "midori")) if (gtk_icon_theme_has_icon (icon_theme, "midori"))
gtk_window_set_icon_name (GTK_WINDOW (browser), "midori"); gtk_window_set_icon_name (GTK_WINDOW (browser), "midori");
else 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_signal_connect (browser, "destroy",
G_CALLBACK (midori_browser_destroy_cb), NULL); G_CALLBACK (midori_browser_destroy_cb), NULL);
gtk_window_set_role (GTK_WINDOW (browser), "browser"); 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) #if GTK_CHECK_VERSION (3, 4, 0)
gtk_window_set_hide_titlebar_when_maximized (GTK_WINDOW (browser), TRUE); gtk_window_set_hide_titlebar_when_maximized (GTK_WINDOW (browser), TRUE);
#endif #endif

View file

@ -12,42 +12,23 @@
#ifndef __MIDORI_STOCK_H__ #ifndef __MIDORI_STOCK_H__
#define __MIDORI_STOCK_H__ 1 #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_BOOKMARKS "user-bookmarks"
#define STOCK_CONSOLE "terminal"
#define STOCK_EXTENSION "extension" #define STOCK_EXTENSION "extension"
#define STOCK_EXTENSIONS "extension"
#define STOCK_HISTORY "document-open-recent" #define STOCK_HISTORY "document-open-recent"
#define STOCK_WEB_BROWSER "web-browser" #define STOCK_WEB_BROWSER "web-browser"
#define STOCK_NEWS_FEED "news-feed" #define STOCK_NEWS_FEED "news-feed"
#define STOCK_STYLE "gnome-settings-theme" #define STOCK_STYLE "preferences-desktop-theme"
#define STOCK_TRANSFER "package" #define STOCK_TRANSFER "package"
#define STOCK_TRANSFERS "package" #define STOCK_PLUGINS "application-x-shockwave-flash"
#define STOCK_PLUGINS "gnome-mime-application-x-shockwave-flash"
#define STOCK_BOOKMARK_ADD "bookmark-new" #define STOCK_BOOKMARK_ADD "bookmark-new"
#define STOCK_HOMEPAGE "go-home" #define STOCK_IMAGE "image-x-generic"
#define STOCK_IMAGE "gnome-mime-image"
#define STOCK_NETWORK_OFFLINE "network-offline" #define STOCK_NETWORK_OFFLINE "network-offline"
#define STOCK_SCRIPT "stock_script" #define STOCK_SCRIPT "text-x-javascript"
#define STOCK_SCRIPTS "gnome-settings-theme" #define STOCK_SEND "mail-send"
#define STOCK_SEND "stock_mail-send" #define STOCK_TAB_NEW "tab-new"
#define STOCK_TAB_NEW "stock_new-tab" #define STOCK_USER_TRASH "user-trash"
#define STOCK_USER_TRASH "gnome-stock-trash" #define STOCK_WINDOW_NEW "window-new"
#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
#endif /* !__MIDORI_STOCK_H__ */ #endif /* !__MIDORI_STOCK_H__ */

View file

@ -93,7 +93,7 @@ midori_extensions_get_label (MidoriViewable* viewable)
static const gchar* static const gchar*
midori_extensions_get_stock_id (MidoriViewable* viewable) midori_extensions_get_stock_id (MidoriViewable* viewable)
{ {
return STOCK_EXTENSIONS; return STOCK_EXTENSION;
} }
static GtkWidget* static GtkWidget*

View file

@ -90,7 +90,7 @@ midori_transfers_get_label (MidoriViewable* viewable)
static const gchar* static const gchar*
midori_transfers_get_stock_id (MidoriViewable* viewable) midori_transfers_get_stock_id (MidoriViewable* viewable)
{ {
return STOCK_TRANSFERS; return STOCK_TRANSFER;
} }
static void static void