[gtk+] Use gtk_action_group_get_action when looking up actions
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Use gtk_action_group_get_action when looking up actions
- Date: Tue, 8 Jun 2010 13:05:26 +0000 (UTC)
commit 79b161f709671b7408a03a5456ed6716b3318c42
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Jun 8 09:03:07 2010 -0400
Use gtk_action_group_get_action when looking up actions
...instead of open-coding it. Pointed out by Christian Persch
in bug 620960
gtk/gtkapplication.c | 23 ++++++++---------------
1 files changed, 8 insertions(+), 15 deletions(-)
---
diff --git a/gtk/gtkapplication.c b/gtk/gtkapplication.c
index 444bc9b..6be15a8 100644
--- a/gtk/gtkapplication.c
+++ b/gtk/gtkapplication.c
@@ -116,12 +116,11 @@ gtk_application_default_prepare_activation (GApplication *application,
GVariant *value;
g_variant_iter_init (&iter, platform_data);
- while (g_variant_iter_next (&iter, "{sv}", &key, &value))
+ while (g_variant_iter_next (&iter, "{&sv}", &key, &value))
{
if (strcmp (key, "startup-notification-id") == 0 &&
- strcmp (g_variant_get_type_string (value), "s") == 0)
+ g_variant_is_of_type (value, G_VARIANT_TYPE_STRING))
gdk_notify_startup_complete_with_id (g_variant_get_string (value, NULL));
- g_free (key);
g_variant_unref (value);
}
@@ -141,24 +140,18 @@ gtk_application_default_activated (GApplication *application,
static void
gtk_application_default_action (GApplication *application,
- const gchar *action,
+ const gchar *action_name,
guint timestamp)
{
GtkApplication *app = GTK_APPLICATION (application);
- GList *actions, *iter;
+ GtkAction *action;
- actions = gtk_action_group_list_actions (app->priv->main_actions);
- for (iter = actions; iter; iter = iter->next)
+ action = gtk_action_group_get_action (app->priv->main_actions, action_name);
+ if (action)
{
- GtkAction *gtkaction = iter->data;
- if (strcmp (action, gtk_action_get_name (gtkaction)) == 0)
- {
- /* TODO set timestamp */
- gtk_action_activate (gtkaction);
- break;
- }
+ /* TODO set timestamp */
+ gtk_action_activate (action);
}
- g_list_free (actions);
}
static GVariant *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]