X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;f=shell%2Fev-stock-icons.c;h=b0c9fd8fd0eadd9a839fafc39576d059c6761c87;hb=a24ba773afb595b2be95a01702816aa66f50ac54;hp=a9f533caeeb30c377541a5f844a8a2de4bf09223;hpb=6e530c3c7a48620af6e24c1a41963930c5c868cb;p=evince.git diff --git a/shell/ev-stock-icons.c b/shell/ev-stock-icons.c index a9f533ca..b0c9fd8f 100644 --- a/shell/ev-stock-icons.c +++ b/shell/ev-stock-icons.c @@ -29,51 +29,46 @@ #include #include -/* Toolbar icons files */ -#define STOCK_ZOOM_FIT_WIDTH_FILE "ev-stock-zoom-fit-width.png" +typedef struct { + char *stock_id; + char *icon; +} EvStockIcon; + +/* Evince stock icons from gnome-icon-theme */ +static const EvStockIcon stock_icons [] = { + { EV_STOCK_ZOOM_PAGE, "stock_zoom-page" }, + { EV_STOCK_ZOOM_WIDTH, "stock_zoom-page-width" }, + { EV_STOCK_LEAVE_FULLSCREEN, "stock_leave-fullscreen" }, + { EV_STOCK_VIEW_DUAL, "stock_preview-two-pages" }, + { EV_STOCK_VIEW_CONTINUOUS, "stock_new-master-document" } +}; -#define EV_ADD_STOCK_ICON(id, file, def_id) \ -{ \ - GdkPixbuf *pixbuf; \ - GtkIconSet *icon_set = NULL; \ - pixbuf = gdk_pixbuf_new_from_file (GNOMEICONDIR "/evince/" file, NULL); \ - if (pixbuf) { \ - icon_set = gtk_icon_set_new_from_pixbuf (pixbuf); \ - } else if (def_id) { \ - icon_set = gtk_icon_factory_lookup_default (def_id); \ - gtk_icon_set_ref (icon_set); \ - } \ - gtk_icon_factory_add (factory, id, icon_set); \ - gtk_icon_set_unref (icon_set); \ -} void ev_stock_icons_init (void) { - static const char *icon_theme_items[] = { - EV_STOCK_LEAVE_FULLSCREEN - }; - GtkIconFactory *factory; - guint i; + GtkIconFactory *factory; + GtkIconSource *source; + gint i; factory = gtk_icon_factory_new (); gtk_icon_factory_add_default (factory); - /* fitwidth stock icon */ - EV_ADD_STOCK_ICON (EV_STOCK_ZOOM_FIT_WIDTH, STOCK_ZOOM_FIT_WIDTH_FILE, GTK_STOCK_ZOOM_FIT); + source = gtk_icon_source_new (); + + for (i = 0; i < G_N_ELEMENTS (stock_icons); i++) { + GtkIconSet *set; - for (i = 0; i < G_N_ELEMENTS (icon_theme_items); i++) { - GtkIconSet *icon_set; - GtkIconSource *icon_source; + gtk_icon_source_set_icon_name (source, stock_icons [i].icon); - icon_set = gtk_icon_set_new (); - icon_source = gtk_icon_source_new (); - gtk_icon_source_set_icon_name (icon_source, icon_theme_items[i]); - gtk_icon_set_add_source (icon_set, icon_source); - gtk_icon_factory_add (factory, icon_theme_items[i], icon_set); - gtk_icon_set_unref (icon_set); - gtk_icon_source_free (icon_source); + set = gtk_icon_set_new (); + gtk_icon_set_add_source (set, source); + + gtk_icon_factory_add (factory, stock_icons [i].stock_id, set); + gtk_icon_set_unref (set); } + gtk_icon_source_free (source); + g_object_unref (G_OBJECT (factory)); }