aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2003-06-14 02:15:17 +0800
committerChristian Persch <chpe@src.gnome.org>2003-06-14 02:15:17 +0800
commit486d194d5a04616abb66e7eac63b63231c013447 (patch)
tree1851bd51a784426db0920a27ea782eb3ac637eff
parent63c30bbc992945dcae374ef87716234fa53cd184 (diff)
downloadgsoc2013-epiphany-486d194d5a04616abb66e7eac63b63231c013447.tar
gsoc2013-epiphany-486d194d5a04616abb66e7eac63b63231c013447.tar.gz
gsoc2013-epiphany-486d194d5a04616abb66e7eac63b63231c013447.tar.bz2
gsoc2013-epiphany-486d194d5a04616abb66e7eac63b63231c013447.tar.lz
gsoc2013-epiphany-486d194d5a04616abb66e7eac63b63231c013447.tar.xz
gsoc2013-epiphany-486d194d5a04616abb66e7eac63b63231c013447.tar.zst
gsoc2013-epiphany-486d194d5a04616abb66e7eac63b63231c013447.zip
Handle NULL return from eel_gconf_get_string. Oh, and fix yet another mem
2003-06-13 Christian Persch <chpe@cvs.gnome.org> * lib/ephy-dialog.c: (get_index), (set_optionmenu_from_config), (set_radiobuttongroup_from_config): Handle NULL return from eel_gconf_get_string. Oh, and fix yet another mem leak.
-rw-r--r--ChangeLog8
-rw-r--r--lib/ephy-dialog.c53
2 files changed, 34 insertions, 27 deletions
diff --git a/ChangeLog b/ChangeLog
index 4e6f99199..318250f21 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2003-06-13 Christian Persch <chpe@cvs.gnome.org>
+
+ * lib/ephy-dialog.c: (get_index), (set_optionmenu_from_config),
+ (set_radiobuttongroup_from_config):
+
+ Handle NULL return from eel_gconf_get_string.
+ Oh, and fix yet another mem leak.
+
2003-06-13 Marco Pesenti Gritti <marco@it.gnome.org>
* src/bookmarks/ephy-bookmarks-import.c:
diff --git a/lib/ephy-dialog.c b/lib/ephy-dialog.c
index a21e03bba..07126f7ce 100644
--- a/lib/ephy-dialog.c
+++ b/lib/ephy-dialog.c
@@ -351,53 +351,52 @@ set_editable_from_config (GtkWidget *editable, const char *config_name)
g_free (value);
}
-static void
-set_optionmenu_from_config (GtkWidget *optionmenu, const char *config_name, GList *senum)
+static int
+get_index (const char *config_name, GList *senum)
{
- int index;
+ int index = 0;
+ char *val;
+ GList *s = NULL;
if (senum)
{
- char *val;
- GList *s;
-
val = eel_gconf_get_string (config_name);
- s = g_list_find_custom (senum, val, (GCompareFunc)strcmp);
+ if (val)
+ {
+ s = g_list_find_custom (senum, val, (GCompareFunc)strcmp);
+ g_free (val);
+ }
+
+ if (s)
+ {
+ index = g_list_position (senum, s);
+ }
- index = g_list_position (senum, s);
}
else
{
index = eel_gconf_get_integer (config_name);
}
- gtk_option_menu_set_history (GTK_OPTION_MENU (optionmenu), index);
+ return index;
}
+
static void
-set_radiobuttongroup_from_config (GtkWidget *radiobutton, const char *config_name, GList *senum)
+set_optionmenu_from_config (GtkWidget *optionmenu, const char *config_name, GList *senum)
{
- int index;
-
- if (senum)
- {
- char *val;
- GList *s;
-
- val = eel_gconf_get_string (config_name);
+ gtk_option_menu_set_history (GTK_OPTION_MENU (optionmenu),
+ get_index (config_name, senum));
+}
- s = g_list_find_custom (senum, val, (GCompareFunc)strcmp);
-
- index = g_list_position (senum, s);
- }
- else
- {
- index = eel_gconf_get_integer (config_name);
- }
+static void
+set_radiobuttongroup_from_config (GtkWidget *radiobutton, const char *config_name, GList *senum)
+{
/* set it (finds the group for us) */
- ephy_gui_gtk_radio_button_set (GTK_RADIO_BUTTON (radiobutton), index);
+ ephy_gui_gtk_radio_button_set (GTK_RADIO_BUTTON (radiobutton),
+ get_index (config_name, senum));
}
static void