[maemo-commits] [maemo-commits] r16090 - projects/haf/branches/hildon-thumbnail/daemonize/daemon

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Wed Sep 10 19:03:15 EEST 2008
Author: pvanhoof
Date: 2008-09-10 19:03:13 +0300 (Wed, 10 Sep 2008)
New Revision: 16090

Modified:
   projects/haf/branches/hildon-thumbnail/daemonize/daemon/plugin-runner.c
Log:
Init of plugins in the plugin-runner

Modified: projects/haf/branches/hildon-thumbnail/daemonize/daemon/plugin-runner.c
===================================================================
--- projects/haf/branches/hildon-thumbnail/daemonize/daemon/plugin-runner.c	2008-09-10 15:59:35 UTC (rev 16089)
+++ projects/haf/branches/hildon-thumbnail/daemonize/daemon/plugin-runner.c	2008-09-10 16:03:13 UTC (rev 16090)
@@ -181,45 +181,44 @@
 {
 }
 
+
+static void 
+daemon_register_func (gpointer self, const gchar *mime_type, GModule *module)
+{
+	GError *nerror = NULL;
+
+	dbus_g_proxy_call (self, "Register",
+			   &nerror, G_TYPE_STRING,
+			   mime_type,
+			   G_TYPE_INVALID,
+			   G_TYPE_INVALID);
+
+	if (nerror) {
+		g_critical ("Failed to init: %s\n", nerror->message);
+		g_error_free (nerror);
+	}
+}
+
 static void
 daemon_start (Daemon *object, gboolean do_register)
 {
 	GError *error = NULL;
 	DaemonPrivate *priv = DAEMON_GET_PRIVATE (object);
 	GModule *module = priv->module;
+	DBusGProxy *manager_proxy;
 
+	manager_proxy = dbus_g_proxy_new_for_name (priv->connection, 
+						   MANAGER_SERVICE,
+						   MANAGER_PATH,
+						   MANAGER_INTERFACE);
+
 	hildon_thumbnail_plugin_do_init (module, &priv->cropping, 
-					 NULL, NULL, &error);
+					 daemon_register_func, 
+					 manager_proxy, &error);
 
-	if (!error && do_register) {
-		DBusGProxy *manager_proxy;
-		GStrv supported;
-		guint i = 0;
-		manager_proxy = dbus_g_proxy_new_for_name (priv->connection, 
-							   MANAGER_SERVICE,
-							   MANAGER_PATH,
-							   MANAGER_INTERFACE);
 
-		supported = hildon_thumbnail_plugin_get_supported (module);
+	g_object_unref (manager_proxy);
 
-		if (supported) {
-			while (supported[i] != NULL) {
-				GError *nerror = NULL;
-				dbus_g_proxy_call (manager_proxy, "Register",
-						   &nerror, G_TYPE_STRING,
-						   supported[i],
-						   G_TYPE_INVALID,
-						   G_TYPE_INVALID);
-				if (nerror) {
-					g_critical ("Failed to init: %s\n", nerror->message);
-					g_error_free (nerror);
-				}
-				i++;
-			}
-		}
-		g_object_unref (manager_proxy);
-	}
-
 	if (error) {
 		g_critical ("Failed to init: %s\n", error->message);
 		g_error_free (error);


More information about the maemo-commits mailing list