Commit bc8fd91e authored by Carlos Garcia Campos's avatar Carlos Garcia Campos

Move stock icons from libmisc to libview and make the API public

parent e6834c6a
......@@ -26,6 +26,7 @@
#include <libview/ev-page-cache.h>
#include <libview/ev-view.h>
#include <libview/ev-view-type-builtins.h>
#include <libview/ev-stock-icons.h>
#undef __EV_EVINCE_VIEW_H_INSIDE__
......
......@@ -4,9 +4,7 @@ libevmisc_la_SOURCES = \
ev-page-action.c \
ev-page-action.h \
ev-page-action-widget.c \
ev-page-action-widget.h \
ev-stock-icons.c \
ev-stock-icons.h
ev-page-action-widget.h
libevmisc_la_CFLAGS = \
-DDATADIR=\"$(pkgdatadir)\" \
......
......@@ -12,6 +12,7 @@ INST_H_FILES = \
ev-jobs.h \
ev-job-scheduler.h \
ev-page-cache.h \
ev-stock-icons.h \
ev-view.h \
ev-view-type-builtins.h
......@@ -23,6 +24,7 @@ libevview_la_SOURCES = \
ev-job-scheduler.c \
ev-page-cache.c \
ev-pixbuf-cache.c \
ev-stock-icons.c \
ev-timeline.c \
ev-transition-animation.c \
ev-view.c \
......@@ -33,6 +35,7 @@ libevview_la_SOURCES = \
$(INST_H_FILES)
libevview_la_CPPFLAGS = \
-DDATADIR=\"$(pkgdatadir)\" \
-DG_LOG_DOMAIN=\"EvinceView\" \
-DGNOMELOCALEDIR=\"$(datadir)/locale\" \
-DEVINCE_COMPILATION \
......
......@@ -24,7 +24,6 @@
#include <config.h>
#include <gtk/gtk.h>
#include <gdk/gdk.h>
#include "ev-stock-icons.h"
......@@ -48,6 +47,36 @@ static const EvStockIcon stock_icons [] = {
static gchar *ev_icons_path;
static void
ev_stock_icons_add_icons_path_for_screen (GdkScreen *screen)
{
GtkIconTheme *icon_theme;
g_return_if_fail (ev_icons_path != NULL);
icon_theme = screen ? gtk_icon_theme_get_for_screen (screen) : gtk_icon_theme_get_default ();
if (icon_theme) {
gchar **path = NULL;
gint n_paths;
gint i;
/* GtkIconTheme will then look in Evince custom hicolor dir
* for icons as well as the standard search paths
*/
gtk_icon_theme_get_search_path (icon_theme, &path, &n_paths);
for (i = n_paths - 1; i >= 0; i--) {
if (g_ascii_strcasecmp (ev_icons_path, path[i]) == 0)
break;
}
if (i < 0)
gtk_icon_theme_append_search_path (icon_theme,
ev_icons_path);
g_strfreev (path);
}
}
/**
* ev_stock_icons_init:
*
......@@ -83,43 +112,21 @@ ev_stock_icons_init (void)
g_object_unref (G_OBJECT (factory));
ev_stock_icons_add_icons_path ();
ev_stock_icons_add_icons_path_for_screen (gdk_screen_get_default ());
}
void
ev_stock_icons_shutdown (void)
ev_stock_icons_set_screen (GdkScreen *screen)
{
g_free (ev_icons_path);
g_return_if_fail (GDK_IS_SCREEN (screen));
ev_stock_icons_add_icons_path_for_screen (screen);
}
void
ev_stock_icons_add_icons_path_for_screen (GdkScreen *screen)
ev_stock_icons_shutdown (void)
{
GtkIconTheme *icon_theme;
g_return_if_fail (ev_icons_path != NULL);
icon_theme = screen ? gtk_icon_theme_get_for_screen (screen) : gtk_icon_theme_get_default ();
if (icon_theme) {
gchar **path = NULL;
gint n_paths;
gint i;
/* GtkIconTheme will then look in Evince custom hicolor dir
* for icons as well as the standard search paths
*/
gtk_icon_theme_get_search_path (icon_theme, &path, &n_paths);
for (i = n_paths - 1; i >= 0; i--) {
if (g_ascii_strcasecmp (ev_icons_path, path[i]) == 0)
break;
}
if (i < 0)
gtk_icon_theme_append_search_path (icon_theme,
ev_icons_path);
g_strfreev (path);
}
g_free (ev_icons_path);
}
void
......
......@@ -21,17 +21,21 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*/
#if !defined (__EV_EVINCE_VIEW_H_INSIDE__) && !defined (EVINCE_COMPILATION)
#error "Only <evince-view.h> can be included directly."
#endif
#ifndef __EV_STOCK_ICONS_H__
#define __EV_STOCK_ICONS_H__
#include <glib.h>
#include <gdk/gdk.h>
G_BEGIN_DECLS
/* Evince stock icons */
#define EV_STOCK_ZOOM "zoom"
#define EV_STOCK_ZOOM_PAGE "zoom-fit-page"
#define EV_STOCK_ZOOM_WIDTH "zoom-fit-width"
#define EV_STOCK_ZOOM_PAGE "zoom-fit-page"
#define EV_STOCK_ZOOM_WIDTH "zoom-fit-width"
#define EV_STOCK_VIEW_DUAL "view-page-facing"
#define EV_STOCK_VIEW_CONTINUOUS "view-page-continuous"
#define EV_STOCK_ROTATE_LEFT "object-rotate-left"
......@@ -39,10 +43,9 @@ G_BEGIN_DECLS
#define EV_STOCK_RUN_PRESENTATION "x-office-presentation"
#define EV_STOCK_VISIBLE "eye"
void ev_stock_icons_init (void);
void ev_stock_icons_shutdown (void);
void ev_stock_icons_add_icons_path (void);
void ev_stock_icons_add_icons_path_for_screen (GdkScreen *screen);
void ev_stock_icons_init (void);
void ev_stock_icons_shutdown (void);
void ev_stock_icons_set_screen (GdkScreen *screen);
G_END_DECLS
......
......@@ -23,7 +23,6 @@
#include <gtk/gtkunixprint.h>
#include <glib/gi18n.h>
#include <evince-view.h>
#include "ev-stock-icons.h"
#include "ev-page-action.h"
#include "ev-previewer-window.h"
......
......@@ -24,7 +24,6 @@
#include <glib/gi18n.h>
#include <evince-document.h>
#include <evince-view.h>
#include "ev-stock-icons.h"
#include "ev-previewer-window.h"
......
......@@ -412,7 +412,7 @@ ev_application_open_window (EvApplication *application,
}
if (screen) {
ev_stock_icons_add_icons_path_for_screen (screen);
ev_stock_icons_set_screen (screen);
gtk_window_set_screen (GTK_WINDOW (new_window), screen);
}
......@@ -536,7 +536,7 @@ ev_application_open_uri_at_dest (EvApplication *application,
}
if (screen) {
ev_stock_icons_add_icons_path_for_screen (screen);
ev_stock_icons_set_screen (screen);
gtk_window_set_screen (GTK_WINDOW (new_window), screen);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment