1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /* Stock icons for Evince
4 * Copyright (C) 2003 Martin Kretzschmar
7 * Martin Kretzschmar <Martin.Kretzschmar@inf.tu-dresden.de>
9 * GPdf is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * GPdf is distributed in the hope that it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
17 * License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
26 #include "ev-stock-icons.h"
28 #include <gtk/gtkiconfactory.h>
29 #include <gtk/gtkstock.h>
30 #include <gdk/gdkpixbuf.h>
32 /* Toolbar icons files */
33 #define STOCK_ZOOM_FIT_WIDTH_FILE "ev-stock-zoom-fit-width.png"
35 #define EV_ADD_STOCK_ICON(id, file, def_id) \
38 GtkIconSet *icon_set = NULL; \
39 pixbuf = gdk_pixbuf_new_from_file (GNOMEICONDIR "/evince/" file, NULL); \
41 icon_set = gtk_icon_set_new_from_pixbuf (pixbuf); \
42 } else if (def_id) { \
43 icon_set = gtk_icon_factory_lookup_default (def_id); \
44 gtk_icon_set_ref (icon_set); \
46 gtk_icon_factory_add (factory, id, icon_set); \
47 gtk_icon_set_unref (icon_set); \
51 ev_stock_icons_init (void)
53 static const char *icon_theme_items[] = {
54 EV_STOCK_LEAVE_FULLSCREEN
56 GtkIconFactory *factory;
59 factory = gtk_icon_factory_new ();
60 gtk_icon_factory_add_default (factory);
62 /* fitwidth stock icon */
63 EV_ADD_STOCK_ICON (EV_STOCK_ZOOM_FIT_WIDTH, STOCK_ZOOM_FIT_WIDTH_FILE, GTK_STOCK_ZOOM_FIT);
65 for (i = 0; i < G_N_ELEMENTS (icon_theme_items); i++) {
67 GtkIconSource *icon_source;
69 icon_set = gtk_icon_set_new ();
70 icon_source = gtk_icon_source_new ();
71 gtk_icon_source_set_icon_name (icon_source, icon_theme_items[i]);
72 gtk_icon_set_add_source (icon_set, icon_source);
73 gtk_icon_factory_add (factory, icon_theme_items[i], icon_set);
74 gtk_icon_set_unref (icon_set);
75 gtk_icon_source_free (icon_source);
78 g_object_unref (G_OBJECT (factory));