From 5adc9f2e1a99e29b8a761388e17c08a6e4d79d5d Mon Sep 17 00:00:00 2001 From: Carlos Garcia Campos Date: Wed, 08 Apr 2009 13:10:00 +0000 Subject: Move EvPageAction and EvStockIcons from shell to a new internal library 2009-04-08 Carlos Garcia Campos * 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 --- diff --git a/ChangeLog b/ChangeLog index 91a7e8c..ab39147 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,28 @@ +2009-04-08 Carlos Garcia Campos + + * 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 * backend/tiff/tiff2ps.c (tiff2ps_context_new): Fixes memory leak. Bug #578285. - + 2009-04-06 Carlos Garcia Campos * 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 * shell/ev-window.c: diff --git a/Makefile.am b/Makefile.am index ff5bd82..8c12582 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4,6 +4,7 @@ SUBDIRS = \ libdocument \ backend \ libview \ + libmisc \ properties \ shell \ po \ diff --git a/configure.ac b/configure.ac index 0b6555e..cdfb2d6 100644 --- a/configure.ac +++ b/configure.ac @@ -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 index 0000000..7f6ad9b --- /dev/null +++ b/libmisc/Makefile.am @@ -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 diff --git a/shell/ev-page-action-widget.c b/libmisc/ev-page-action-widget.c index 7a6ad3b..28b6759 100644 --- a/shell/ev-page-action-widget.c +++ b/libmisc/ev-page-action-widget.c @@ -24,12 +24,9 @@ #include #include -#include "ev-document-links.h" -#include "ev-marshal.h" +#include #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); diff --git a/shell/ev-page-action-widget.h b/libmisc/ev-page-action-widget.h index 32efd00..5583d6a 100644 --- a/shell/ev-page-action-widget.h +++ b/libmisc/ev-page-action-widget.h @@ -18,7 +18,7 @@ * */ -#include "ev-page-cache.h" +#include #include diff --git a/shell/ev-page-action.c b/libmisc/ev-page-action.c index cc3615a..f2a1536 100644 --- a/shell/ev-page-action.c +++ b/libmisc/ev-page-action.c @@ -29,11 +29,7 @@ #include #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 { diff --git a/shell/ev-page-action.h b/libmisc/ev-page-action.h index 6337bde..dc13bdd 100644 --- a/shell/ev-page-action.h +++ b/libmisc/ev-page-action.h @@ -23,8 +23,7 @@ #include -#include -#include "ev-link.h" +#include G_BEGIN_DECLS diff --git a/shell/ev-stock-icons.c b/libmisc/ev-stock-icons.c index e1049c9..8b121e9 100644 --- a/shell/ev-stock-icons.c +++ b/libmisc/ev-stock-icons.c @@ -6,12 +6,12 @@ * Author: * Martin Kretzschmar * - * 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 ()); } diff --git a/shell/ev-stock-icons.h b/libmisc/ev-stock-icons.h index 2e7f21b..793314d 100644 --- a/shell/ev-stock-icons.h +++ b/libmisc/ev-stock-icons.h @@ -6,12 +6,12 @@ * Author: * Martin Kretzschmar * - * 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 diff --git a/po/POTFILES.in b/po/POTFILES.in index 7df8212..5be9bc6 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -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 diff --git a/shell/Makefile.am b/shell/Makefile.am index 4230dbb..65d3ffa 100644 --- a/shell/Makefile.am +++ b/shell/Makefile.am @@ -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 diff --git a/shell/ev-application.c b/shell/ev-application.c index 6cd5a5b..8ce0899 100644 --- a/shell/ev-application.c +++ b/shell/ev-application.c @@ -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 */ diff --git a/shell/main.c b/shell/main.c index 17e0f64..771dbc2 100644 --- a/shell/main.c +++ b/shell/main.c @@ -392,6 +392,7 @@ main (int argc, char *argv[]) gtk_main (); ev_shutdown (); + ev_stock_icons_shutdown (); return 0; } -- cgit v0.9.1