diff options
author | Federico Mena Quintero <federico@gnome.org> | 2012-12-10 14:23:06 -0600 |
---|---|---|
committer | Federico Mena Quintero <federico@gnome.org> | 2012-12-10 14:23:06 -0600 |
commit | e6ba6e7e06360ab2b02c54950c269d32ad5c6c3a (patch) | |
tree | b460b06f889b8cfd04fb2dfc3264ea40c9bd420c /gtk/gtkfilechooserdefault.c | |
parent | f3beff7556a256743f2d8a980f6d7d2b1cbca64e (diff) | |
download | gtk+-e6ba6e7e06360ab2b02c54950c269d32ad5c6c3a.tar.gz |
Implement the Home keyboard shortcut
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
Diffstat (limited to 'gtk/gtkfilechooserdefault.c')
-rw-r--r-- | gtk/gtkfilechooserdefault.c | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c index 7f3e745646..da6a5f0706 100644 --- a/gtk/gtkfilechooserdefault.c +++ b/gtk/gtkfilechooserdefault.c @@ -2790,6 +2790,22 @@ set_extra_widget (GtkFileChooserDefault *impl, } static void +switch_to_home_dir (GtkFileChooserDefault *impl) +{ + const gchar *home = g_get_home_dir (); + GFile *home_file; + + if (home == NULL) + return; + + home_file = g_file_new_for_path (home); + + gtk_file_chooser_set_current_folder_file (GTK_FILE_CHOOSER (impl), home_file, NULL); /* NULL-GError */ + + g_object_unref (home_file); +} + +static void set_local_only (GtkFileChooserDefault *impl, gboolean local_only) { @@ -2807,17 +2823,7 @@ set_local_only (GtkFileChooserDefault *impl, * back to a local folder, but it's really up to the app to not cause * such a situation, so we ignore errors. */ - const gchar *home = g_get_home_dir (); - GFile *home_file; - - if (home == NULL) - return; - - home_file = g_file_new_for_path (home); - - gtk_file_chooser_set_current_folder_file (GTK_FILE_CHOOSER (impl), home_file, NULL); - - g_object_unref (home_file); + switch_to_home_dir (impl); } } } @@ -7501,10 +7507,7 @@ down_folder_handler (GtkFileChooserDefault *impl) static void home_folder_handler (GtkFileChooserDefault *impl) { -#if REMOVE_FOR_PLACES_SIDEBAR - if (impl->has_home) - switch_to_shortcut (impl, shortcuts_get_index (impl, SHORTCUTS_HOME)); -#endif + switch_to_home_dir (impl); } /* Handler for the "desktop-folder" keybinding signal */ |