Fix several GVariant related issues. And remove a wrong unref.
authorPeng Huang <shawn.p.huang@gmail.com>
Thu, 7 Jul 2011 16:42:52 +0000 (12:42 -0400)
committerPeng Huang <shawn.p.huang@gmail.com>
Thu, 7 Jul 2011 16:42:52 +0000 (12:42 -0400)
BUG=None
TEST=Linux desktop

Review URL: http://codereview.appspot.com/4667067

bus/ibusimpl.c
bus/inputcontext.c
src/ibusconfig.c

index b356b2c..42afeec 100644 (file)
@@ -2183,8 +2183,8 @@ bus_ibus_impl_save_global_engine_name_to_config (BusIBusImpl *ibus)
         ibus->use_global_engine &&
         ibus->global_engine_name) {
         ibus_config_set_value (ibus->config,
-                        "general", "global_engine",
-                        g_variant_new ("s", ibus->global_engine_name));
+                               "general", "global_engine",
+                               g_variant_new_string (ibus->global_engine_name));
     }
 }
 
@@ -2206,8 +2206,7 @@ bus_ibus_impl_load_global_previous_engine_name_from_config (BusIBusImpl *ibus)
     GVariant *value = ibus_config_get_value (ibus->config, "general", "global_previous_engine");
     if (value == NULL)
         return NULL;
-    gchar *engine_name = NULL;
-    g_variant_get (value, "(s)", &engine_name);
+    gchar *engine_name = g_variant_dup_string (value, NULL);
     g_variant_unref (value);
     return engine_name;
 }
@@ -2226,8 +2225,8 @@ bus_ibus_impl_save_global_previous_engine_name_to_config (BusIBusImpl *ibus)
         ibus->use_global_engine &&
         ibus->global_previous_engine_name) {
         ibus_config_set_value (ibus->config,
-                        "general", "global_previous_engine",
-                        g_variant_new ("s", ibus->global_previous_engine_name));
+                               "general", "global_previous_engine",
+                               g_variant_new_string (ibus->global_previous_engine_name));
     }
 }
 
index 2164e7c..47ac9d5 100644 (file)
@@ -1171,7 +1171,6 @@ bus_input_context_focus_in (BusInputContext *context)
                             NULL, /* we do not cancel the call. */
                             NULL, /* use the default callback function. */
                             NULL);
-            g_object_unref (desc);
         }
     }
 
index 36ef44b..b691277 100644 (file)
@@ -257,7 +257,6 @@ ibus_config_get_value (IBusConfig  *config,
 
     GVariant *value = NULL;
     g_variant_get (result, "(v)", &value);
-    g_variant_ref (value);
     g_variant_unref (result);
 
     return value;
@@ -300,8 +299,7 @@ ibus_config_get_value_async_finish (IBusConfig    *config,
                                                  result,
                                                  error);
     if (retval != NULL) {
-        g_variant_get (retval, "(@a{sv})", &value);
-        g_variant_ref (value);
+        g_variant_get (retval, "(v)", &value);
         g_variant_unref (retval);
     }
 
@@ -332,7 +330,6 @@ ibus_config_get_values (IBusConfig  *config,
 
     GVariant *value = NULL;
     g_variant_get (result, "(@a{sv})", &value);
-    g_variant_ref (value);
     g_variant_unref (result);
 
     return value;
@@ -373,8 +370,7 @@ ibus_config_get_values_async_finish (IBusConfig    *config,
                                                  result,
                                                  error);
     if (retval != NULL) {
-        g_variant_get (retval, "(v)", &value);
-        g_variant_ref (value);
+        g_variant_get (retval, "(@a{sv})", &value);
         g_variant_unref (retval);
     }