[gtk+/places-sidebar] Add a new org.gtk.SettingsFileChooser startup-mode settings key



commit 043cac11f3ad588948e9594f3943ee7df998f71b
Author: Federico Mena Quintero <federico gnome org>
Date:   Wed Nov 21 10:28:26 2012 -0600

    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>

 gtk/gtkfilechooserdefault.c                  |    5 +++++
 gtk/gtkfilechooserprivate.h                  |    6 ++++++
 gtk/org.gtk.Settings.FileChooser.gschema.xml |    8 ++++++++
 3 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c
index 2d1923d..57a445ee 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 7be9a56..3256fd9 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 849e8ff..5bef095 100644
--- a/gtk/org.gtk.Settings.FileChooser.gschema.xml
+++ b/gtk/org.gtk.Settings.FileChooser.gschema.xml
@@ -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>



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