Blame SOURCES/imsettings-fix-memleak-and-crash.patch

29947e
From e1d1ef02dbaf24261f06d095b08290f1a1ad36ae Mon Sep 17 00:00:00 2001
29947e
From: Akira TAGOH <akira@tagoh.org>
29947e
Date: Tue, 15 Oct 2013 13:03:50 +0900
29947e
Subject: [PATCH 1/3] Fix for -Wformat
29947e
29947e
---
29947e
 imsettings-daemon/imsettings-server.c | 9 +++++----
29947e
 1 file changed, 5 insertions(+), 4 deletions(-)
29947e
29947e
diff --git a/imsettings-daemon/imsettings-server.c b/imsettings-daemon/imsettings-server.c
29947e
index 79aa308..c229dd0 100644
29947e
--- a/imsettings-daemon/imsettings-server.c
29947e
+++ b/imsettings-daemon/imsettings-server.c
29947e
@@ -119,7 +119,7 @@ _notify_cb(IMSettingsProc *proc,
29947e
 	notify_notification_show(priv->notify, &err;;
29947e
 
29947e
 	if (err) {
29947e
-		g_warning(err->message);
29947e
+		g_warning("%s", err->message);
29947e
 		g_error_free(err);
29947e
 	}
29947e
 }
29947e
@@ -712,7 +712,7 @@ imsettings_server_cb_switch_im(IMSettingsServer  *server,
29947e
 		g_clear_error(error);
29947e
 		g_set_error(error, IMSETTINGS_GERROR, IMSETTINGS_GERROR_IM_NOT_FOUND,
29947e
 			    _("No such input method on your system: %s"), module);
29947e
-		g_warning((*error)->message);
29947e
+		g_warning("%s", (*error)->message);
29947e
 
29947e
 		return FALSE;
29947e
 	}
29947e
@@ -721,7 +721,7 @@ imsettings_server_cb_switch_im(IMSettingsServer  *server,
29947e
 	if (!*info) {
29947e
 		g_set_error(error, IMSETTINGS_GERROR, IMSETTINGS_GERROR_OOM,
29947e
 			    _("Out of memory"));
29947e
-		g_warning((*error)->message);
29947e
+		g_warning("%s", (*error)->message);
29947e
 
29947e
 		return FALSE;
29947e
 	}
29947e
@@ -746,7 +746,7 @@ imsettings_server_cb_switch_im(IMSettingsServer  *server,
29947e
 	} else if (match) {
29947e
 		g_set_error(error, IMSETTINGS_GERROR, IMSETTINGS_GERROR_NOT_TARGETED_DESKTOP,
29947e
 			    _("Current desktop isn't targeted by IMSettings."));
29947e
-		g_warning((*error)->message);
29947e
+		g_warning("%s", (*error)->message);
29947e
 
29947e
 		return FALSE;
29947e
 	}
29947e
@@ -1222,6 +1222,7 @@ imsettings_server_bus_method_call(GDBusConnection       *connection,
29947e
 		g_dbus_method_invocation_return_error(invocation,
29947e
 						      IMSETTINGS_GERROR,
29947e
 						      err->code,
29947e
+						      "%s",
29947e
 						      err->message);
29947e
 		g_error_free(err);
29947e
 	} else {
29947e
-- 
29947e
1.8.3.1
29947e
29947e
From 5833b104e6a4be022c41eb111bb1e3b61b0d2322 Mon Sep 17 00:00:00 2001
29947e
From: Akira TAGOH <akira@tagoh.org>
29947e
Date: Wed, 16 Oct 2013 11:44:25 +0900
29947e
Subject: [PATCH 2/3] Fix memory leaks
29947e
29947e
---
29947e
 imsettings-daemon/imsettings-server.c |   5 ++
29947e
 imsettings/imsettings-info.c          | 127 +++++++++++++++++-----------------
29947e
 utils/imsettings-list.c               |   1 +
29947e
 3 files changed, 70 insertions(+), 63 deletions(-)
29947e
29947e
diff --git a/imsettings-daemon/imsettings-server.c b/imsettings-daemon/imsettings-server.c
29947e
index c229dd0..1c52782 100644
29947e
--- a/imsettings-daemon/imsettings-server.c
29947e
+++ b/imsettings-daemon/imsettings-server.c
29947e
@@ -596,6 +596,8 @@ imsettings_server_cb_get_info_variants(IMSettingsServer  *server,
29947e
 			n = imsettings_info_get_filename(info);
29947e
 			if (g_strcmp0(module, IMSETTINGS_USER_SPECIFIC_SHORT_DESC) == 0) {
29947e
 				g_variant_builder_add(vb, "{sv}", module, v);
29947e
+			} else {
29947e
+				g_variant_unref(v);
29947e
 			}
29947e
 			g_object_unref(info);
29947e
 		}
29947e
@@ -613,6 +615,8 @@ imsettings_server_cb_get_info_variants(IMSettingsServer  *server,
29947e
 			n = imsettings_info_get_filename(info);
29947e
 			if (g_strcmp0(module, IMSETTINGS_USER_SPECIFIC_SHORT_DESC) == 0) {
29947e
 				g_variant_builder_add(vb, "{sv}", module, v);
29947e
+			} else {
29947e
+				g_variant_unref(v);
29947e
 			}
29947e
 			g_object_unref(info);
29947e
 		}
29947e
@@ -667,6 +671,7 @@ imsettings_server_cb_get_info_variant(IMSettingsServer  *server,
29947e
 				break;
29947e
 			}
29947e
 			g_free(conf);
29947e
+			g_variant_unref(vv);
29947e
 		}
29947e
 		g_variant_unref(v);
29947e
 	}
29947e
diff --git a/imsettings/imsettings-info.c b/imsettings/imsettings-info.c
29947e
index 33f7d74..cbbefcb 100644
29947e
--- a/imsettings/imsettings-info.c
29947e
+++ b/imsettings/imsettings-info.c
29947e
@@ -317,77 +317,77 @@ imsettings_info_variant_new(const gchar *filename,
29947e
 
29947e
 	G_LOCK (info);
29947e
 
29947e
-	if ((fp = popen(cmd->str, "r")) != NULL) {
29947e
-		vb = g_variant_builder_new(G_VARIANT_TYPE ("a{sv}"));
29947e
-
29947e
-		while (!feof(fp)) {
29947e
-			if ((p = fgets(buffer, 255, fp)) != NULL) {
29947e
-				gchar *key = NULL, *val = NULL;
29947e
-				GVariant *v = NULL;
29947e
-				GQuark q;
29947e
-
29947e
-				if (!_parse_param(p, &key, &val)) {
29947e
-					g_warning("Failed to parse a line in %s: %s",
29947e
-						  filename, p);
29947e
-					goto bail;
29947e
-				}
29947e
-				q = g_quark_try_string(key);
29947e
-				if (q == 0)
29947e
-					goto unknown_param;
29947e
-				for (i = 0; i < LAST_IMSETTINGS_INFO; i++) {
29947e
-					if (__xinput_tokens[i] == q)
29947e
-						break;
29947e
-				}
29947e
-				switch (i) {
29947e
-				    case IMSETTINGS_INFO_GTK_IM_MODULE:
29947e
-				    case IMSETTINGS_INFO_QT_IM_MODULE:
29947e
-				    case IMSETTINGS_INFO_XIM:
29947e
-				    case IMSETTINGS_INFO_XIM_PROGRAM:
29947e
-				    case IMSETTINGS_INFO_XIM_ARGS:
29947e
-				    case IMSETTINGS_INFO_PREFERENCE_PROGRAM:
29947e
-				    case IMSETTINGS_INFO_PREFERENCE_ARGS:
29947e
-				    case IMSETTINGS_INFO_AUXILIARY_PROGRAM:
29947e
-				    case IMSETTINGS_INFO_AUXILIARY_ARGS:
29947e
-				    case IMSETTINGS_INFO_SHORT_DESC:
29947e
-				    case IMSETTINGS_INFO_LONG_DESC:
29947e
-				    case IMSETTINGS_INFO_ICON:
29947e
-				    case IMSETTINGS_INFO_LANG:
29947e
-				    case IMSETTINGS_INFO_FILENAME:
29947e
-				    case IMSETTINGS_INFO_NOT_RUN:
29947e
-					    v = g_variant_new_string(val);
29947e
-					    break;
29947e
-				    case IMSETTINGS_INFO_IMSETTINGS_IGNORE_ME:
29947e
-				    case IMSETTINGS_INFO_IMSETTINGS_IS_SCRIPT:
29947e
-				    case IMSETTINGS_INFO_IS_XIM:
29947e
-					    v = g_variant_new_boolean((g_ascii_strcasecmp(val, "true") == 0 ||
29947e
-								       g_ascii_strcasecmp(val, "yes") == 0 ||
29947e
-								       g_ascii_strcasecmp(val, "1") == 0));
29947e
-					    break;
29947e
-				    default:
29947e
-				    unknown_param:
29947e
-					    g_warning("Unknown parameter: %s = %s",
29947e
-						      key, val);
29947e
-					    v = NULL;
29947e
-					    break;
29947e
-				}
29947e
-				if (v)
29947e
-					g_variant_builder_add(vb, "{sv}",
29947e
-							      key, v);
29947e
-			  bail:
29947e
-				g_free(key);
29947e
-				g_free(val);
29947e
+	if ((fp = popen(cmd->str, "r")) == NULL)
29947e
+		goto error;
29947e
+
29947e
+	vb = g_variant_builder_new(G_VARIANT_TYPE ("a{sv}"));
29947e
+
29947e
+	while (!feof(fp)) {
29947e
+		if ((p = fgets(buffer, 255, fp)) != NULL) {
29947e
+			gchar *key = NULL, *val = NULL;
29947e
+			GVariant *v = NULL;
29947e
+			GQuark q;
29947e
+
29947e
+			if (!_parse_param(p, &key, &val)) {
29947e
+				g_warning("Failed to parse a line in %s: %s",
29947e
+					  filename, p);
29947e
+				goto bail;
29947e
+			}
29947e
+			q = g_quark_try_string(key);
29947e
+			if (q == 0)
29947e
+				goto unknown_param;
29947e
+			for (i = 0; i < LAST_IMSETTINGS_INFO; i++) {
29947e
+				if (__xinput_tokens[i] == q)
29947e
+					break;
29947e
 			}
29947e
+			switch (i) {
29947e
+			    case IMSETTINGS_INFO_GTK_IM_MODULE:
29947e
+			    case IMSETTINGS_INFO_QT_IM_MODULE:
29947e
+			    case IMSETTINGS_INFO_XIM:
29947e
+			    case IMSETTINGS_INFO_XIM_PROGRAM:
29947e
+			    case IMSETTINGS_INFO_XIM_ARGS:
29947e
+			    case IMSETTINGS_INFO_PREFERENCE_PROGRAM:
29947e
+			    case IMSETTINGS_INFO_PREFERENCE_ARGS:
29947e
+			    case IMSETTINGS_INFO_AUXILIARY_PROGRAM:
29947e
+			    case IMSETTINGS_INFO_AUXILIARY_ARGS:
29947e
+			    case IMSETTINGS_INFO_SHORT_DESC:
29947e
+			    case IMSETTINGS_INFO_LONG_DESC:
29947e
+			    case IMSETTINGS_INFO_ICON:
29947e
+			    case IMSETTINGS_INFO_LANG:
29947e
+			    case IMSETTINGS_INFO_FILENAME:
29947e
+			    case IMSETTINGS_INFO_NOT_RUN:
29947e
+				    v = g_variant_new_string(val);
29947e
+				    break;
29947e
+			    case IMSETTINGS_INFO_IMSETTINGS_IGNORE_ME:
29947e
+			    case IMSETTINGS_INFO_IMSETTINGS_IS_SCRIPT:
29947e
+			    case IMSETTINGS_INFO_IS_XIM:
29947e
+				    v = g_variant_new_boolean((g_ascii_strcasecmp(val, "true") == 0 ||
29947e
+							       g_ascii_strcasecmp(val, "yes") == 0 ||
29947e
+							       g_ascii_strcasecmp(val, "1") == 0));
29947e
+				    break;
29947e
+			    default:
29947e
+			    unknown_param:
29947e
+				    g_warning("Unknown parameter: %s = %s",
29947e
+					      key, val);
29947e
+				    v = NULL;
29947e
+				    break;
29947e
+			}
29947e
+			if (v)
29947e
+				g_variant_builder_add(vb, "{sv}",
29947e
+						      key, v);
29947e
+		  bail:
29947e
+			g_free(key);
29947e
+			g_free(val);
29947e
 		}
29947e
-
29947e
-		pclose(fp);
29947e
 	}
29947e
+
29947e
+	pclose(fp);
29947e
 	value = g_variant_builder_end(vb);
29947e
+	g_variant_builder_unref(vb);
29947e
 
29947e
 	G_UNLOCK (info);
29947e
 
29947e
   error:
29947e
-	if (vb)
29947e
-		g_variant_builder_unref(vb);
29947e
 	g_string_free(cmd, TRUE);
29947e
 
29947e
 	return value;
29947e
@@ -461,6 +461,7 @@ imsettings_info_new(GVariant *parameters)
29947e
 				    g_warning("Unknown parameter: %s", key);
29947e
 				    break;
29947e
 			}
29947e
+			g_variant_unref(val);
29947e
 		}
29947e
 		g_variant_iter_free(iter);
29947e
 	}
29947e
diff --git a/utils/imsettings-list.c b/utils/imsettings-list.c
29947e
index 0504224..07bc085 100644
29947e
--- a/utils/imsettings-list.c
29947e
+++ b/utils/imsettings-list.c
29947e
@@ -107,6 +107,7 @@ main(int    argc,
29947e
 		    strcmp(&key[len - slen], XINPUT_SUFFIX) == 0)
29947e
 			continue;
29947e
 		info = imsettings_info_new(vv);
29947e
+		g_variant_unref(vv);
29947e
 		name = imsettings_info_get_short_desc(info);
29947e
 		imname = imsettings_info_get_im_name(info);
29947e
 		subimname = imsettings_info_get_sub_im_name(info);
29947e
-- 
29947e
1.8.3.1
29947e
29947e
From 6d2940d3b7744868b72e2b14cc8e1b70c77ce594 Mon Sep 17 00:00:00 2001
29947e
From: Akira TAGOH <akira@tagoh.org>
29947e
Date: Wed, 16 Oct 2013 13:24:59 +0900
29947e
Subject: [PATCH 3/3] clean up
29947e
29947e
---
29947e
 imsettings-daemon/imsettings-server.c | 106 ++++++++++++++++------------------
29947e
 1 file changed, 49 insertions(+), 57 deletions(-)
29947e
29947e
diff --git a/imsettings-daemon/imsettings-server.c b/imsettings-daemon/imsettings-server.c
29947e
index 1c52782..25f45a6 100644
29947e
--- a/imsettings-daemon/imsettings-server.c
29947e
+++ b/imsettings-daemon/imsettings-server.c
29947e
@@ -541,6 +541,8 @@ imsettings_server_cb_get_info_variants(IMSettingsServer  *server,
29947e
 			v = imsettings_info_variant_new(p, lang);
29947e
 			g_free(p);
29947e
 			g_free(conf);
29947e
+			if (!v)
29947e
+				goto next;
29947e
 
29947e
 			info = imsettings_info_new(v);
29947e
 			if (imsettings_info_is_visible(info)) {
29947e
@@ -591,15 +593,17 @@ imsettings_server_cb_get_info_variants(IMSettingsServer  *server,
29947e
 		if (g_file_test(p, G_FILE_TEST_EXISTS) &&
29947e
 		    !g_file_test(p, G_FILE_TEST_IS_SYMLINK)) {
29947e
 			v = imsettings_info_variant_new(p, lang);
29947e
-			info = imsettings_info_new(v);
29947e
-			module = imsettings_info_get_short_desc(info);
29947e
-			n = imsettings_info_get_filename(info);
29947e
-			if (g_strcmp0(module, IMSETTINGS_USER_SPECIFIC_SHORT_DESC) == 0) {
29947e
-				g_variant_builder_add(vb, "{sv}", module, v);
29947e
-			} else {
29947e
-				g_variant_unref(v);
29947e
+			if (v) {
29947e
+				info = imsettings_info_new(v);
29947e
+				module = imsettings_info_get_short_desc(info);
29947e
+				n = imsettings_info_get_filename(info);
29947e
+				if (g_strcmp0(module, IMSETTINGS_USER_SPECIFIC_SHORT_DESC) == 0) {
29947e
+					g_variant_builder_add(vb, "{sv}", module, v);
29947e
+				} else {
29947e
+					g_variant_unref(v);
29947e
+				}
29947e
+				g_object_unref(info);
29947e
 			}
29947e
-			g_object_unref(info);
29947e
 		}
29947e
 		g_free(p);
29947e
 		/* an exception to deal with the case switching back to the user specific.
29947e
@@ -610,15 +614,17 @@ imsettings_server_cb_get_info_variants(IMSettingsServer  *server,
29947e
 		if (g_file_test(p, G_FILE_TEST_EXISTS) &&
29947e
 		    !g_file_test(p, G_FILE_TEST_IS_SYMLINK)) {
29947e
 			v = imsettings_info_variant_new(p, lang);
29947e
-			info = imsettings_info_new(v);
29947e
-			module = imsettings_info_get_short_desc(info);
29947e
-			n = imsettings_info_get_filename(info);
29947e
-			if (g_strcmp0(module, IMSETTINGS_USER_SPECIFIC_SHORT_DESC) == 0) {
29947e
-				g_variant_builder_add(vb, "{sv}", module, v);
29947e
-			} else {
29947e
-				g_variant_unref(v);
29947e
+			if (v) {
29947e
+				info = imsettings_info_new(v);
29947e
+				module = imsettings_info_get_short_desc(info);
29947e
+				n = imsettings_info_get_filename(info);
29947e
+				if (g_strcmp0(module, IMSETTINGS_USER_SPECIFIC_SHORT_DESC) == 0) {
29947e
+					g_variant_builder_add(vb, "{sv}", module, v);
29947e
+				} else {
29947e
+					g_variant_unref(v);
29947e
+				}
29947e
+				g_object_unref(info);
29947e
 			}
29947e
-			g_object_unref(info);
29947e
 		}
29947e
 		g_free(p);
29947e
 
29947e
@@ -1034,43 +1040,36 @@ imsettings_server_bus_method_call(GDBusConnection       *connection,
29947e
 
29947e
 	if (g_strcmp0(method_name, "StopService") == 0) {
29947e
 		g_dbus_method_invocation_return_value(invocation,
29947e
-						      g_variant_new("(b)", TRUE));
29947e
+						      g_variant_new_boolean(TRUE));
29947e
 		g_signal_emit(server, signals[SIG_DISCONNECTED], 0, NULL);
29947e
 	} else if (g_strcmp0(method_name, "GetVersion") == 0) {
29947e
-		value = g_variant_new("(u)",
29947e
-				      IMSETTINGS_SETTINGS_API_VERSION);
29947e
+		value = g_variant_new_uint32(IMSETTINGS_SETTINGS_API_VERSION);
29947e
 	} else if (g_strcmp0(method_name, "GetInfoVariants") == 0) {
29947e
 		const gchar *lang;
29947e
-		GVariant *v;
29947e
 
29947e
 		g_variant_get(parameters, "(&s)",
29947e
 			      &lang);
29947e
 
29947e
-		v = imsettings_server_cb_get_info_variants(server, lang, &err;;
29947e
-		if (!v) {
29947e
+		value = imsettings_server_cb_get_info_variants(server, lang, &err;;
29947e
+		if (!value) {
29947e
 			g_set_error(&err, IMSETTINGS_GERROR,
29947e
 				    IMSETTINGS_GERROR_IM_NOT_FOUND,
29947e
 				    "No IMs available");
29947e
-		} else {
29947e
-			value = g_variant_new_tuple(&v, 1);
29947e
 		}
29947e
 	} else if (g_strcmp0(method_name, "GetInfoVariant") == 0) {
29947e
 		const gchar *lang, *module;
29947e
-		GVariant *v;
29947e
 
29947e
 		g_variant_get(parameters, "(&s&s)",
29947e
 			      &lang, &module);
29947e
 
29947e
-		v = imsettings_server_cb_get_info_variant(server,
29947e
-							  lang,
29947e
-							  module,
29947e
-							  &err;;
29947e
-		if (!v) {
29947e
+		value = imsettings_server_cb_get_info_variant(server,
29947e
+							      lang,
29947e
+							      module,
29947e
+							      &err;;
29947e
+		if (!value) {
29947e
 			g_set_error(&err, IMSETTINGS_GERROR,
29947e
 				    IMSETTINGS_GERROR_IM_NOT_FOUND,
29947e
 				    "No such input method: %s", module);
29947e
-		} else {
29947e
-			value = g_variant_new_tuple(&v, 1);
29947e
 		}
29947e
 	} else if (g_strcmp0(method_name, "GetSystemIM") == 0) {
29947e
 		const gchar *lang;
29947e
@@ -1079,7 +1078,7 @@ imsettings_server_bus_method_call(GDBusConnection       *connection,
29947e
 		g_variant_get(parameters, "(&s)", &lang);
29947e
 		im = imsettings_server_cb_get_system_im(server, lang, &err;;
29947e
 		if (im) {
29947e
-			value = g_variant_new("(s)", im);
29947e
+			value = g_variant_new_string(im);
29947e
 			g_free(im);
29947e
 		}
29947e
 	} else if (g_strcmp0(method_name, "GetUserIM") == 0) {
29947e
@@ -1089,7 +1088,7 @@ imsettings_server_bus_method_call(GDBusConnection       *connection,
29947e
 		g_variant_get(parameters, "(&s)", &lang);
29947e
 		im = imsettings_server_cb_get_user_im(server, lang, &err;;
29947e
 		if (im) {
29947e
-			value = g_variant_new("(s)", im);
29947e
+			value = g_variant_new_string(im);
29947e
 			g_free(im);
29947e
 		}
29947e
 	} else if (g_strcmp0(method_name, "IsSystemDefault") == 0) {
29947e
@@ -1099,8 +1098,7 @@ imsettings_server_bus_method_call(GDBusConnection       *connection,
29947e
 		g_variant_get(parameters, "(&s&s)", &lang, &module);
29947e
 		im = imsettings_server_cb_get_system_im(server, lang, &err;;
29947e
 		if (im) {
29947e
-			value = g_variant_new("(b)",
29947e
-					      g_ascii_strcasecmp(im, module) == 0);
29947e
+			value = g_variant_new_boolean(g_ascii_strcasecmp(im, module) == 0);
29947e
 			g_free(im);
29947e
 		}
29947e
 	} else if (g_strcmp0(method_name, "IsUserDefault") == 0) {
29947e
@@ -1110,8 +1108,7 @@ imsettings_server_bus_method_call(GDBusConnection       *connection,
29947e
 		g_variant_get(parameters, "(&s&s)", &lang, &module);
29947e
 		im = imsettings_server_cb_get_user_im(server, lang, &err;;
29947e
 		if (im) {
29947e
-			value = g_variant_new("(b)",
29947e
-					      g_ascii_strcasecmp(im, module) == 0);
29947e
+			value = g_variant_new_boolean(g_ascii_strcasecmp(im, module) == 0);
29947e
 			g_free(im);
29947e
 		}
29947e
 	} else if (g_strcmp0(method_name, "IsXIM") == 0) {
29947e
@@ -1138,8 +1135,7 @@ imsettings_server_bus_method_call(GDBusConnection       *connection,
29947e
 				    IMSETTINGS_GERROR_OOM,
29947e
 				    _("Out of memory"));
29947e
 		} else {
29947e
-			value = g_variant_new("(b)",
29947e
-					      imsettings_info_is_xim(info));
29947e
+			value = g_variant_new_boolean(imsettings_info_is_xim(info));
29947e
 			g_object_unref(info);
29947e
 		}
29947e
 		g_variant_unref(v);
29947e
@@ -1166,9 +1162,8 @@ imsettings_server_bus_method_call(GDBusConnection       *connection,
29947e
 		if (info)
29947e
 			g_object_unref(info);
29947e
 
29947e
-		value = g_variant_new("(b)", ret);
29947e
+		value = g_variant_new_boolean(ret);
29947e
 	} else if (g_strcmp0(method_name, "GetActiveVariant") == 0) {
29947e
-		GVariant *v = NULL;
29947e
 		gchar *f;
29947e
 
29947e
 		if (!priv->current_im ||
29947e
@@ -1176,19 +1171,17 @@ imsettings_server_bus_method_call(GDBusConnection       *connection,
29947e
 			f = g_build_filename(imsettings_server_get_xinputdir(server),
29947e
 					     IMSETTINGS_NONE_CONF XINPUT_SUFFIX, NULL);
29947e
 			if (g_file_test(f, G_FILE_TEST_EXISTS))
29947e
-				v = imsettings_info_variant_new(f, NULL);
29947e
+				value = imsettings_info_variant_new(f, NULL);
29947e
 			g_free(f);
29947e
 		} else {
29947e
 			IMSettingsInfo *info = imsettings_proc_info(priv->current_im);
29947e
 
29947e
-			v = imsettings_info_variant_new(imsettings_info_get_filename(info),
29947e
-							imsettings_info_get_language(info));
29947e
+			value = imsettings_info_variant_new(imsettings_info_get_filename(info),
29947e
+							    imsettings_info_get_language(info));
29947e
 		}
29947e
-		if (!v) {
29947e
+		if (!value) {
29947e
 			g_set_error(&err, IMSETTINGS_GERROR, IMSETTINGS_GERROR_CONFIGURATION_ERROR,
29947e
 				    "none.conf isn't installed.");
29947e
-		} else {
29947e
-			value = g_variant_new_tuple(&v, 1);
29947e
 		}
29947e
 	} else if (g_strcmp0(method_name, "LoadModule") == 0) {
29947e
 		const gchar *modname;
29947e
@@ -1197,7 +1190,7 @@ imsettings_server_bus_method_call(GDBusConnection       *connection,
29947e
 		g_variant_get(parameters, "(&s)", &modname);
29947e
 
29947e
 		ret = imsettings_server_cb_load_module(server, modname);
29947e
-		value = g_variant_new("(b)", ret);
29947e
+		value = g_variant_new_boolean(ret);
29947e
 	} else if (g_strcmp0(method_name, "UnloadModule") == 0) {
29947e
 		const gchar *modname;
29947e
 		gboolean ret;
29947e
@@ -1205,17 +1198,13 @@ imsettings_server_bus_method_call(GDBusConnection       *connection,
29947e
 		g_variant_get(parameters, "(&s)", &modname);
29947e
 
29947e
 		ret = imsettings_server_cb_unload_module(server, modname);
29947e
-		value = g_variant_new("(b)", ret);
29947e
+		value = g_variant_new_boolean(ret);
29947e
 	} else if (g_strcmp0(method_name, "DumpModuleSettings") == 0) {
29947e
-		GVariant *v;
29947e
-
29947e
-		v = imsettings_server_cb_get_module_settings(server, &err;;
29947e
-		if (!v) {
29947e
+		value = imsettings_server_cb_get_module_settings(server, &err;;
29947e
+		if (!value) {
29947e
 			g_set_error(&err, IMSETTINGS_GERROR,
29947e
 				    IMSETTINGS_GERROR_CONFIGURATION_ERROR,
29947e
 				    "No modules loaded");
29947e
-		} else {
29947e
-			value = g_variant_new_tuple(&v, 1);
29947e
 		}
29947e
 	}
29947e
   finalize:
29947e
@@ -1232,7 +1221,10 @@ imsettings_server_bus_method_call(GDBusConnection       *connection,
29947e
 		g_error_free(err);
29947e
 	} else {
29947e
 		if (value) {
29947e
-			g_dbus_method_invocation_return_value(invocation, value);
29947e
+			GVariant *v;
29947e
+
29947e
+			v = g_variant_new_tuple(&value, 1);
29947e
+			g_dbus_method_invocation_return_value(invocation, v);
29947e
 		}
29947e
 	}
29947e
 }
29947e
-- 
29947e
1.8.3.1
29947e