From 043cac11f3ad588948e9594f3943ee7df998f71b Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Wed, 21 Nov 2012 10:28:26 -0600 Subject: [PATCH] Add a new org.gtk.SettingsFileChooser startup-mode settings key It has two possible values, 'recent' and 'cwd'. We will use these to determine whether to set the default starting mode, if a folder has not been pre-set, to showing the Recent Files list or the current working directory. Signed-off-by: Federico Mena Quintero --- gtk/gtkfilechooserdefault.c | 5 +++++ gtk/gtkfilechooserprivate.h | 6 ++++++ gtk/org.gtk.Settings.FileChooser.gschema.xml | 8 ++++++++ 3 files changed, 19 insertions(+) diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c index 2d1923d77e..57a445eed9 100644 --- a/gtk/gtkfilechooserdefault.c +++ b/gtk/gtkfilechooserdefault.c @@ -275,6 +275,7 @@ typedef enum { #define SETTINGS_KEY_SORT_ORDER "sort-order" #define SETTINGS_KEY_WINDOW_POSITION "window-position" #define SETTINGS_KEY_WINDOW_SIZE "window-size" +#define SETTINGS_KEY_STARTUP_MODE "startup-mode" static void gtk_file_chooser_default_iface_init (GtkFileChooserIface *iface); static void gtk_file_chooser_embed_default_iface_init (GtkFileChooserEmbedIface *iface); @@ -6155,6 +6156,7 @@ settings_load (GtkFileChooserDefault *impl) gboolean show_size_column; gint sort_column; GtkSortType sort_order; + StartupMode startup_mode; settings_ensure (impl); @@ -6163,6 +6165,7 @@ settings_load (GtkFileChooserDefault *impl) show_size_column = g_settings_get_boolean (impl->settings, SETTINGS_KEY_SHOW_SIZE_COLUMN); sort_column = g_settings_get_enum (impl->settings, SETTINGS_KEY_SORT_COLUMN); sort_order = g_settings_get_enum (impl->settings, SETTINGS_KEY_SORT_ORDER); + startup_mode = g_settings_get_enum (impl->settings, SETTINGS_KEY_STARTUP_MODE); location_mode_set (impl, location_mode, TRUE); @@ -6177,6 +6180,8 @@ settings_load (GtkFileChooserDefault *impl) * created yet. The individual functions that create and set the models will * call set_sort_column() themselves. */ + + impl->startup_mode = startup_mode; } static void diff --git a/gtk/gtkfilechooserprivate.h b/gtk/gtkfilechooserprivate.h index 7be9a56d60..3256fd9560 100644 --- a/gtk/gtkfilechooserprivate.h +++ b/gtk/gtkfilechooserprivate.h @@ -151,6 +151,11 @@ typedef enum { OPERATION_MODE_RECENT } OperationMode; +typedef enum { + STARTUP_MODE_RECENT, + STARTUP_MODE_CWD +} StartupMode; + #define REMOVE_FOR_PLACES_SIDEBAR 0 struct _GtkFileChooserDefault @@ -199,6 +204,7 @@ struct _GtkFileChooserDefault char *browse_files_last_selected_name; GtkWidget *places_sidebar; + StartupMode startup_mode; /* OPERATION_MODE_SEARCH */ GtkWidget *search_hbox; diff --git a/gtk/org.gtk.Settings.FileChooser.gschema.xml b/gtk/org.gtk.Settings.FileChooser.gschema.xml index 849e8ff77b..5bef095cee 100644 --- a/gtk/org.gtk.Settings.FileChooser.gschema.xml +++ b/gtk/org.gtk.Settings.FileChooser.gschema.xml @@ -33,6 +33,11 @@ + + + + + "" @@ -61,6 +66,9 @@ (-1, -1) + + 'recent' +