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's avatarFederico Mena Quintero <>
parent ec9bdc63
......@@ -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
......@@ -151,6 +151,11 @@ typedef enum {
} OperationMode;
typedef enum {
} StartupMode;
struct _GtkFileChooserDefault
......@@ -199,6 +204,7 @@ struct _GtkFileChooserDefault
char *browse_files_last_selected_name;
GtkWidget *places_sidebar;
StartupMode startup_mode;
GtkWidget *search_hbox;
......@@ -33,6 +33,11 @@
<value nick='descending' value='1'/>
<enum id='org.gtk.Settings.FileChooser.StartupMode'>
<value nick='recent' value='0'/>
<value nick='cwd' value='1'/>
<schema id='org.gtk.Settings.FileChooser'>
<key name='last-folder-uri' type='s'>
......@@ -61,6 +66,9 @@
<key name='window-size' type='(ii)'>
<default>(-1, -1)</default>
<key name='startup-mode' enum='org.gtk.Settings.FileChooser.StartupMode'>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment