]> www.fi.muni.cz Git - evince.git/commitdiff
Move EvPageAction and EvStockIcons from shell to a new internal library
authorCarlos Garcia Campos <carlosgc@gnome.org>
Wed, 8 Apr 2009 13:10:00 +0000 (13:10 +0000)
committerCarlos Garcia Campos <carlosgc@src.gnome.org>
Wed, 8 Apr 2009 13:10:00 +0000 (13:10 +0000)
2009-04-08  Carlos Garcia Campos  <carlosgc@gnome.org>

* configure.ac:
* Makefile.am:
* po/POTFILES.in:
* shell/Makefile.am:
* shell/ev-page-action-widget.[ch]:
* shell/ev-page-action.[ch]:
* shell/ev-stock-icons.[ch]:
* shell/ev-application.c:
* shell/main.c:
* libmisc/Makefile.am:
* libmisc/ev-page-action-widget.[ch]:
* libmisc/ev-page-action.[ch]:
* libmisc/ev-stock-icons.[ch]:

Move EvPageAction and EvStockIcons from shell to a new internal
library (libevmisc) that will be used by the evince previewer too.

svn path=/trunk/; revision=3577

14 files changed:
ChangeLog
Makefile.am
configure.ac
libmisc/Makefile.am [new file with mode: 0644]
libmisc/ev-page-action-widget.c [moved from shell/ev-page-action-widget.c with 98% similarity]
libmisc/ev-page-action-widget.h [moved from shell/ev-page-action-widget.h with 98% similarity]
libmisc/ev-page-action.c [moved from shell/ev-page-action.c with 99% similarity]
libmisc/ev-page-action.h [moved from shell/ev-page-action.h with 97% similarity]
libmisc/ev-stock-icons.c [moved from shell/ev-stock-icons.c with 64% similarity]
libmisc/ev-stock-icons.h [moved from shell/ev-stock-icons.h with 79% similarity]
po/POTFILES.in
shell/Makefile.am
shell/ev-application.c
shell/main.c

index 91a7e8c2ba863a0fbece984cec08cfe2fc6819c1..ab39147bec2804f693f6a6ece320308c55cdf6d6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,28 @@
+2009-04-08  Carlos Garcia Campos  <carlosgc@gnome.org>
+
+       * configure.ac:
+       * Makefile.am:
+       * po/POTFILES.in:
+       * shell/Makefile.am:
+       * shell/ev-page-action-widget.[ch]:
+       * shell/ev-page-action.[ch]:
+       * shell/ev-stock-icons.[ch]:
+       * shell/ev-application.c:
+       * shell/main.c:
+       * libmisc/Makefile.am:
+       * libmisc/ev-page-action-widget.[ch]:
+       * libmisc/ev-page-action.[ch]:
+       * libmisc/ev-stock-icons.[ch]:
+
+       Move EvPageAction and EvStockIcons from shell to a new internal
+       library (libevmisc) that will be used by the evince previewer too.
+       
 2009-04-08  Nickolay V. Shmyrev  <nshmyrev@yandex.ru>
 
        * backend/tiff/tiff2ps.c (tiff2ps_context_new):
        
        Fixes memory leak. Bug #578285.
-
+       
 2009-04-06  Carlos Garcia Campos  <carlosgc@gnome.org>
 
        * libview/ev-view.[ch]: (ev_view_set_zoom),
@@ -14,7 +33,7 @@
        Move ev_view_update_view_size() from libview to ev-window again
        and make sure the view is not redrawn when calling
        ev_view_set_zoom more than once with the same zoom scale.
-       
+
 2009-04-05  Nickolay V. Shmyrev  <nshmyrev@yandex.ru>
 
        * shell/ev-window.c:
index ff5bd824106a5de02c1c720c210270354f472d0b..8c125824c139da6539d824baeda759ff8fb057f8 100644 (file)
@@ -4,6 +4,7 @@ SUBDIRS = \
        libdocument \
        backend \
        libview \
+       libmisc \
        properties \
        shell \
        po \
index 0b6555ecc0f2993a90f147563a28cfa3edecb08c..cdfb2d6a8a8886fa6f5e9a3bec1602e3462ac2d0 100644 (file)
@@ -603,6 +603,7 @@ help/reference/shell/Makefile
 help/reference/shell/version.xml
 libdocument/Makefile
 libdocument/ev-version.h
+libmisc/Makefile
 libview/Makefile
 Makefile
 po/Makefile.in
diff --git a/libmisc/Makefile.am b/libmisc/Makefile.am
new file mode 100644 (file)
index 0000000..7f6ad9b
--- /dev/null
@@ -0,0 +1,15 @@
+noinst_LTLIBRARIES = libevmisc.la
+
+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
+
+libevmisc_la_CFLAGS =  \
+       -DDATADIR=\"$(pkgdatadir)\"     \
+       $(SHELL_CORE_CFLAGS)            \
+       $(WARNING_CFLAGS)               \
+       $(DISABLE_DEPRECATED)
\ No newline at end of file
similarity index 98%
rename from shell/ev-page-action-widget.c
rename to libmisc/ev-page-action-widget.c
index 7a6ad3b4d241dce5eb51c0a3b9e175f4474fe42d..28b6759bef352a5d6186a7673ba3ffc356fe341a 100644 (file)
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
 
-#include "ev-document-links.h"
-#include "ev-marshal.h"
+#include <evince-document.h>
 #include "ev-page-action.h"
 #include "ev-page-action-widget.h"
-#include "ev-page-cache.h"
-#include "ev-window.h"
 
 /* Widget we pass back */
 static void  ev_page_action_widget_init       (EvPageActionWidget      *action_widget);
similarity index 98%
rename from shell/ev-page-action-widget.h
rename to libmisc/ev-page-action-widget.h
index 32efd0047725822cf94645da6ad48dbb7a6974f4..5583d6a4f3dd3fe3b130e856d4d9f8a7eb96621a 100644 (file)
@@ -18,7 +18,7 @@
  *
  */
 
-#include "ev-page-cache.h"
+#include <evince-view.h>
  
 #include <gtk/gtk.h>
 
similarity index 99%
rename from shell/ev-page-action.c
rename to libmisc/ev-page-action.c
index cc3615abf091164041f99d7d59607e9f1bdda7f7..f2a1536974e3a4473c5bf82c3d6aeb24b0bb9da2 100644 (file)
 #include <gtk/gtk.h>
 
 #include "ev-page-action.h"
-#include "ev-page-cache.h"
-#include "ev-window.h"
-#include "ev-document-links.h"
 #include "ev-page-action-widget.h"
-#include "ev-marshal.h"
 
 struct _EvPageActionPrivate
 {
similarity index 97%
rename from shell/ev-page-action.h
rename to libmisc/ev-page-action.h
index 6337bdedc9aa9488ec493f160bc96030452d5a4c..dc13bdd02a82eafa6f2239d538739916442f593e 100644 (file)
@@ -23,8 +23,7 @@
 
 #include <gtk/gtk.h>
 
-#include <ev-document.h>
-#include "ev-link.h"
+#include <evince-document.h>
 
 G_BEGIN_DECLS
 
similarity index 64%
rename from shell/ev-stock-icons.c
rename to libmisc/ev-stock-icons.c
index e1049c973d5520ceb56bebbfc7fdae62bb528e50..8b121e909b01225f4198d0903417149df500b3a8 100644 (file)
@@ -6,12 +6,12 @@
  * Author:
  *   Martin Kretzschmar <Martin.Kretzschmar@inf.tu-dresden.de>
  *
- * GPdf is free software; you can redistribute it and/or modify it
+ * Evince is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
- * GPdf is distributed in the hope that it will be useful, but WITHOUT
+ * Evince is distributed in the hope that it will be useful, but WITHOUT
  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
  * License for more details.
@@ -46,6 +46,8 @@ static const EvStockIcon stock_icons [] = {
        { EV_STOCK_VISIBLE,          "eye"}
 };
 
+static gchar *ev_icons_path;
+
 /**
  * ev_stock_icons_init:
  *
@@ -58,6 +60,8 @@ ev_stock_icons_init (void)
        GtkIconSource *source;
        gint i;
 
+       ev_icons_path = g_build_filename (DATADIR, "icons", NULL);
+
         factory = gtk_icon_factory_new ();
         gtk_icon_factory_add_default (factory);
 
@@ -78,4 +82,48 @@ ev_stock_icons_init (void)
        gtk_icon_source_free (source);
 
        g_object_unref (G_OBJECT (factory));
+
+       ev_stock_icons_add_icons_path ();
+}
+
+void
+ev_stock_icons_shutdown (void)
+{
+       g_free (ev_icons_path);
+}
+
+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);
+       }
+}
+
+void
+ev_stock_icons_add_icons_path (void)
+{
+       ev_stock_icons_add_icons_path_for_screen (gdk_screen_get_default ());
 }
similarity index 79%
rename from shell/ev-stock-icons.h
rename to libmisc/ev-stock-icons.h
index 2e7f21b29a628d91717372067a1d6d892361c9f5..793314db95752284c5fc0d46ffef8feb70a1c124 100644 (file)
@@ -6,12 +6,12 @@
  * Author:
  *   Martin Kretzschmar <Martin.Kretzschmar@inf.tu-dresden.de>
  *
- * GPdf is free software; you can redistribute it and/or modify it
+ * Evince is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
- * GPdf is distributed in the hope that it will be useful, but WITHOUT
+ * Evince is distributed in the hope that it will be useful, but WITHOUT
  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
  * License for more details.
@@ -39,7 +39,10 @@ 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_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);
 
 G_END_DECLS
 
index 7df821267f7902c98a2a98826e5c6135eecf42ce..5be9bc662a6b7badfbaacda1644ec3a51fb7563c 100644 (file)
@@ -28,6 +28,8 @@ data/evince.desktop.in.in
 data/evince.schemas.in
 properties/ev-properties-main.c
 properties/ev-properties-view.c
+libmisc/ev-page-action.c
+libmisc/ev-page-action-widget.c
 libview/ev-jobs.c
 libview/ev-view-accessible.c
 libview/ev-view.c
@@ -38,8 +40,6 @@ shell/ev-keyring.c
 shell/ev-navigation-action.c
 shell/ev-navigation-action-widget.c
 shell/ev-open-recent-action.c
-shell/ev-page-action.c
-shell/ev-page-action-widget.c
 shell/ev-password-view.c
 shell/ev-print-operation.c
 shell/ev-properties-dialog.c
index 4230dbb80cdeae7b993fa670a4a2837035d67d73..65d3ffad8eb4fb420a04d0185ef4cfbaf75758e5 100644 (file)
@@ -14,6 +14,7 @@ INCLUDES=                                                     \
        -I$(top_builddir)/libdocument                           \
        -I$(top_srcdir)/libview                                 \
        -I$(top_builddir)/libview                               \
+       -I$(top_srcdir)/libmisc                                 \
        -I$(top_srcdir)/properties                              \
        -DGNOMELOCALEDIR=\"$(datadir)/locale\"                  \
        -DGNOMEICONDIR=\""$(datadir)/pixmaps"\"                 \
@@ -53,10 +54,6 @@ evince_SOURCES=                              \
        ev-navigation-action.h          \
        ev-navigation-action-widget.c   \
        ev-navigation-action-widget.h   \
-       ev-page-action.c                \
-       ev-page-action.h                \
-       ev-page-action-widget.c         \
-       ev-page-action-widget.h         \
        ev-password-view.h              \
        ev-password-view.c              \
        ev-print-operation.h            \
@@ -87,8 +84,6 @@ evince_SOURCES=                               \
        ev-sidebar-page.h               \
        ev-sidebar-thumbnails.c         \
        ev-sidebar-thumbnails.h         \
-       ev-stock-icons.c                \
-       ev-stock-icons.h                \
        main.c
 
 evince_LDADD=                                                                          \
@@ -102,6 +97,7 @@ evince_LDADD=                                                                                \
        $(top_builddir)/properties/libevproperties.la                                   \
        $(top_builddir)/libdocument/libevdocument.la                                    \
        $(top_builddir)/libview/libevview.la                                            \
+       $(top_builddir)/libmisc/libevmisc.la                                            \
        $(SHELL_LIBS)
 
 BUILT_SOURCES = ev-marshal.h ev-marshal.c
index 6cd5a5b11c87e64c3af05cc9c625e47e4b87720b..8ce0899033ab2b0e89b534aca2df1e03add32675 100644 (file)
@@ -40,6 +40,7 @@
 #include "ev-file-helpers.h"
 #include "ev-metadata-manager.h"
 #include "ev-utils.h"
+#include "ev-stock-icons.h"
 
 #ifdef ENABLE_DBUS
 #include "ev-media-player-keys.h"
@@ -50,8 +51,7 @@
 #include "ev-application-service.h"
 #endif
 
-static void ev_application_add_icon_path_for_screen (GdkScreen     *screen);
-static void ev_application_save_print_settings      (EvApplication *application);
+static void ev_application_save_print_settings (EvApplication *application);
 
 struct _EvApplication {
        GObject base_instance;
@@ -454,9 +454,9 @@ ev_application_open_window (EvApplication  *application,
        }
        
        if (screen) {
+               ev_stock_icons_add_icons_path_for_screen (screen);
                gtk_window_set_screen (GTK_WINDOW (new_window), screen);
        }
-       ev_application_add_icon_path_for_screen (screen);
 
        if (!GTK_WIDGET_REALIZED (new_window))
                gtk_widget_realize (new_window);
@@ -545,37 +545,6 @@ ev_application_get_uri_window (EvApplication *application, const char *uri)
        return uri_window;
 }
 
-static void
-ev_application_add_icon_path_for_screen (GdkScreen *screen)
-{
-       GtkIconTheme *icon_theme;
-
-       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;
-               gchar  *ev_icons_path;
-
-               /* GtkIconTheme will then look in Evince custom hicolor dir
-                * for icons as well as the standard search paths
-                */
-               ev_icons_path = g_build_filename (DATADIR, "icons", NULL);
-               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_free (ev_icons_path);
-               g_strfreev (path);
-       }       
-}
-
 /**
  * ev_application_open_uri_at_dest:
  * @application: The instance of the application.
@@ -601,8 +570,6 @@ ev_application_open_uri_at_dest (EvApplication  *application,
 
        g_return_if_fail (uri != NULL);
        
-       ev_application_add_icon_path_for_screen (screen);
-
        new_window = ev_application_get_uri_window (application, uri);
        
        if (new_window == NULL) {
@@ -613,8 +580,10 @@ ev_application_open_uri_at_dest (EvApplication  *application,
                new_window = EV_WINDOW (ev_window_new ());
        }
 
-       if (screen)
+       if (screen) {
+               ev_stock_icons_add_icons_path_for_screen (screen);
                gtk_window_set_screen (GTK_WINDOW (new_window), screen);
+       }
 
        /* We need to load uri before showing the window, so
           we can restore window size without flickering */     
index 17e0f647f9fa9f95041982c9a942f4ea49d46dfb..771dbc2965a392c55ba1fd27bc6c5c1b9c9229cd 100644 (file)
@@ -392,6 +392,7 @@ main (int argc, char *argv[])
        gtk_main ();
 
        ev_shutdown ();
+       ev_stock_icons_shutdown ();
 
        return 0;
 }