X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;ds=inline;f=shell%2Fev-stock-icons.c;h=801db9a85734d7d2f42c0ae99ac97d0422506147;hb=61b14b7612531f6e67cc9783a104f7e7f761295d;hp=a9f533caeeb30c377541a5f844a8a2de4bf09223;hpb=6e530c3c7a48620af6e24c1a41963930c5c868cb;p=evince.git diff --git a/shell/ev-stock-icons.c b/shell/ev-stock-icons.c index a9f533ca..801db9a8 100644 --- a/shell/ev-stock-icons.c +++ b/shell/ev-stock-icons.c @@ -21,59 +21,59 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ -#include - #include "ev-stock-icons.h" #include #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; -#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); \ -} +/* Evince stock icons */ +static const EvStockIcon stock_icons [] = { + { EV_STOCK_ZOOM, "zoom" }, + { EV_STOCK_ZOOM_PAGE, "zoom-fit-page" }, + { EV_STOCK_ZOOM_WIDTH, "zoom-fit-width" }, + { EV_STOCK_VIEW_DUAL, "view-page-facing" }, + { EV_STOCK_VIEW_CONTINUOUS, "view-page-continuous" }, + { EV_STOCK_ROTATE_LEFT, "object-rotate-left"}, + { EV_STOCK_ROTATE_RIGHT, "object-rotate-right"}, + { EV_STOCK_RUN_PRESENTATION, "x-office-presentation"}, +}; +/** + * ev_stock_icons_init: + * + * Creates a new icon factory, adding the base stock icons to it. + */ 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 (icon_theme_items); i++) { - GtkIconSet *icon_set; - GtkIconSource *icon_source; + for (i = 0; i < G_N_ELEMENTS (stock_icons); i++) { + GtkIconSet *set; - 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); + gtk_icon_source_set_icon_name (source, stock_icons [i].icon); + + 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)); }