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 <federico@gnome.org>
This commit is contained in:
Federico Mena Quintero 2012-11-21 10:28:26 -06:00
parent ec9bdc6397
commit 043cac11f3
3 changed files with 19 additions and 0 deletions

View File

@ -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

View File

@ -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;

View File

@ -33,6 +33,11 @@
<value nick='descending' value='1'/>
</enum>
<enum id='org.gtk.Settings.FileChooser.StartupMode'>
<value nick='recent' value='0'/>
<value nick='cwd' value='1'/>
</enum>
<schema id='org.gtk.Settings.FileChooser'>
<key name='last-folder-uri' type='s'>
<default>""</default>
@ -61,6 +66,9 @@
<key name='window-size' type='(ii)'>
<default>(-1, -1)</default>
</key>
<key name='startup-mode' enum='org.gtk.Settings.FileChooser.StartupMode'>
<default>'recent'</default>
</key>
</schema>
</schemalist>