Evince
Evince is a document viewer capable of displaying multiple and single page document formats like PDF and Postscript.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ev-stock-icons.c File Reference
#include <config.h>
#include <gtk/gtk.h>
#include "ev-stock-icons.h"
+ Include dependency graph for ev-stock-icons.c:

Go to the source code of this file.

Data Structures

struct  EvStockIcon
 

Functions

static void ev_stock_icons_add_icons_path_for_screen (GdkScreen *screen)
 
void ev_stock_icons_init (void)
 
void ev_stock_icons_set_screen (GdkScreen *screen)
 
void ev_stock_icons_shutdown (void)
 

Variables

static const EvStockIcon stock_icons []
 
static gchar * ev_icons_path
 

Function Documentation

static void ev_stock_icons_add_icons_path_for_screen ( GdkScreen *  screen)
static

Definition at line 57 of file ev-stock-icons.c.

58 {
59  GtkIconTheme *icon_theme;
60 
61  g_return_if_fail (ev_icons_path != NULL);
62 
63  icon_theme = screen ? gtk_icon_theme_get_for_screen (screen) : gtk_icon_theme_get_default ();
64  if (icon_theme) {
65  gchar **path = NULL;
66  gint n_paths;
67  gint i;
68 
69  /* GtkIconTheme will then look in Evince custom hicolor dir
70  * for icons as well as the standard search paths
71  */
72  gtk_icon_theme_get_search_path (icon_theme, &path, &n_paths);
73  for (i = n_paths - 1; i >= 0; i--) {
74  if (g_ascii_strcasecmp (ev_icons_path, path[i]) == 0)
75  break;
76  }
77 
78  if (i < 0)
79  gtk_icon_theme_append_search_path (icon_theme,
81 
82  g_strfreev (path);
83  }
84 }

+ Here is the caller graph for this function:

void ev_stock_icons_init ( void  )

ev_stock_icons_init:

Creates a new icon factory, adding the base stock icons to it.

Definition at line 92 of file ev-stock-icons.c.

93 {
94  GtkIconFactory *factory;
95  GtkIconSource *source;
96  gint i;
97 #ifdef G_OS_WIN32
98  gchar *dir;
99 
100  dir = g_win32_get_package_installation_directory_of_module (NULL);
101  ev_icons_path = g_build_filename (dir, "share", "evince", "icons", NULL);
102  g_free (dir);
103 #else
104  ev_icons_path = g_build_filename (EVINCEDATADIR, "icons", NULL);
105 #endif
106 
107  factory = gtk_icon_factory_new ();
108  gtk_icon_factory_add_default (factory);
109 
110  source = gtk_icon_source_new ();
111 
112  for (i = 0; i < G_N_ELEMENTS (stock_icons); i++) {
113  GtkIconSet *set;
114 
115  gtk_icon_source_set_icon_name (source, stock_icons [i].icon);
116 
117  set = gtk_icon_set_new ();
118  gtk_icon_set_add_source (set, source);
119 
120  gtk_icon_factory_add (factory, stock_icons [i].stock_id, set);
121  gtk_icon_set_unref (set);
122  }
123 
124  gtk_icon_source_free (source);
125 
126  g_object_unref (G_OBJECT (factory));
127 
128  ev_stock_icons_add_icons_path_for_screen (gdk_screen_get_default ());
129 }

+ Here is the caller graph for this function:

void ev_stock_icons_set_screen ( GdkScreen *  screen)

Definition at line 132 of file ev-stock-icons.c.

133 {
134  g_return_if_fail (GDK_IS_SCREEN (screen));
135 
137 }

+ Here is the caller graph for this function:

void ev_stock_icons_shutdown ( void  )

Definition at line 140 of file ev-stock-icons.c.

141 {
142  g_free (ev_icons_path);
143 }

+ Here is the caller graph for this function:

Variable Documentation

gchar* ev_icons_path
static

Definition at line 54 of file ev-stock-icons.c.

const EvStockIcon stock_icons[]
static
Initial value:
= {
{ EV_STOCK_ZOOM, "zoom" },
{ EV_STOCK_ZOOM_PAGE, "zoom-fit-height" },
{ 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_VISIBLE, "eye"},
{ EV_STOCK_RESIZE_SE, "resize-se"},
{ EV_STOCK_RESIZE_SW, "resize-sw"},
{ EV_STOCK_CLOSE, "close"},
{ EV_STOCK_INVERTED_COLORS, "stock_filters-invert"},
{ EV_STOCK_ATTACHMENT, "mail-attachment"},
{ EV_STOCK_SEND_TO, "document-send"},
}

Definition at line 36 of file ev-stock-icons.c.