patches/redshift-03-gerror-leak.diff
author jurikm
Sun, 12 Feb 2012 14:04:10 +0000
changeset 8245 383896da4129
parent 3438 a1dade982b66
permissions -rw-r--r--
SFEsauerbraten.spec: add IPS package name

--- redshift-1.6.orig/src/location-gnome-clock.c	2011-04-30 01:48:08.173781561 -0400
+++ redshift-1.6/src/location-gnome-clock.c	2011-04-30 01:55:19.919457825 -0400
@@ -37,16 +37,14 @@
 static char *
 find_current_city(GConfClient *client, const char *id)
 {
-	GError *error = NULL;
-
 	char *current_city = NULL;
 	char *cities_key = g_strdup_printf("/apps/panel/applets/%s"
 					   "/prefs/cities", id);
 	GSList *cities = gconf_client_get_list(client,
 					       cities_key,
-					       GCONF_VALUE_STRING, &error);
+					       GCONF_VALUE_STRING, NULL);
 
-	if (error) {
+	if (cities == NULL) {
 		fprintf(stderr, _("Error reading city list: `%s'.\n"),
 			cities_key);
 		g_free(cities_key);
@@ -72,17 +70,23 @@
 {
 	g_type_init();
 
-	GError *error = NULL;
 	GConfClient *client = gconf_client_get_default();
 
 	/* Get a list of active applets in the panel. */
 	GSList *applets = gconf_client_get_list(client,
 			"/apps/panel/general/applet_id_list",
-			GCONF_VALUE_STRING, &error);
-	if (error) {
+			GCONF_VALUE_STRING, NULL);
+ 	if (applets == NULL) {
+ 		/* JDS has an alternate list of applets. */
+ 		applets = gconf_client_get_list(client,
+ 				"/apps/panel/general/applet_id_list_jds",
+ 				GCONF_VALUE_STRING, NULL);
+ 	}
+ 
+ 	if (applets == NULL) {
 		fputs(_("Cannot list GNOME panel applets.\n"), stderr);
-		g_object_unref(client);
 		g_slist_free(applets);
+		g_object_unref(client);
 		return -1;
 	}
 
@@ -102,11 +106,11 @@
 			char *key = g_strdup_printf("/apps/panel/applets/%s"
 						    "/bonobo_iid", id);
 			char *bonobo_iid = gconf_client_get_string(client, key,
-								   &error);
+								   NULL);
 
-			/* Try both gnome-panel 2.30.x and earlier bonobo_iid key and
-			   newer applet_iid. */
-			if (!error && bonobo_iid != NULL &&
+			/* Try both gnome-panel 2.30.x and earlier bonobo_iid
+			   key and newer applet_iid. */
+			if (bonobo_iid != NULL &&
 			    !strcmp(bonobo_iid, "OAFIID:GNOME_ClockApplet")) {
 				clock_applet_count += 1;
 				current_city = find_current_city(client, id);
@@ -115,13 +119,15 @@
 				g_free(key);
 				key = g_strdup_printf("/apps/panel/applets/%s"
 					    "/applet_iid", id);
-				char *applet_iid = gconf_client_get_string(client, key,
-									    &error);
+				char *applet_iid = gconf_client_get_string(
+						client, key, NULL);
 
-				if (!error && applet_iid != NULL &&
-				    !strcmp(applet_iid, "ClockAppletFactory::ClockApplet")) {
+				if (applet_iid != NULL &&
+				    !strcmp(applet_iid, "ClockAppletFactory::"
+					    "ClockApplet")) {
 					clock_applet_count += 1;
-					current_city = find_current_city(client, id);
+					current_city = find_current_city(client,
+							id);
 				}
 
 				g_free(applet_iid);