From de0c62586869f6a6a2d093e3b352bc9db85c23b9 Mon Sep 17 00:00:00 2001 From: Niklas Wenzel Date: Sat, 25 Apr 2015 22:49:57 +0200 Subject: Unescape action names when passing them to the proxy in im_application_list_remove_all() --- src/im-application-list.c | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/im-application-list.c b/src/im-application-list.c index 36b2ff3..82025cc 100644 --- a/src/im-application-list.c +++ b/src/im-application-list.c @@ -522,10 +522,38 @@ im_application_list_remove_all (GSimpleAction *action, if (app->proxy != NULL) /* If it is remote, we tell the app we've cleared */ { + /* Unescape action names */ + GArray *unescaped_source_actions_array = g_array_new(TRUE, FALSE, sizeof(gchar*)); + for (it = source_actions; *it; it++) + { + gchar *action_name; + + action_name = unescape_action_name (*it); + + g_array_append_val(unescaped_source_actions_array, action_name); + } + + gchar **unescaped_source_actions = (gchar**) g_array_free(unescaped_source_actions_array, FALSE); + + GArray *unescaped_message_actions_array = g_array_new(TRUE, FALSE, sizeof(gchar*)); + for (it = message_actions; *it; it++) + { + gchar *action_name; + + action_name = unescape_action_name (*it); + + g_array_append_val(unescaped_message_actions_array, action_name); + } + + gchar **unescaped_message_actions = (gchar**) g_array_free(unescaped_message_actions_array, FALSE); + indicator_messages_application_call_dismiss (app->proxy, - (const gchar * const *) source_actions, - (const gchar * const *) message_actions, + (const gchar * const *) unescaped_source_actions, + (const gchar * const *) unescaped_message_actions, app->cancellable, NULL, NULL); + + g_strfreev (unescaped_source_actions); + g_strfreev (unescaped_message_actions); } g_strfreev (source_actions); -- cgit v1.2.3 From 5d4c62d7b80050b9c51dc7df77c00113e53bb442 Mon Sep 17 00:00:00 2001 From: Niklas Wenzel Date: Thu, 30 Apr 2015 09:45:39 +0200 Subject: Remove GArray and fix code style --- src/im-application-list.c | 31 +++++++++---------------------- 1 file changed, 9 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/im-application-list.c b/src/im-application-list.c index 82025cc..272142a 100644 --- a/src/im-application-list.c +++ b/src/im-application-list.c @@ -522,30 +522,17 @@ im_application_list_remove_all (GSimpleAction *action, if (app->proxy != NULL) /* If it is remote, we tell the app we've cleared */ { - /* Unescape action names */ - GArray *unescaped_source_actions_array = g_array_new(TRUE, FALSE, sizeof(gchar*)); - for (it = source_actions; *it; it++) - { - gchar *action_name; - - action_name = unescape_action_name (*it); - - g_array_append_val(unescaped_source_actions_array, action_name); - } - - gchar **unescaped_source_actions = (gchar**) g_array_free(unescaped_source_actions_array, FALSE); + gchar **unescaped_source_actions; + gchar **unescaped_message_actions; - GArray *unescaped_message_actions_array = g_array_new(TRUE, FALSE, sizeof(gchar*)); - for (it = message_actions; *it; it++) - { - gchar *action_name; - - action_name = unescape_action_name (*it); - - g_array_append_val(unescaped_message_actions_array, action_name); - } + /* Unescape action names */ + unescaped_source_actions = g_new0 (gchar *, g_strv_length (source_actions) + 1); + for (i = 0; source_actions[i]; i++) + unescaped_source_actions[i] = unescape_action_name (source_actions[i]); - gchar **unescaped_message_actions = (gchar**) g_array_free(unescaped_message_actions_array, FALSE); + unescaped_message_actions = g_new0 (gchar *, g_strv_length (message_actions) + 1); + for (i = 0; message_actions[i]; i++) + unescaped_message_actions[i] = unescape_action_name (message_actions[i]); indicator_messages_application_call_dismiss (app->proxy, (const gchar * const *) unescaped_source_actions, -- cgit v1.2.3 From e460914e37a50ece094a17e6f6a8fb6cdb817ed5 Mon Sep 17 00:00:00 2001 From: Niklas Wenzel Date: Thu, 30 Apr 2015 09:53:52 +0200 Subject: Fix build error --- src/im-application-list.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/im-application-list.c b/src/im-application-list.c index 272142a..ee0e1e1 100644 --- a/src/im-application-list.c +++ b/src/im-application-list.c @@ -522,6 +522,7 @@ im_application_list_remove_all (GSimpleAction *action, if (app->proxy != NULL) /* If it is remote, we tell the app we've cleared */ { + int i; gchar **unescaped_source_actions; gchar **unescaped_message_actions; -- cgit v1.2.3 From 395de61de1a8bbe9023be4233dda84e89e682261 Mon Sep 17 00:00:00 2001 From: Niklas Wenzel Date: Thu, 30 Apr 2015 09:56:26 +0200 Subject: Use guint instead of int --- src/im-application-list.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/im-application-list.c b/src/im-application-list.c index ee0e1e1..68d161b 100644 --- a/src/im-application-list.c +++ b/src/im-application-list.c @@ -522,7 +522,7 @@ im_application_list_remove_all (GSimpleAction *action, if (app->proxy != NULL) /* If it is remote, we tell the app we've cleared */ { - int i; + guint i; gchar **unescaped_source_actions; gchar **unescaped_message_actions; -- cgit v1.2.3 From eade0ee8c99156923a62d3aa0c72006e15d47c32 Mon Sep 17 00:00:00 2001 From: Niklas Wenzel Date: Thu, 30 Apr 2015 16:23:49 +0200 Subject: Remove spaces --- src/im-application-list.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/im-application-list.c b/src/im-application-list.c index 68d161b..7c2c877 100644 --- a/src/im-application-list.c +++ b/src/im-application-list.c @@ -534,7 +534,7 @@ im_application_list_remove_all (GSimpleAction *action, unescaped_message_actions = g_new0 (gchar *, g_strv_length (message_actions) + 1); for (i = 0; message_actions[i]; i++) unescaped_message_actions[i] = unescape_action_name (message_actions[i]); - + indicator_messages_application_call_dismiss (app->proxy, (const gchar * const *) unescaped_source_actions, (const gchar * const *) unescaped_message_actions, -- cgit v1.2.3