evince r2943 - in trunk: . backend/pdf libdocument



Author: carlosgc
Date: Mon Mar  3 15:01:19 2008
New Revision: 2943
URL: http://svn.gnome.org/viewvc/evince?rev=2943&view=rev

Log:
2008-03-03  Carlos Garcia Campos  <carlosgc gnome org>

	* backend/pdf/pdfdocument.evince-backend.in:
	* libdocument/ev-backends-manager.c:
	(ev_backends_manager_load_backend),
	(ev_backends_manager_get_document):
	* libdocument/ev-module.[ch]: (ev_module_load), (ev_module_new):

	Allow making backend modules resident. This is needed only for
	some backends like pdf to avoid registering glib types more than
	once.


Modified:
   trunk/ChangeLog
   trunk/backend/pdf/pdfdocument.evince-backend.in
   trunk/libdocument/ev-backends-manager.c
   trunk/libdocument/ev-module.c
   trunk/libdocument/ev-module.h

Modified: trunk/backend/pdf/pdfdocument.evince-backend.in
==============================================================================
--- trunk/backend/pdf/pdfdocument.evince-backend.in	(original)
+++ trunk/backend/pdf/pdfdocument.evince-backend.in	Mon Mar  3 15:01:19 2008
@@ -1,5 +1,6 @@
 [Evince Backend]
 Module=pdfdocument
+Resident=true
 _TypeDescription=PDF Documents
 MimeType=application/pdf;application/x-bzpdf;application/x-gzpdf
 

Modified: trunk/libdocument/ev-backends-manager.c
==============================================================================
--- trunk/libdocument/ev-backends-manager.c	(original)
+++ trunk/libdocument/ev-backends-manager.c	Mon Mar  3 15:01:19 2008
@@ -30,6 +30,7 @@
 struct _EvBackendInfo {
 	gchar       *module_name;
 	GTypeModule *module;
+	gboolean     resident;
 
 	GType        type_id;
 
@@ -78,6 +79,9 @@
 		return NULL;
 	}
 
+	info->resident = g_key_file_get_boolean (backend_file, EV_BACKENDS_GROUP,
+						 "Resident", NULL);
+	
 	info->type_desc = g_key_file_get_locale_string (backend_file, EV_BACKENDS_GROUP,
 							"TypeDescription", NULL, NULL);
 	if (!info->type_desc) {
@@ -194,7 +198,7 @@
 		gchar *path;
 		
 		path = g_module_build_path (EV_BACKENDSDIR, info->module_name);
-		info->module = G_TYPE_MODULE (ev_module_new (path));
+		info->module = G_TYPE_MODULE (ev_module_new (path, info->resident));
 		g_free (path);
 	}
 	

Modified: trunk/libdocument/ev-module.c
==============================================================================
--- trunk/libdocument/ev-module.c	(original)
+++ trunk/libdocument/ev-module.c	Mon Mar  3 15:01:19 2008
@@ -54,6 +54,7 @@
         GTypeModule parent_instance;
 
         GModule *library;
+	gboolean resident;
 
         gchar *path;
         GType type;
@@ -106,6 +107,9 @@
                 return FALSE;
         }
 
+	if (module->resident)
+		g_module_make_resident (module->library);
+
         return TRUE;
 }
 
@@ -175,7 +179,8 @@
 }
 
 EvModule *
-ev_module_new (const gchar *path)
+ev_module_new (const gchar *path,
+	       gboolean     resident)
 {
         EvModule *result;
 
@@ -185,6 +190,7 @@
 
         g_type_module_set_name (G_TYPE_MODULE (result), path);
         result->path = g_strdup (path);
+	result->resident = resident;
 
         return result;
 }

Modified: trunk/libdocument/ev-module.h
==============================================================================
--- trunk/libdocument/ev-module.h	(original)
+++ trunk/libdocument/ev-module.h	Mon Mar  3 15:01:19 2008
@@ -56,7 +56,8 @@
 
 GType        ev_module_get_type        (void) G_GNUC_CONST;
 
-EvModule    *ev_module_new             (const gchar *path);
+EvModule    *ev_module_new             (const gchar *path,
+					gboolean     resident);
 
 const gchar *ev_module_get_path        (EvModule    *module);
 



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