[gnome-disk-utility] Handle gtk_file_chooser_get_current_folder_uri() returning NULL
- From: David Zeuthen <davidz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-disk-utility] Handle gtk_file_chooser_get_current_folder_uri() returning NULL
- Date: Thu, 23 Aug 2012 17:09:22 +0000 (UTC)
commit 3feb41efd0412e7df1d6bff47699bfec19ac4e4a
Author: David Zeuthen <zeuthen gmail com>
Date: Thu Aug 23 13:08:51 2012 -0400
Handle gtk_file_chooser_get_current_folder_uri() returning NULL
Signed-off-by: David Zeuthen <zeuthen gmail com>
src/libgdu/gduutils.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/libgdu/gduutils.c b/src/libgdu/gduutils.c
index 263576a..b072e16 100644
--- a/src/libgdu/gduutils.c
+++ b/src/libgdu/gduutils.c
@@ -68,7 +68,7 @@ gdu_utils_configure_file_chooser_for_disk_images (GtkFileChooser *file_chooser,
gtk_file_chooser_set_local_only (file_chooser, FALSE);
- /* Get folder from GSettings, and default to the "Documents" folder */
+ /* Get folder from GSettings, and default to the "Documents" folder if not set */
settings = g_settings_new ("org.gnome.Disks");
folder = g_settings_get_string (settings, "image-dir-uri");
if (folder == NULL || strlen (folder) == 0)
@@ -107,7 +107,11 @@ gdu_utils_file_chooser_for_disk_images_update_settings (GtkFileChooser *file_cho
orig_folder = g_object_get_data (G_OBJECT (file_chooser), "x-gdu-orig-folder");
cur_folder = gtk_file_chooser_get_current_folder_uri (file_chooser);
- if (g_strcmp0 (orig_folder, cur_folder) != 0)
+ /* NOTE: cur_folder may be NULL if e.g. something in "Search" or
+ * "Recently Used" is selected... in that case, do not update
+ * the GSetting
+ */
+ if (cur_folder != NULL && g_strcmp0 (orig_folder, cur_folder) != 0)
{
GSettings *settings = g_settings_new ("org.gnome.Disks");
g_settings_set_string (settings, "image-dir-uri", cur_folder);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]