[eog] Bug 589151 – Let filechooser fall back to user's pictures folder



commit 80cc24682e6da921d73ca6b71d517938eaf34649
Author: Felix Riemann <friemann gnome org>
Date:   Fri Jul 24 12:31:47 2009 +0200

    Bug 589151 â?? Let filechooser fall back to user's pictures folder
    
    Add a (for now) hidden option to have the filechooser show the user's
    picture folder ($XDG_PICTURES_DIR) when no image is loaded in the
    current window. If the folder had not been set up it will fall back to
    show the currrent working directory. The option has been enabled by
    default as it seems to be useful on the average desktop system.

 ChangeLog             |    8 ++++++++
 data/eog.schemas.in   |   11 +++++++++++
 src/eog-config-keys.h |    1 +
 src/eog-window.c      |   14 ++++++++++++++
 4 files changed, 34 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 734d64e..e897bc6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2009-07-24  Felix Riemann  <friemann gnome org>
+
+	* data/eog.schemas.in:
+	* src/eog-config-keys.h:
+	* src/eog-window.c (eog_window_cmd_file_open):
+	Add and enable option to have the filechooser show the user's
+	picture folder when no image is loaded. Fixes bug #589151.
+
 2009-07-23  Claudio Saavedra  <csaavedra igalia com>
 
 	* src/eog-thumb-view.c: (eog_thumb_view_init): Do not check for
diff --git a/data/eog.schemas.in b/data/eog.schemas.in
index 7fff4c5..6f4615c 100644
--- a/data/eog.schemas.in
+++ b/data/eog.schemas.in
@@ -231,6 +231,17 @@
     </schema>
 
     <schema>
+      <key>/schemas/apps/eog/ui/filechooser_xdg_fallback</key>
+      <applyto>/apps/eog/ui/filechooser_xdg_fallback</applyto>
+      <owner>eog</owner>
+      <type>bool</type>
+      <default>1</default>
+      <locale name="C">
+        <short>Whether the filechooser should show the user's pictures folder if no images are loaded.</short>
+        <long>If activated and no image is loaded in the active window, the filechooser will display the user's pictures folder using the XDG special user directories. If deactivated or the pictures folder has not been set up it will show the current working directory</long>
+    </schema>
+
+    <schema>
       <key>/schemas/apps/eog/plugins/active_plugins</key>
       <applyto>/apps/eog/plugins/active_plugins</applyto>
       <owner>eog</owner>
diff --git a/src/eog-config-keys.h b/src/eog-config-keys.h
index f4da034..b66f797 100644
--- a/src/eog-config-keys.h
+++ b/src/eog-config-keys.h
@@ -53,6 +53,7 @@
 #define EOG_CONF_UI_SIDEBAR			"/apps/eog/ui/sidebar"
 #define EOG_CONF_UI_SCROLL_BUTTONS		"/apps/eog/ui/scroll_buttons"
 #define EOG_CONF_UI_DISABLE_TRASH_CONFIRMATION	"/apps/eog/ui/disable_trash_confirmation"
+#define EOG_CONF_UI_FILECHOOSER_XDG_FALLBACK	"/apps/eog/ui/filechooser_xdg_fallback"
 
 #define EOG_CONF_PLUGINS_ACTIVE_PLUGINS         "/apps/eog/plugins/active_plugins"
 
diff --git a/src/eog-window.c b/src/eog-window.c
index 709e4df..b9ae506 100644
--- a/src/eog-window.c
+++ b/src/eog-window.c
@@ -2365,6 +2365,20 @@ eog_window_cmd_file_open (GtkAction *action, gpointer user_data)
 		g_free (file_uri);
 		g_free (dir_uri);
 		g_object_unref (current);
+	} else {
+		/* If desired by the user,
+		   fallback to the XDG_PICTURES_DIR (if available) */
+		const gchar *pics_dir;
+		gboolean use_fallback;
+
+		use_fallback = gconf_client_get_bool (priv->client,
+					   EOG_CONF_UI_FILECHOOSER_XDG_FALLBACK,
+					   NULL);
+		pics_dir = g_get_user_special_dir (G_USER_DIRECTORY_PICTURES);
+		if (use_fallback && pics_dir) {
+			gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dlg),
+							     pics_dir);
+		}
 	}
 
 	g_signal_connect (dlg, "response",



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]