]> www.fi.muni.cz Git - evince.git/blob - shell/ev-stock-icons.c
17793f37e3a9fb87aaded5b5c6024550bace3fb3
[evince.git] / shell / ev-stock-icons.c
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /* Stock icons for Evince
3  *
4  * Copyright (C) 2003 Martin Kretzschmar
5  *
6  * Author:
7  *   Martin Kretzschmar <Martin.Kretzschmar@inf.tu-dresden.de>
8  *
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.
13  *
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.
18  *
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.
22  */
23
24 #include <config.h>
25
26 #include "ev-stock-icons.h"
27
28 #include <gtk/gtkiconfactory.h>
29 #include <gtk/gtkstock.h>
30 #include <gdk/gdkpixbuf.h>
31
32 /* Toolbar icons files */
33 #define STOCK_ZOOM_FIT_WIDTH_FILE "ev-stock-zoom-fit-width.png"
34
35 #define EV_ADD_STOCK_ICON(id, file, def_id)                                     \
36 {                                                                               \
37         GdkPixbuf *pixbuf;                                                      \
38         GtkIconSet *icon_set = NULL;                                            \
39         pixbuf = gdk_pixbuf_new_from_file (GNOMEICONDIR "/evince/" file, NULL); \
40         if (pixbuf) {                                                           \
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);                                    \
45         }                                                                       \
46         gtk_icon_factory_add (factory, id, icon_set);                           \
47         gtk_icon_set_unref (icon_set);                                          \
48 }
49
50 void
51 ev_stock_icons_init (void)
52 {
53         GtkIconFactory *factory;
54
55         factory = gtk_icon_factory_new ();
56         gtk_icon_factory_add_default (factory);
57
58         /* fitwidth stock icon */
59         EV_ADD_STOCK_ICON (EV_STOCK_ZOOM_FIT_WIDTH, STOCK_ZOOM_FIT_WIDTH_FILE, GTK_STOCK_ZOOM_FIT);
60         
61         g_object_unref (G_OBJECT (factory));
62 }