From: Christian Dywan Date: Sun, 25 Oct 2009 23:18:56 +0000 (+0100) Subject: Map Maemo icons to stock icons X-Git-Url: https://spindle.queued.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=66079c987b5373a43bce7241451820e477e56e47;p=midori Map Maemo icons to stock icons --- diff --git a/midori/midori-stock.h b/midori/midori-stock.h index 5e5f86aa..a2e0f028 100644 --- a/midori/midori-stock.h +++ b/midori/midori-stock.h @@ -43,4 +43,11 @@ #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" +#endif + #endif /* !__MIDORI_STOCK_H__ */ diff --git a/midori/sokoke.c b/midori/sokoke.c index 0a1268d9..4f6f2cd4 100644 --- a/midori/sokoke.c +++ b/midori/sokoke.c @@ -11,14 +11,14 @@ */ #include "sokoke.h" -#include "midori-stock.h" - -#include "compat.h" #if HAVE_CONFIG_H #include #endif +#include "compat.h" +#include "midori-stock.h" + #if HAVE_UNISTD_H #include #endif @@ -916,6 +916,11 @@ sokoke_time_t_to_julian (const time_t* timestamp) void sokoke_register_stock_items (void) { + GtkIconSource* icon_source; + GtkIconSet* icon_set; + GtkIconFactory* factory; + gsize i; + typedef struct { const gchar* stock_id; @@ -924,11 +929,6 @@ sokoke_register_stock_items (void) guint keyval; const gchar* fallback; } FatStockItem; - GtkIconSource* icon_source; - GtkIconSet* icon_set; - GtkIconFactory* factory = gtk_icon_factory_new (); - gsize i; - static FatStockItem items[] = { { STOCK_EXTENSION, NULL, 0, 0, GTK_STOCK_CONVERT }, @@ -954,6 +954,7 @@ sokoke_register_stock_items (void) { STOCK_WINDOW_NEW, N_("New _Window"), 0, 0, GTK_STOCK_ADD }, }; + factory = gtk_icon_factory_new (); for (i = 0; i < G_N_ELEMENTS (items); i++) { icon_set = gtk_icon_set_new (); @@ -973,6 +974,53 @@ sokoke_register_stock_items (void) gtk_stock_add ((GtkStockItem*)items, G_N_ELEMENTS (items)); 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_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_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 } /**