[gnome-shell/HEAD: 1/2] app: Use g_variant_lookup instead of dict iteration



commit e47f4fd778be778f09a85c89a1374e30e10cc858
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Tue Oct 1 22:54:16 2013 -0400

    app: Use g_variant_lookup instead of dict iteration

 src/shell-app.c |   18 ++----------------
 1 files changed, 2 insertions(+), 16 deletions(-)
---
diff --git a/src/shell-app.c b/src/shell-app.c
index 1f5017d..9e16f80 100644
--- a/src/shell-app.c
+++ b/src/shell-app.c
@@ -960,10 +960,8 @@ application_properties_changed (GDBusConnection *connection,
 {
   ShellApp *app = user_data;
   GVariant *changed_properties;
-  GVariantIter iter;
   gboolean busy = FALSE;
-  const gchar *key, *interface_name_for_signal;
-  GVariant *value;
+  const gchar *interface_name_for_signal;
 
   g_variant_get (parameters,
                  "(&s a{sv}as)",
@@ -974,19 +972,7 @@ application_properties_changed (GDBusConnection *connection,
   if (g_strcmp0 (interface_name_for_signal, "org.gtk.Application") != 0)
     return;
 
-  g_variant_iter_init (&iter, changed_properties);
-  while (g_variant_iter_next (&iter, "{&sv}", &key, &value))
-    {
-      if (g_strcmp0 (key, "Busy") != 0)
-        {
-          g_variant_unref (value);
-          continue;
-        }
-
-      busy = g_variant_get_boolean (value);
-      g_variant_unref (value);
-      break;
-    }
+  g_variant_lookup (changed_properties, "Busy", "b", &busy);
 
   if (busy)
     shell_app_state_transition (app, SHELL_APP_STATE_BUSY);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]