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

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Wed Sep 17 11:06:00 EEST 2008
Author: pvanhoof
Date: 2008-09-17 11:05:59 +0300 (Wed, 17 Sep 2008)
New Revision: 16144

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

	* daemon/plugins/exec-plugin.c
	* daemon/manager.c: Respecting the override file



Modified: projects/haf/branches/hildon-thumbnail/daemonize/ChangeLog
===================================================================
--- projects/haf/branches/hildon-thumbnail/daemonize/ChangeLog	2008-09-16 17:23:05 UTC (rev 16143)
+++ projects/haf/branches/hildon-thumbnail/daemonize/ChangeLog	2008-09-17 08:05:59 UTC (rev 16144)
@@ -1,3 +1,8 @@
+2008-09-17  Philip Van Hoof  <pvanhoof at gnome.org>
+
+	* daemon/plugins/exec-plugin.c
+	* daemon/manager.c: Respecting the override file
+
 2008-09-16  Philip Van Hoof  <pvanhoof at gnome.org>
 
 	* daemon/plugins/gstreamer-video-plugin.c: Error reporting and a few 

Modified: projects/haf/branches/hildon-thumbnail/daemonize/daemon/manager.c
===================================================================
--- projects/haf/branches/hildon-thumbnail/daemonize/daemon/manager.c	2008-09-16 17:23:05 UTC (rev 16143)
+++ projects/haf/branches/hildon-thumbnail/daemonize/daemon/manager.c	2008-09-17 08:05:59 UTC (rev 16144)
@@ -114,6 +114,7 @@
 	GHashTableIter iter;
 	GHashTable *pre;
 	gpointer pkey, pvalue;
+	gboolean has_override = FALSE;
 
 	dir = g_dir_open (path, 0, NULL);
 
@@ -135,6 +136,12 @@
 		GFileInfo *info;
 		GFile *file;
 
+		if (strcmp (fullfilen, "override") == 0) {
+			has_override = TRUE;
+			g_free (fullfilen);
+			continue;
+		}
+
 		keyfile = g_key_file_new ();
 
 		if (!g_key_file_load_from_file (keyfile, fullfilen, G_KEY_FILE_NONE, NULL)) {
@@ -199,6 +206,33 @@
 
 	g_dir_close (dir);
 
+	if (has_override) {
+		GKeyFile *keyfile;
+		gchar *fullfilen = g_build_filename (path, "override", NULL);
+		guint length;
+
+		keyfile = g_key_file_new ();
+
+		if (g_key_file_load_from_file (keyfile, fullfilen, G_KEY_FILE_NONE, NULL)) {
+			gchar **mimes = g_key_file_get_groups (keyfile, &length);
+			guint i;
+
+			for (i = 0; i< length; i++) {
+				ValueInfo *info = g_slice_new (ValueInfo);
+
+				info->name = g_key_file_get_string (keyfile, mimes[i], "Name", NULL);
+				info->mtime = time (NULL);
+
+				g_hash_table_replace (pre, 
+						      g_strdup (mimes[i]), 
+						      info);
+			}
+		}
+
+		g_free (fullfilen);
+		g_key_file_free (keyfile);
+	}
+
 	g_hash_table_iter_init (&iter, pre);
 
 	while (g_hash_table_iter_next (&iter, &pkey, &pvalue))  {

Modified: projects/haf/branches/hildon-thumbnail/daemonize/daemon/plugins/exec-plugin.c
===================================================================
--- projects/haf/branches/hildon-thumbnail/daemonize/daemon/plugins/exec-plugin.c	2008-09-16 17:23:05 UTC (rev 16143)
+++ projects/haf/branches/hildon-thumbnail/daemonize/daemon/plugins/exec-plugin.c	2008-09-17 08:05:59 UTC (rev 16144)
@@ -343,6 +343,11 @@
 	GStrv mimetypes;
 	guint i = 0, length;
 
+	if (!execs)
+		execs = g_hash_table_new_full (g_str_hash, g_str_equal,
+					       (GDestroyNotify) g_free,
+					       (GDestroyNotify) g_free);
+
 	keyfile = g_key_file_new ();
 
 	if (!g_key_file_load_from_file (keyfile, config, G_KEY_FILE_NONE, NULL)) {
@@ -350,11 +355,6 @@
 		return;
 	}
 
-	if (!execs)
-		execs = g_hash_table_new_full (g_str_hash, g_str_equal,
-					       (GDestroyNotify) g_free,
-					       (GDestroyNotify) g_free);
-
 	do_cropped = g_key_file_get_boolean (keyfile, "Hildon Thumbnailer", "DoCropping", NULL);
 
 	mimetypes = g_key_file_get_string_list (keyfile, "Hildon Thumbnailer", "MimeTypes", &length, NULL);


More information about the maemo-commits mailing list