$NetBSD: patch-ac,v 1.3 2015/08/25 07:13:03 richard Exp $ --- src/sj-main.c.orig 2010-08-04 13:35:35.000000000 +0000 +++ src/sj-main.c @@ -673,11 +673,11 @@ AlbumDetails* multiple_album_dialog(GLis */ static void baseuri_changed_cb (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer user_data) { - g_assert (strcmp (entry->key, GCONF_BASEURI) == 0); + g_assert (!entry || strcmp (entry->key, GCONF_BASEURI) == 0); if (base_uri) { g_object_unref (base_uri); } - if (entry->value == NULL) { + if (!entry || entry->value == NULL) { base_uri = sj_get_default_music_directory (); } else { base_uri = g_file_new_for_uri (gconf_value_get_string (entry->value)); @@ -690,8 +690,8 @@ static void baseuri_changed_cb (GConfCli */ static void path_pattern_changed_cb (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer user_data) { - g_assert (strcmp (entry->key, GCONF_PATH_PATTERN) == 0); - if (entry->value == NULL) { + g_assert (!entry || strcmp (entry->key, GCONF_PATH_PATTERN) == 0); + if (!entry || entry->value == NULL) { /* TODO: this value and the value in sj-prefs need to be in one place */ path_pattern = g_strdup ("%aa/%at"); } else { @@ -705,8 +705,8 @@ static void path_pattern_changed_cb (GCo */ static void file_pattern_changed_cb (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer user_data) { - g_assert (strcmp (entry->key, GCONF_FILE_PATTERN) == 0); - if (entry->value == NULL) { + g_assert (!entry || strcmp (entry->key, GCONF_FILE_PATTERN) == 0); + if (!entry || entry->value == NULL) { /* TODO: this value and the value in sj-prefs need to be in one place */ file_pattern = g_strdup ("%tN-%tt"); } else { @@ -720,8 +720,8 @@ static void file_pattern_changed_cb (GCo */ static void paranoia_changed_cb (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer user_data) { - g_assert (strcmp (entry->key, GCONF_PARANOIA) == 0); - if (entry->value == NULL) { + g_assert (!entry || strcmp (entry->key, GCONF_PARANOIA) == 0); + if (!entry || entry->value == NULL) { sj_extractor_set_paranoia (extractor, DEFAULT_PARANOIA); } else { int value = gconf_value_get_int (entry->value); @@ -736,8 +736,8 @@ static void paranoia_changed_cb (GConfCl */ static void strip_changed_cb (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer user_data) { - g_assert (strcmp (entry->key, GCONF_STRIP) == 0); - if (entry->value == NULL) { + g_assert (!entry || strcmp (entry->key, GCONF_STRIP) == 0); + if (!entry || entry->value == NULL) { strip_chars = FALSE; } else { strip_chars = gconf_value_get_bool (entry->value); @@ -749,8 +749,8 @@ static void strip_changed_cb (GConfClien */ static void eject_changed_cb (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer user_data) { - g_assert (strcmp (entry->key, GCONF_EJECT) == 0); - if (entry->value == NULL) { + g_assert (!entry || strcmp (entry->key, GCONF_EJECT) == 0); + if (!entry || entry->value == NULL) { eject_finished = FALSE; } else { eject_finished = gconf_value_get_bool (entry->value); @@ -762,8 +762,8 @@ static void eject_changed_cb (GConfClien */ static void open_changed_cb (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer user_data) { - g_assert (strcmp (entry->key, GCONF_OPEN) == 0); - if (entry->value == NULL) { + g_assert (!entry || strcmp (entry->key, GCONF_OPEN) == 0); + if (!entry || entry->value == NULL) { open_finished = FALSE; } else { open_finished = gconf_value_get_bool (entry->value); @@ -775,10 +775,10 @@ static void open_changed_cb (GConfClient */ static void audio_volume_changed_cb (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer user_data) { - g_assert (strcmp (entry->key, GCONF_AUDIO_VOLUME) == 0); + g_assert (!entry || strcmp (entry->key, GCONF_AUDIO_VOLUME) == 0); GtkWidget *volb = GET_WIDGET ("volume_button"); - if (entry->value == NULL) { + if (!entry || entry->value == NULL) { gtk_scale_button_set_value (GTK_SCALE_BUTTON (volb), 1.0); } else { gtk_scale_button_set_value (GTK_SCALE_BUTTON (volb), gconf_value_get_float (entry->value)); @@ -1099,9 +1099,9 @@ static void device_changed_cb (GConfClie { const char *device; gboolean ignore_no_media = GPOINTER_TO_INT (user_data); - g_assert (strcmp (entry->key, GCONF_DEVICE) == 0); + g_assert (!entry || strcmp (entry->key, GCONF_DEVICE) == 0); - if (entry->value == NULL || !cd_drive_exists (gconf_value_get_string (entry->value))) { + if (!entry || entry->value == NULL || !cd_drive_exists (gconf_value_get_string (entry->value))) { device = prefs_get_default_device(); if (device == NULL) { #ifndef IGNORE_MISSING_CD @@ -1128,8 +1128,8 @@ static void profile_changed_cb (GConfCli { GMAudioProfile *profile; - g_assert (strcmp (entry->key, GCONF_AUDIO_PROFILE) == 0); - if (!entry->value) return; + g_assert (!entry || strcmp (entry->key, GCONF_AUDIO_PROFILE) == 0); + if (!entry || !entry->value) return; profile = gm_audio_profile_lookup (gconf_value_get_string (entry->value)); if (profile != NULL) g_object_set (extractor, "profile", profile, NULL); @@ -1181,8 +1181,8 @@ http_proxy_setup (GConfClient *client) */ static void http_proxy_enable_changed_cb (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer user_data) { - g_assert (strcmp (entry->key, GCONF_HTTP_PROXY_ENABLE) == 0); - if (entry->value == NULL) return; + g_assert (!entry || strcmp (entry->key, GCONF_HTTP_PROXY_ENABLE) == 0); + if (!entry || entry->value == NULL) return; http_proxy_setup (client); } @@ -1191,8 +1191,8 @@ static void http_proxy_enable_changed_cb */ static void http_proxy_changed_cb (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer user_data) { - g_assert (strcmp (entry->key, GCONF_HTTP_PROXY) == 0); - if (entry->value == NULL) return; + g_assert (!entry || strcmp (entry->key, GCONF_HTTP_PROXY) == 0); + if (!entry || entry->value == NULL) return; http_proxy_setup (client); } @@ -1201,8 +1201,8 @@ static void http_proxy_changed_cb (GConf */ static void http_proxy_port_changed_cb (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer user_data) { - g_assert (strcmp (entry->key, GCONF_HTTP_PROXY_PORT) == 0); - if (entry->value == NULL) return; + g_assert (!entry || strcmp (entry->key, GCONF_HTTP_PROXY_PORT) == 0); + if (!entry || entry->value == NULL) return; http_proxy_setup (client); } @@ -1404,7 +1404,8 @@ G_MODULE_EXPORT void on_artist_edit_chan if (current_album->artist) { former_album_artist = current_album->artist; - } + } else + former_album_artist = g_strdup(""); current_album->artist = gtk_editable_get_chars (widget, 0, -1); /* get all the characters */ if (!gtk_tree_model_get_iter_first (GTK_TREE_MODEL (track_store), &iter)) {