[maemo-commits] [maemo-commits] r16060 - in projects/haf/branches/hildon-thumbnail/daemonize: . daemon daemon/plugins

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Mon Sep 8 16:21:40 EEST 2008
Author: pvanhoof
Date: 2008-09-08 16:21:31 +0300 (Mon, 08 Sep 2008)
New Revision: 16060

Modified:
   projects/haf/branches/hildon-thumbnail/daemonize/ChangeLog
   projects/haf/branches/hildon-thumbnail/daemonize/daemon/hildon-thumbnail-daemon.c
   projects/haf/branches/hildon-thumbnail/daemonize/daemon/hildon-thumbnail-plugin.c
   projects/haf/branches/hildon-thumbnail/daemonize/daemon/hildon-thumbnail-plugin.h
   projects/haf/branches/hildon-thumbnail/daemonize/daemon/plugin-runner.c
   projects/haf/branches/hildon-thumbnail/daemonize/daemon/plugins/gdkpixbuf-plugin.c
Log:
2008-09-08  Philip Van Hoof  <pvanhoof at gnome.org>

	* daemon/hildon-thumbnail-plugin.h
	* daemon/hildon-thumbnail-daemon.c
	* daemon/plugins/gdkpixbuf-plugin.c
	* daemon/plugin-runner.c
	* daemon/hildon-thumbnail-plugin.c: Making it possible to disable
	cropping by configuration in $HOME/.config/hildon-thumbnailer/
	gdkpixbuf-plugin.config:

	[Hildon Thumbnailer]
	doCropped=false



Modified: projects/haf/branches/hildon-thumbnail/daemonize/ChangeLog
===================================================================
--- projects/haf/branches/hildon-thumbnail/daemonize/ChangeLog	2008-09-08 13:16:42 UTC (rev 16059)
+++ projects/haf/branches/hildon-thumbnail/daemonize/ChangeLog	2008-09-08 13:21:31 UTC (rev 16060)
@@ -1,6 +1,19 @@
 2008-09-08  Philip Van Hoof  <pvanhoof at gnome.org>
 
+	* daemon/hildon-thumbnail-plugin.h
+	* daemon/hildon-thumbnail-daemon.c
 	* daemon/plugins/gdkpixbuf-plugin.c
+	* daemon/plugin-runner.c
+	* daemon/hildon-thumbnail-plugin.c: Making it possible to disable
+	cropping by configuration in $HOME/.config/hildon-thumbnailer/
+	gdkpixbuf-plugin.config:
+
+	[Hildon Thumbnailer]
+	doCropped=false
+
+2008-09-08  Philip Van Hoof  <pvanhoof at gnome.org>
+
+	* daemon/plugins/gdkpixbuf-plugin.c
 	* daemon/plugins/pixbuf-io-loader.c
 	* daemon/utils.c
 	* daemon/utils.h

Modified: projects/haf/branches/hildon-thumbnail/daemonize/daemon/hildon-thumbnail-daemon.c
===================================================================
--- projects/haf/branches/hildon-thumbnail/daemonize/daemon/hildon-thumbnail-daemon.c	2008-09-08 13:16:42 UTC (rev 16059)
+++ projects/haf/branches/hildon-thumbnail/daemonize/daemon/hildon-thumbnail-daemon.c	2008-09-08 13:21:31 UTC (rev 16060)
@@ -55,6 +55,7 @@
 		DBusGProxy *manager_proxy;
 		GStrv supported;
 		guint i = 0;
+		gboolean cropping;
 
 		/* TODO: dynamically load plugins, and detect when new ones get
 		 * dropped, and removed ones get removed (and therefore must
@@ -70,7 +71,7 @@
 					   MANAGER_PATH,
 					   MANAGER_INTERFACE);
 
-		hildon_thumbnail_plugin_do_init (module, 
+		hildon_thumbnail_plugin_do_init (module, &cropping,
 						 &error);
 
 		supported = hildon_thumbnail_plugin_get_supported (module);

Modified: projects/haf/branches/hildon-thumbnail/daemonize/daemon/hildon-thumbnail-plugin.c
===================================================================
--- projects/haf/branches/hildon-thumbnail/daemonize/daemon/hildon-thumbnail-plugin.c	2008-09-08 13:16:42 UTC (rev 16059)
+++ projects/haf/branches/hildon-thumbnail/daemonize/daemon/hildon-thumbnail-plugin.c	2008-09-08 13:21:31 UTC (rev 16060)
@@ -67,15 +67,16 @@
 	return supported;
 }
 
-typedef void (*InitFunc) (GError **error);
 
+typedef void (*InitFunc) (gboolean *cropping, GError **error);
+
 void
-hildon_thumbnail_plugin_do_init (GModule *module, GError **error)
+hildon_thumbnail_plugin_do_init (GModule *module, gboolean *cropping, GError **error)
 {
 	InitFunc func;
 
 	if (g_module_symbol (module, "hildon_thumbnail_plugin_init", (gpointer *) &func)) {
-		(func) (error);
+		(func) (cropping, error);
 	}
 }
 

Modified: projects/haf/branches/hildon-thumbnail/daemonize/daemon/hildon-thumbnail-plugin.h
===================================================================
--- projects/haf/branches/hildon-thumbnail/daemonize/daemon/hildon-thumbnail-plugin.h	2008-09-08 13:16:42 UTC (rev 16059)
+++ projects/haf/branches/hildon-thumbnail/daemonize/daemon/hildon-thumbnail-plugin.h	2008-09-08 13:21:31 UTC (rev 16060)
@@ -34,6 +34,7 @@
 GModule *   hildon_thumbnail_plugin_load          (const gchar *module_name);
 GStrv       hildon_thumbnail_plugin_get_supported (GModule *module);
 void        hildon_thumbnail_plugin_do_init       (GModule *module, 
+						   gboolean *cropping,
 						   GError **error);
 void        hildon_thumbnail_plugin_do_create     (GModule *module, 
 						   GStrv uris, 

Modified: projects/haf/branches/hildon-thumbnail/daemonize/daemon/plugin-runner.c
===================================================================
--- projects/haf/branches/hildon-thumbnail/daemonize/daemon/plugin-runner.c	2008-09-08 13:16:42 UTC (rev 16059)
+++ projects/haf/branches/hildon-thumbnail/daemonize/daemon/plugin-runner.c	2008-09-08 13:21:31 UTC (rev 16060)
@@ -52,6 +52,7 @@
 typedef struct {
 	DBusGConnection *connection;
 	GModule *module;
+	gboolean cropping;
 } DaemonPrivate;
 
 enum {
@@ -187,7 +188,7 @@
 	DaemonPrivate *priv = DAEMON_GET_PRIVATE (object);
 	GModule *module = priv->module;
 
-	hildon_thumbnail_plugin_do_init (module, &error);
+	hildon_thumbnail_plugin_do_init (module, &priv->cropping, &error);
 
 	if (!error && do_register) {
 		DBusGProxy *manager_proxy;

Modified: projects/haf/branches/hildon-thumbnail/daemonize/daemon/plugins/gdkpixbuf-plugin.c
===================================================================
--- projects/haf/branches/hildon-thumbnail/daemonize/daemon/plugins/gdkpixbuf-plugin.c	2008-09-08 13:16:42 UTC (rev 16059)
+++ projects/haf/branches/hildon-thumbnail/daemonize/daemon/plugins/gdkpixbuf-plugin.c	2008-09-08 13:21:31 UTC (rev 16060)
@@ -57,6 +57,7 @@
 #endif 
 
 static gchar **supported = NULL;
+static gboolean do_cropped = TRUE;
 
 const gchar** 
 hildon_thumbnail_plugin_supported (void)
@@ -218,12 +219,30 @@
 		GdkPixbuf *pixbuf_normal;
 		GdkPixbuf *pixbuf, *pixbuf_cropped;
 		guint64 mtime;
-		gchar *large = NULL, *normal = NULL, *cropped = NULL;
+		gchar *large = NULL, 
+		      *normal = NULL, 
+		      *cropped = NULL;
+		gboolean just_crop;
 
 		//g_print ("%s\n", uri);
 
 		hildon_thumbnail_util_get_thumb_paths (uri, &large, &normal, &cropped, &nerror);
 
+
+		if (nerror)
+			goto nerror_handler;
+
+		just_crop = (g_file_test (large, G_FILE_TEST_EXISTS) && 
+			     g_file_test (normal, G_FILE_TEST_EXISTS) && 
+			     !g_file_test (cropped, G_FILE_TEST_EXISTS));
+
+		if (just_crop && !do_cropped) {
+			g_free (cropped);
+			g_free (normal);
+			g_free (large);
+			continue;
+		}
+
 		//g_print ("L %s\n", large);
 		//g_print ("N %s\n", normal);
 
@@ -348,8 +367,21 @@
 	supported = NULL;
 }
 
-
 void 
-hildon_thumbnail_plugin_init (GError **error)
+hildon_thumbnail_plugin_init (gboolean *cropping, GError **error)
 {
+	gchar *config = g_build_filename (g_get_user_config_dir (), "hildon-thumbnailer", "gdkpixbuf-plugin.conf", NULL);
+	GKeyFile *keyfile;
+
+	if (!g_key_file_load_from_file (keyfile, config, G_KEY_FILE_NONE, NULL)) {
+		g_free (config);
+		do_cropped = TRUE;
+		*cropping = do_cropped;
+		return;
+	}
+
+	do_cropped = g_key_file_get_boolean (keyfile, "Hildon Thumbnailer", "doCropped", NULL);
+	*cropping = do_cropped;
+	g_free (config);
+	g_key_file_free (keyfile);
 }


More information about the maemo-commits mailing list