From: Jannis Pohlmann Date: Tue, 12 Jun 2012 08:36:41 +0000 (+0100) Subject: Fix args in XML interface spec, add example code to handle Register() X-Git-Tag: boot-manager-0.1.0~49 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=aab5e8f5e239a57886c7017ad33f5f26fcb06151;p=profile%2Fivi%2Fnode-startup-controller.git Fix args in XML interface spec, add example code to handle Register() The XML element name for D-Bus method parameters is "arg", not "param". luc_handler_service_handle_register() now has a "GVariant *apps" parameter and reads/prints the foreground apps that are passed to it. This is just example code to demonstrate how this can be done. It will later be replaced with the real implementation. --- diff --git a/luc-handler/luc-handler-dbus.xml b/luc-handler/luc-handler-dbus.xml index db05691..0578caa 100644 --- a/luc-handler/luc-handler-dbus.xml +++ b/luc-handler/luc-handler-dbus.xml @@ -7,11 +7,11 @@ - + - + diff --git a/luc-handler/luc-handler-service.c b/luc-handler/luc-handler-service.c index 230ee83..61303ab 100644 --- a/luc-handler/luc-handler-service.c +++ b/luc-handler/luc-handler-service.c @@ -39,9 +39,11 @@ static void luc_handler_service_set_property (GObject *ob GParamSpec *pspec); static gboolean luc_handler_service_handle_register (LUCHandler *interface, GDBusMethodInvocation *invocation, + GVariant *apps, LUCHandlerService *service); static gboolean luc_handler_service_handle_deregister (LUCHandler *interface, GDBusMethodInvocation *invocation, + GVariant *apps, LUCHandlerService *service); @@ -170,17 +172,33 @@ static void luc_handler_service_set_property (GObject *object, static gboolean luc_handler_service_handle_register (LUCHandler *object, GDBusMethodInvocation *invocation, + GVariant *apps, LUCHandlerService *service) { + GVariant *foreground_apps; + gchar *app_name; + guint n; + g_return_val_if_fail (IS_LUC_HANDLER (object), FALSE); g_return_val_if_fail (G_IS_DBUS_METHOD_INVOCATION (invocation), FALSE); g_return_val_if_fail (LUC_HANDLER_IS_SERVICE (service), FALSE); - g_debug ("Register called"); + g_debug ("Register called:"); /* TODO read the apps parameter and update the "content" property of * the skeleton */ + foreground_apps = g_variant_lookup_value (apps, "foreground", + G_VARIANT_TYPE_STRING_ARRAY); + if (foreground_apps != NULL) + { + for (n = 0; n < g_variant_n_children (foreground_apps); n++) + { + g_variant_get_child (foreground_apps, n, "&s", &app_name); + g_debug (" foreground: %s", app_name); + } + } + g_dbus_method_invocation_return_value (invocation, NULL); return TRUE; @@ -191,6 +209,7 @@ luc_handler_service_handle_register (LUCHandler *object, static gboolean luc_handler_service_handle_deregister (LUCHandler *object, GDBusMethodInvocation *invocation, + GVariant *apps, LUCHandlerService *service) { g_return_val_if_fail (IS_LUC_HANDLER (object), FALSE);