Extend dbus signal
authorKonrad Kuchciak <k.kuchciak@samsung.com>
Tue, 25 Jun 2019 06:31:23 +0000 (08:31 +0200)
committerKonrad Kuchciak <k.kuchciak@samsung.com>
Thu, 27 Jun 2019 11:38:14 +0000 (13:38 +0200)
added pid, process_name and process_state

Change-Id: I6bd6862bfb2f8ef660043e96908637fed6942476

src/action.c

index 045ba38..d432195 100644 (file)
@@ -53,7 +53,7 @@ static void action_finish(struct action_data *ad)
     GVariantBuilder *builder;
     GVariant *signal_params;
 
-    snprintf(format, 20, "(s@%s@%s@a{sv})", g_variant_get_type_string(ad->actual_value),
+    snprintf(format, 20, "(is@%s@%s@a{sv})", g_variant_get_type_string(ad->actual_value),
                                              g_variant_get_type_string(ad->allowed_value));
 
     snprintf(objpath, PATH_MAX, "%s/%s", TSM_DBUS_PATH, ad->ds->name);
@@ -69,7 +69,17 @@ static void action_finish(struct action_data *ad)
                           "killed",
                           g_variant_new_boolean(ad->ds->process->kill));
 
+    g_variant_builder_add(builder, "{sv}",
+                          "process_name",
+                          g_variant_new_string(ad->ds->process->name));
+
+    g_variant_builder_add(builder, "{sv}",
+                          "process_state",
+                          g_variant_new_string(process_is_foreground(ad->ds->process) ?
+                                               "foreground" : "background"));
+
     signal_params = g_variant_new(format,
+                                  ad->ds->process->pid,
                                   limit_type_to_string(ad->lt),
                                   ad->actual_value,
                                   ad->allowed_value,