X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;ds=sidebyside;f=shell%2Fev-stock-icons.c;h=801db9a85734d7d2f42c0ae99ac97d0422506147;hb=c8e5475fea2b7a92f935e4ae69994fdaf95da2bd;hp=17793f37e3a9fb87aaded5b5c6024550bace3fb3;hpb=e90ec741051727680a653837fb7b401192c507f7;p=evince.git diff --git a/shell/ev-stock-icons.c b/shell/ev-stock-icons.c index 17793f37..801db9a8 100644 --- a/shell/ev-stock-icons.c +++ b/shell/ev-stock-icons.c @@ -21,42 +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" - -#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); \ -} +typedef struct { + char *stock_id; + char *icon; +} EvStockIcon; + +/* 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) { - GtkIconFactory *factory; + 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; + + 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)); }