]> www.fi.muni.cz Git - evince.git/commitdiff
Move stock icons from libmisc to libview and make the API public
authorCarlos Garcia Campos <carlosgc@gnome.org>
Tue, 12 May 2009 09:28:53 +0000 (11:28 +0200)
committerCarlos Garcia Campos <carlosgc@gnome.org>
Tue, 12 May 2009 09:28:53 +0000 (11:28 +0200)
evince-view.h
libmisc/Makefile.am
libview/Makefile.am
libview/ev-stock-icons.c [moved from libmisc/ev-stock-icons.c with 93% similarity]
libview/ev-stock-icons.h [moved from libmisc/ev-stock-icons.h with 78% similarity]
previewer/ev-previewer-window.c
previewer/ev-previewer.c
shell/ev-application.c

index 74e78a8d70be765a581707d7e5e73445e58acd3f..ed88853f6101a4bd8d82aeed31b1ed2fdd271c08 100644 (file)
@@ -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__
 
index 900e40176786deb00d1f0369a7155386e7e62ca2..481caeacf247787da6ad3c5f9139af4e968d9644 100644 (file)
@@ -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)\"     \
index edfacef68087fbe7ca2a34de46216637be8afbb8..d59de192156ad701c024ebc7c9460c122569450b 100644 (file)
@@ -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                    \
similarity index 93%
rename from libmisc/ev-stock-icons.c
rename to libview/ev-stock-icons.c
index 8b121e909b01225f4198d0903417149df500b3a8..09aa89ea95516e1ea5683fc20d371949b2302ffb 100644 (file)
@@ -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
similarity index 78%
rename from libmisc/ev-stock-icons.h
rename to libview/ev-stock-icons.h
index 793314db95752284c5fc0d46ffef8feb70a1c124..c49dc174b23aa15c8cfb5df96019b2c29d18b849 100644 (file)
  * 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
 
index cbddbd83f235c57a8c3046ffe6ec4ef59d63a869..8da587184402e177db66dc2148296db6e11cf887 100644 (file)
@@ -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"
index a425037cad3dd612d9a13f365447bd2e4ea6f2f0..afe21271a4715148e160f65fa18b8199d6d573a5 100644 (file)
@@ -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"
 
index 56824e8e611cfa0132c2bf78646a15f4bbfecfa6..83cbcf5c6327af837ef2503de7a905b645be1cb6 100644 (file)
@@ -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);
        }