summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKjartan Maraas <kmaraas@gnome.org>2006-08-23 05:34:45 +0000
committerKjartan Maraas <kmaraas@src.gnome.org>2006-08-23 05:34:45 +0000
commit7173f6e3d8a89e5897cfeabfe890a1c3422e4065 (patch)
tree8d71c390c6d4344b93a8a89f11ed902803ecd015
parent1358fd4ef568807715c7a6b0962f19285a8da64b (diff)
downloadgnome-control-center-7173f6e3d8a89e5897cfeabfe890a1c3422e4065.tar.gz
Make read_orientation_from_string() and read_wptype_from_string() behaveNAUTILUS_2_17_1NAUTILUS_2_16_3NAUTILUS_2_16_2NAUTILUS_2_16_1NAUTILUS_2_16_0GNOME_2_16_BRANCHPOINT
2006-08-23 Kjartan Maraas <kmaraas@gnome.org> * preferences.c: (bg_preferences_load), (bg_preferences_merge_entry), (read_wptype_from_string), (read_orientation_from_string): Make read_orientation_from_string() and read_wptype_from_string() behave like read_color_from_string() and adjust all callers. Avoids some excess strduping too I guess. Closes bug #352252.
-rw-r--r--libbackground/ChangeLog9
-rw-r--r--libbackground/preferences.c23
2 files changed, 22 insertions, 10 deletions
diff --git a/libbackground/ChangeLog b/libbackground/ChangeLog
index 0698f431a..93dc2e601 100644
--- a/libbackground/ChangeLog
+++ b/libbackground/ChangeLog
@@ -1,3 +1,12 @@
+2006-08-23 Kjartan Maraas <kmaraas@gnome.org>
+
+ * preferences.c: (bg_preferences_load),
+ (bg_preferences_merge_entry), (read_wptype_from_string),
+ (read_orientation_from_string): Make read_orientation_from_string()
+ and read_wptype_from_string() behave like read_color_from_string()
+ and adjust all callers. Avoids some excess strduping too I guess.
+ Closes bug #352252.
+
2006-08-21 Rodney Dawes <dobey@novell.com>
* preferences.c (bg_preferences_load): Revert previous leak fix from
diff --git a/libbackground/preferences.c b/libbackground/preferences.c
index 84eda13c9..864f6e5c4 100644
--- a/libbackground/preferences.c
+++ b/libbackground/preferences.c
@@ -42,8 +42,8 @@ static void bg_preferences_class_init (BGPreferencesClass *class);
static void bg_preferences_finalize (GObject *object);
static GdkColor *read_color_from_string (const gchar *string);
-static orientation_t read_orientation_from_string (gchar *string);
-static wallpaper_type_t read_wptype_from_string (gchar *string);
+static orientation_t read_orientation_from_string (const gchar *string);
+static wallpaper_type_t read_wptype_from_string (const gchar *string);
static GEnumValue _bg_wptype_values[] = {
{ WPTYPE_TILED, "WPTYPE_TILED", "wallpaper"},
@@ -272,13 +272,18 @@ bg_preferences_load (BGPreferences *prefs)
if (prefs->opacity >= 100 || prefs->opacity < 0)
prefs->adjust_opacity = FALSE;
- prefs->orientation = read_orientation_from_string (gconf_client_get_string (client, BG_PREFERENCES_COLOR_SHADING_TYPE, &error));
+ tmp = gconf_client_get_string (client, BG_PREFERENCES_COLOR_SHADING_TYPE, &error);
+ prefs->orientation = read_orientation_from_string (tmp);
+ g_free (tmp);
+
if (prefs->orientation == ORIENTATION_SOLID)
prefs->gradient_enabled = FALSE;
else
prefs->gradient_enabled = TRUE;
- prefs->wallpaper_type = read_wptype_from_string (gconf_client_get_string (client, BG_PREFERENCES_PICTURE_OPTIONS, &error));
+ tmp = gconf_client_get_string (client, BG_PREFERENCES_PICTURE_OPTIONS, &error);
+ prefs->wallpaper_type = read_wptype_from_string (tmp);
+ g_free (tmp);
if (prefs->wallpaper_type == WPTYPE_UNSET) {
prefs->wallpaper_enabled = FALSE;
@@ -305,7 +310,7 @@ bg_preferences_merge_entry (BGPreferences *prefs,
g_return_if_fail (IS_BG_PREFERENCES (prefs));
if (!strcmp (entry->key, BG_PREFERENCES_PICTURE_OPTIONS)) {
- wallpaper_type_t wallpaper_type = read_wptype_from_string (g_strdup (gconf_value_get_string (value)));
+ wallpaper_type_t wallpaper_type = read_wptype_from_string (gconf_value_get_string (value));
if (wallpaper_type == WPTYPE_UNSET) {
prefs->wallpaper_enabled = FALSE;
} else {
@@ -350,7 +355,7 @@ bg_preferences_merge_entry (BGPreferences *prefs,
prefs->adjust_opacity = FALSE;
}
else if (!strcmp (entry->key, BG_PREFERENCES_COLOR_SHADING_TYPE)) {
- prefs->orientation = read_orientation_from_string (g_strdup (gconf_value_get_string (value)));
+ prefs->orientation = read_orientation_from_string (gconf_value_get_string (value));
if (prefs->orientation == ORIENTATION_SOLID)
prefs->gradient_enabled = FALSE;
@@ -371,7 +376,7 @@ bg_preferences_merge_entry (BGPreferences *prefs,
}
static wallpaper_type_t
-read_wptype_from_string (gchar *string)
+read_wptype_from_string (const gchar *string)
{
wallpaper_type_t type = WPTYPE_UNSET;
@@ -387,14 +392,13 @@ read_wptype_from_string (gchar *string)
} else if (!strncmp (string, "zoom", sizeof ("zoom"))) {
type = WPTYPE_ZOOM;
}
- g_free (string);
}
return type;
}
static orientation_t
-read_orientation_from_string (gchar *string)
+read_orientation_from_string (const gchar *string)
{
orientation_t type = ORIENTATION_SOLID;
@@ -404,7 +408,6 @@ read_orientation_from_string (gchar *string)
} else if (!strncmp (string, "horizontal-gradient", sizeof ("horizontal-gradient"))) {
type = ORIENTATION_HORIZ;
}
- g_free (string);
}
return type;