evince r3577 - in trunk: . libmisc po shell



Author: carlosgc
Date: Wed Apr  8 13:10:00 2009
New Revision: 3577
URL: http://svn.gnome.org/viewvc/evince?rev=3577&view=rev

Log:
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.

Added:
   trunk/libmisc/
   trunk/libmisc/Makefile.am
   trunk/libmisc/ev-page-action-widget.c
      - copied, changed from r3575, /trunk/shell/ev-page-action-widget.c
   trunk/libmisc/ev-page-action-widget.h
      - copied, changed from r3575, /trunk/shell/ev-page-action-widget.h
   trunk/libmisc/ev-page-action.c
      - copied, changed from r3575, /trunk/shell/ev-page-action.c
   trunk/libmisc/ev-page-action.h
      - copied, changed from r3575, /trunk/shell/ev-page-action.h
   trunk/libmisc/ev-stock-icons.c
      - copied, changed from r3575, /trunk/shell/ev-stock-icons.c
   trunk/libmisc/ev-stock-icons.h
      - copied, changed from r3575, /trunk/shell/ev-stock-icons.h
Removed:
   trunk/shell/ev-page-action-widget.c
   trunk/shell/ev-page-action-widget.h
   trunk/shell/ev-page-action.c
   trunk/shell/ev-page-action.h
   trunk/shell/ev-stock-icons.c
   trunk/shell/ev-stock-icons.h
Modified:
   trunk/ChangeLog
   trunk/Makefile.am
   trunk/configure.ac
   trunk/po/POTFILES.in
   trunk/shell/Makefile.am
   trunk/shell/ev-application.c
   trunk/shell/main.c

Modified: trunk/Makefile.am
==============================================================================
--- trunk/Makefile.am	(original)
+++ trunk/Makefile.am	Wed Apr  8 13:10:00 2009
@@ -4,6 +4,7 @@
 	libdocument \
 	backend \
 	libview \
+	libmisc \
 	properties \
 	shell \
 	po \

Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac	(original)
+++ trunk/configure.ac	Wed Apr  8 13:10:00 2009
@@ -603,6 +603,7 @@
 help/reference/shell/version.xml
 libdocument/Makefile
 libdocument/ev-version.h
+libmisc/Makefile
 libview/Makefile
 Makefile
 po/Makefile.in

Added: trunk/libmisc/Makefile.am
==============================================================================
--- (empty file)
+++ trunk/libmisc/Makefile.am	Wed Apr  8 13:10:00 2009
@@ -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

Copied: trunk/libmisc/ev-page-action-widget.c (from r3575, /trunk/shell/ev-page-action-widget.c)
==============================================================================
--- /trunk/shell/ev-page-action-widget.c	(original)
+++ trunk/libmisc/ev-page-action-widget.c	Wed Apr  8 13:10:00 2009
@@ -24,12 +24,9 @@
 #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);

Copied: trunk/libmisc/ev-page-action-widget.h (from r3575, /trunk/shell/ev-page-action-widget.h)
==============================================================================
--- /trunk/shell/ev-page-action-widget.h	(original)
+++ trunk/libmisc/ev-page-action-widget.h	Wed Apr  8 13:10:00 2009
@@ -18,7 +18,7 @@
  *
  */
 
-#include "ev-page-cache.h"
+#include <evince-view.h>
  
 #include <gtk/gtk.h>
 

Copied: trunk/libmisc/ev-page-action.c (from r3575, /trunk/shell/ev-page-action.c)
==============================================================================
--- /trunk/shell/ev-page-action.c	(original)
+++ trunk/libmisc/ev-page-action.c	Wed Apr  8 13:10:00 2009
@@ -29,11 +29,7 @@
 #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
 {

Copied: trunk/libmisc/ev-page-action.h (from r3575, /trunk/shell/ev-page-action.h)
==============================================================================
--- /trunk/shell/ev-page-action.h	(original)
+++ trunk/libmisc/ev-page-action.h	Wed Apr  8 13:10:00 2009
@@ -23,8 +23,7 @@
 
 #include <gtk/gtk.h>
 
-#include <ev-document.h>
-#include "ev-link.h"
+#include <evince-document.h>
 
 G_BEGIN_DECLS
 

Copied: trunk/libmisc/ev-stock-icons.c (from r3575, /trunk/shell/ev-stock-icons.c)
==============================================================================
--- /trunk/shell/ev-stock-icons.c	(original)
+++ trunk/libmisc/ev-stock-icons.c	Wed Apr  8 13:10:00 2009
@@ -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 @@
 	{ EV_STOCK_VISIBLE,          "eye"}
 };
 
+static gchar *ev_icons_path;
+
 /**
  * ev_stock_icons_init:
  *
@@ -58,6 +60,8 @@
 	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 @@
 	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 ());
 }

Copied: trunk/libmisc/ev-stock-icons.h (from r3575, /trunk/shell/ev-stock-icons.h)
==============================================================================
--- /trunk/shell/ev-stock-icons.h	(original)
+++ trunk/libmisc/ev-stock-icons.h	Wed Apr  8 13:10:00 2009
@@ -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 @@
 #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
 

Modified: trunk/po/POTFILES.in
==============================================================================
--- trunk/po/POTFILES.in	(original)
+++ trunk/po/POTFILES.in	Wed Apr  8 13:10:00 2009
@@ -28,6 +28,8 @@
 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-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

Modified: trunk/shell/Makefile.am
==============================================================================
--- trunk/shell/Makefile.am	(original)
+++ trunk/shell/Makefile.am	Wed Apr  8 13:10:00 2009
@@ -14,6 +14,7 @@
 	-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 @@
 	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 @@
 	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 @@
 	$(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

Modified: trunk/shell/ev-application.c
==============================================================================
--- trunk/shell/ev-application.c	(original)
+++ trunk/shell/ev-application.c	Wed Apr  8 13:10:00 2009
@@ -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 @@
 	}
 	
 	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 @@
 	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 @@
 
 	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 @@
 		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 */	

Modified: trunk/shell/main.c
==============================================================================
--- trunk/shell/main.c	(original)
+++ trunk/shell/main.c	Wed Apr  8 13:10:00 2009
@@ -392,6 +392,7 @@
 	gtk_main ();
 
 	ev_shutdown ();
+	ev_stock_icons_shutdown ();
 
 	return 0;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]