diff --git a/capplets/background/ChangeLog b/capplets/background/ChangeLog index 148692636..b821adca5 100644 --- a/capplets/background/ChangeLog +++ b/capplets/background/ChangeLog @@ -8,6 +8,8 @@ (realize_2_cb): Comment out to kill warning (realize_cb): Ditto (real_realize_cb): Ditto + (string_to_background_type): Treat NULL string as default + (string_to_orientation): Ditto 2002-01-13 Seth Nickell diff --git a/capplets/background/background-properties-capplet.c b/capplets/background/background-properties-capplet.c index e595de1db..a304251de 100644 --- a/capplets/background/background-properties-capplet.c +++ b/capplets/background/background-properties-capplet.c @@ -82,22 +82,21 @@ set_picture_is_present (gboolean present) static BackgroundType string_to_background_type (char *string) { - BackgroundType type; + BackgroundType type = BACKGROUND_TYPE_NO_PICTURE; - if (!strncmp (string, "wallpaper", sizeof ("wallpaper"))) { - type = BACKGROUND_TYPE_WALLPAPER; - } else if (!strncmp (string, "centered", sizeof ("centered"))) { - type = BACKGROUND_TYPE_CENTERED; - } else if (!strncmp (string, "scaled", sizeof ("scaled"))) { - type = BACKGROUND_TYPE_SCALED; - } else if (!strncmp (string, "stretched", sizeof ("stretched"))) { - type = BACKGROUND_TYPE_STRETCHED; - } else { - type = BACKGROUND_TYPE_NO_PICTURE; + if (string) { + if (!strncmp (string, "wallpaper", sizeof ("wallpaper"))) { + type = BACKGROUND_TYPE_WALLPAPER; + } else if (!strncmp (string, "centered", sizeof ("centered"))) { + type = BACKGROUND_TYPE_CENTERED; + } else if (!strncmp (string, "scaled", sizeof ("scaled"))) { + type = BACKGROUND_TYPE_SCALED; + } else if (!strncmp (string, "stretched", sizeof ("stretched"))) { + type = BACKGROUND_TYPE_STRETCHED; + } + g_free (string); } - g_free (string); - return type; } @@ -137,17 +136,17 @@ orientation_to_string (orientation_t orientation) static orientation_t string_to_orientation (gchar *string) { - orientation_t type; + orientation_t type = ORIENTATION_SOLID; - if (!strncmp (string, "vertical-gradient", sizeof ("vertical-gradient"))) { - type = ORIENTATION_VERT; - } else if (!strncmp (string, "horizontal-gradient", sizeof ("horizontal-gradient"))) { - type = ORIENTATION_HORIZ; - } else { - type = ORIENTATION_SOLID; + if (string) { + if (!strncmp (string, "vertical-gradient", sizeof ("vertical-gradient"))) { + type = ORIENTATION_VERT; + } else if (!strncmp (string, "horizontal-gradient", sizeof ("horizontal-gradient"))) { + type = ORIENTATION_HORIZ; + } + g_free (string); } - g_free (string); return type; } diff --git a/capplets/default-applications/ChangeLog b/capplets/default-applications/ChangeLog index e73f7b960..cba78c725 100644 --- a/capplets/default-applications/ChangeLog +++ b/capplets/default-applications/ChangeLog @@ -2,6 +2,9 @@ * gnome-default-applications-properties.c (initialize_default_applications): Use glib methods instead of deprecated libgnome ones + (read_editor): Do not crash on NULL value + (read_help_viewer): Ditto + (read_browser): Ditto 2002-01-19 Seth Nickell diff --git a/capplets/default-applications/gnome-default-applications-properties.c b/capplets/default-applications/gnome-default-applications-properties.c index 9f53d0102..40cd5fa61 100644 --- a/capplets/default-applications/gnome-default-applications-properties.c +++ b/capplets/default-applications/gnome-default-applications-properties.c @@ -125,7 +125,7 @@ read_editor (GConfClient *client, if (possible_editors[i].in_path == FALSE) continue; - if (strcmp (editor, possible_editors[i].executable_name) == 0 && + if (editor && strcmp (editor, possible_editors[i].executable_name) == 0 && needs_term == possible_editors[i].needs_term && accepts_lineno == possible_editors[i].accepts_lineno) { gtk_entry_set_text (GTK_ENTRY (WID ("text_select_combo_entry")), @@ -209,7 +209,7 @@ read_browser (GConfClient *client, if (possible_browsers[i].in_path == FALSE) continue; - if (strcmp (browser, possible_browsers[i].executable_name) == 0 && + if (browser && strcmp (browser, possible_browsers[i].executable_name) == 0 && needs_term == possible_browsers[i].needs_term && nremote == possible_browsers[i].nremote) { gtk_entry_set_text (GTK_ENTRY (WID ("web_select_combo_entry")), @@ -291,7 +291,7 @@ read_help_viewer (GConfClient *client, if (possible_help_viewers[i].in_path == FALSE) continue; - if (strcmp (help_viewer, possible_help_viewers[i].executable_name) == 0 && + if (help_viewer && strcmp (help_viewer, possible_help_viewers[i].executable_name) == 0 && needs_term == possible_help_viewers[i].needs_term && accepts_lineno == possible_help_viewers[i].accepts_urls) { gtk_entry_set_text (GTK_ENTRY (WID ("help_select_combo_entry")), diff --git a/capplets/mouse/ChangeLog b/capplets/mouse/ChangeLog index af06b99a3..bafad6292 100644 --- a/capplets/mouse/ChangeLog +++ b/capplets/mouse/ChangeLog @@ -3,6 +3,7 @@ * gnome-mouse-properties.c (drawing_area_expose_event): Kill warning (dialog_button_clicked_cb): Use G_TYPE_STRING (dialog_button_clicked_cb): Use GtkDialog + (left_handed_toggle_cb): Do not crash on NULL value Tue Jan 8 15:47:24 2002 Jonathan Blandford diff --git a/capplets/mouse/gnome-mouse-properties.c b/capplets/mouse/gnome-mouse-properties.c index 1e306c760..ae9a9f393 100644 --- a/capplets/mouse/gnome-mouse-properties.c +++ b/capplets/mouse/gnome-mouse-properties.c @@ -267,7 +267,7 @@ drawing_area_expose_event (GtkWidget *widget, static void left_handed_toggle_cb (GConfPropertyEditor *peditor, const gchar *key, const GConfValue *value, GtkWidget *image) { - if (gconf_value_get_bool (value)) + if (value && gconf_value_get_bool (value)) g_object_set (G_OBJECT (image), "pixbuf", left_handed_pixbuf, NULL); diff --git a/libbackground/ChangeLog b/libbackground/ChangeLog index 716a9ff51..c0fbe0a69 100644 --- a/libbackground/ChangeLog +++ b/libbackground/ChangeLog @@ -1,5 +1,8 @@ 2002-02-04 Lauris Kaplinski + * preferences.c (read_wptype_from_string): Do not crash on NULL + (read_orientation_from_string): Ditto + * applier.c (bg_applier_dispose): Replace deprecated methods (draw_disabled_message): Use gtk_image instead of gtk_pixmap, replace deprecated methods diff --git a/libbackground/preferences.c b/libbackground/preferences.c index ba1235c97..90f6f7665 100644 --- a/libbackground/preferences.c +++ b/libbackground/preferences.c @@ -271,22 +271,22 @@ bg_preferences_merge_entry (BGPreferences *prefs, static wallpaper_type_t read_wptype_from_string (gchar *string) { - wallpaper_type_t type; + wallpaper_type_t type = -1; - if (!strncmp (string, "wallpaper", sizeof ("wallpaper"))) { - type = WPTYPE_TILED; - } else if (!strncmp (string, "centered", sizeof ("centered"))) { - type = WPTYPE_CENTERED; - } else if (!strncmp (string, "scaled", sizeof ("scaled"))) { - type = WPTYPE_SCALED; - } else if (!strncmp (string, "stretched", sizeof ("stretched"))) { - type = WPTYPE_STRETCHED; - } else if (!strncmp (string, "embossed", sizeof ("embossed"))) { - type = WPTYPE_EMBOSSED; - } else { - type = -1; + if (string) { + if (!strncmp (string, "wallpaper", sizeof ("wallpaper"))) { + type = WPTYPE_TILED; + } else if (!strncmp (string, "centered", sizeof ("centered"))) { + type = WPTYPE_CENTERED; + } else if (!strncmp (string, "scaled", sizeof ("scaled"))) { + type = WPTYPE_SCALED; + } else if (!strncmp (string, "stretched", sizeof ("stretched"))) { + type = WPTYPE_STRETCHED; + } else if (!strncmp (string, "embossed", sizeof ("embossed"))) { + type = WPTYPE_EMBOSSED; + } + g_free (string); } - g_free (string); return type; } @@ -294,17 +294,17 @@ read_wptype_from_string (gchar *string) static orientation_t read_orientation_from_string (gchar *string) { - orientation_t type; + orientation_t type = ORIENTATION_SOLID; - if (!strncmp (string, "vertical-gradient", sizeof ("vertical-gradient"))) { - type = ORIENTATION_VERT; - } else if (!strncmp (string, "horizontal-gradient", sizeof ("horizontal-gradient"))) { - type = ORIENTATION_HORIZ; - } else { - type = ORIENTATION_SOLID; + if (string) { + if (!strncmp (string, "vertical-gradient", sizeof ("vertical-gradient"))) { + type = ORIENTATION_VERT; + } else if (!strncmp (string, "horizontal-gradient", sizeof ("horizontal-gradient"))) { + type = ORIENTATION_HORIZ; + } + g_free (string); } - g_free (string); return type; }