aboutsummaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2011-09-05 02:30:36 +0800
committerMatthew Barnes <mbarnes@redhat.com>2011-10-06 20:16:21 +0800
commit938505da180727fbc56b68b80851adc3cf676523 (patch)
treead0a04a23ca77922eebea9a644d12c47f922a2aa /shell
parentef05d73b0a06cfc5eaf1a74c7b5c25134d81e328 (diff)
downloadgsoc2013-evolution-938505da180727fbc56b68b80851adc3cf676523.tar
gsoc2013-evolution-938505da180727fbc56b68b80851adc3cf676523.tar.gz
gsoc2013-evolution-938505da180727fbc56b68b80851adc3cf676523.tar.bz2
gsoc2013-evolution-938505da180727fbc56b68b80851adc3cf676523.tar.lz
gsoc2013-evolution-938505da180727fbc56b68b80851adc3cf676523.tar.xz
gsoc2013-evolution-938505da180727fbc56b68b80851adc3cf676523.tar.zst
gsoc2013-evolution-938505da180727fbc56b68b80851adc3cf676523.zip
Let GtkFileChooser track its own last-used-folder.
GtkFileChooser in GTK+ 3.2 now keeps track of the last-used-folder itself, even across applications, so get out of its way and let it handle it.
Diffstat (limited to 'shell')
-rw-r--r--shell/apps_evolution_shell.schemas.in14
-rw-r--r--shell/e-shell-utils.c70
-rw-r--r--shell/e-shell.c4
3 files changed, 14 insertions, 74 deletions
diff --git a/shell/apps_evolution_shell.schemas.in b/shell/apps_evolution_shell.schemas.in
index 09c376edda..20e7af463d 100644
--- a/shell/apps_evolution_shell.schemas.in
+++ b/shell/apps_evolution_shell.schemas.in
@@ -58,20 +58,6 @@
</locale>
</schema>
- <!-- Initial GtkFileChooser Folder -->
-
- <schema>
- <key>/schemas/apps/evolution/shell/file_chooser_folder</key>
- <applyto>/apps/evolution/shell/file_chooser_folder</applyto>
- <owner>evolution</owner>
- <type>string</type>
- <default></default>
- <locale name="C">
- <short>Initial file chooser folder</short>
- <long>Initial folder for GtkFileChooser dialogs.</long>
- </locale>
- </schema>
-
<!-- Offline Mode -->
<schema>
diff --git a/shell/e-shell-utils.c b/shell/e-shell-utils.c
index 05722a0319..b5a1f490ae 100644
--- a/shell/e-shell-utils.c
+++ b/shell/e-shell-utils.c
@@ -65,11 +65,10 @@ e_shell_configure_ui_manager (EShell *shell,
* @customize_data: optional data to pass to @customize_func
*
* Runs a #GtkFileChooserDialog in open mode with the given title and
- * returns the selected #GFile. It automatically remembers the selected
- * folder. If @customize_func is provided, the function is called just
- * prior to running the dialog (the file chooser is the first argument,
- * @customize data is the second). If the user cancels the dialog the
- * function will return %NULL.
+ * returns the selected #GFile. If @customize_func is provided, the
+ * function is called just prior to running the dialog (the file chooser
+ * is the first argument, @customize data is the second). If the user
+ * cancels the dialog the function will return %NULL.
*
* Returns: the #GFile to open, or %NULL
**/
@@ -79,19 +78,13 @@ e_shell_run_open_dialog (EShell *shell,
GtkCallback customize_func,
gpointer customize_data)
{
- EShellSettings *shell_settings;
GtkFileChooser *file_chooser;
GFile *chosen_file = NULL;
GtkWidget *dialog;
GtkWindow *parent;
- const gchar *property_name;
- gchar *uri;
g_return_val_if_fail (E_IS_SHELL (shell), NULL);
- property_name = "file-chooser-folder";
- shell_settings = e_shell_get_shell_settings (shell);
-
parent = e_shell_get_active_window (shell);
dialog = gtk_file_chooser_dialog_new (
@@ -107,27 +100,13 @@ e_shell_run_open_dialog (EShell *shell,
gtk_file_chooser_set_local_only (file_chooser, FALSE);
- /* Restore the current folder from the previous file chooser. */
- uri = e_shell_settings_get_string (shell_settings, property_name);
- if (uri != NULL)
- gtk_file_chooser_set_current_folder_uri (file_chooser, uri);
- g_free (uri);
-
/* Allow further customizations before running the dialog. */
if (customize_func != NULL)
customize_func (dialog, customize_data);
- if (gtk_dialog_run (GTK_DIALOG (dialog)) != GTK_RESPONSE_ACCEPT)
- goto exit;
-
- chosen_file = gtk_file_chooser_get_file (file_chooser);
-
- /* Save the current folder for subsequent file choosers. */
- uri = gtk_file_chooser_get_current_folder_uri (file_chooser);
- e_shell_settings_set_string (shell_settings, property_name, uri);
- g_free (uri);
+ if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
+ chosen_file = gtk_file_chooser_get_file (file_chooser);
-exit:
gtk_widget_destroy (dialog);
return chosen_file;
@@ -143,16 +122,15 @@ exit:
* @customize_data: optional data to pass to @customize_func
*
* Runs a #GtkFileChooserDialog in save mode with the given title and
- * returns the selected #GFile. It automatically remembers the selected
- * folder. If @customize_func is provided, the function is called just
- * prior to running the dialog (the file chooser is the first argument,
- * @customize_data is the second). If the user cancels the dialog the
- * function will return %NULL.
+ * returns the selected #GFile. If @customize_func is provided, the
+ * function is called just prior to running the dialog (the file chooser
+ * is the first argument, @customize_data is the second). If the user
+ * cancels the dialog the function will return %NULL.
*
* With non-%NULL @filters will be added also file filters to the dialog.
* The string format is "pat1:mt1;pat2:mt2:...", where 'pat' is a pattern
- * and 'mt' is a MIME type for the pattern to be used.
- * There can be more than one MIME type, those are separated by comma.
+ * and 'mt' is a MIME type for the pattern to be used. There can be more
+ * than one MIME type, those are separated by comma.
*
* Returns: the #GFile to save to, or %NULL
**/
@@ -164,19 +142,13 @@ e_shell_run_save_dialog (EShell *shell,
GtkCallback customize_func,
gpointer customize_data)
{
- EShellSettings *shell_settings;
GtkFileChooser *file_chooser;
GFile *chosen_file = NULL;
GtkWidget *dialog;
GtkWindow *parent;
- const gchar *property_name;
- gchar *uri;
g_return_val_if_fail (E_IS_SHELL (shell), NULL);
- property_name = "file-chooser-folder";
- shell_settings = e_shell_get_shell_settings (shell);
-
parent = e_shell_get_active_window (shell);
dialog = gtk_file_chooser_dialog_new (
@@ -193,12 +165,6 @@ e_shell_run_save_dialog (EShell *shell,
gtk_file_chooser_set_local_only (file_chooser, FALSE);
gtk_file_chooser_set_do_overwrite_confirmation (file_chooser, TRUE);
- /* Restore the current folder from the previous file chooser. */
- uri = e_shell_settings_get_string (shell_settings, property_name);
- if (uri != NULL)
- gtk_file_chooser_set_current_folder_uri (file_chooser, uri);
- g_free (uri);
-
if (suggestion != NULL)
gtk_file_chooser_set_current_name (file_chooser, suggestion);
@@ -254,17 +220,9 @@ e_shell_run_save_dialog (EShell *shell,
if (customize_func != NULL)
customize_func (dialog, customize_data);
- if (gtk_dialog_run (GTK_DIALOG (dialog)) != GTK_RESPONSE_ACCEPT)
- goto exit;
-
- chosen_file = gtk_file_chooser_get_file (file_chooser);
-
- /* Save the current folder for subsequent file choosers. */
- uri = gtk_file_chooser_get_current_folder_uri (file_chooser);
- e_shell_settings_set_string (shell_settings, property_name, uri);
- g_free (uri);
+ if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
+ chosen_file = gtk_file_chooser_get_file (file_chooser);
-exit:
gtk_widget_destroy (dialog);
return chosen_file;
diff --git a/shell/e-shell.c b/shell/e-shell.c
index 8aaefd302e..a9c2fdc22f 100644
--- a/shell/e-shell.c
+++ b/shell/e-shell.c
@@ -1193,10 +1193,6 @@ e_shell_init (EShell *shell)
* otherwise the GConf bindings will not get set up. */
e_shell_settings_install_property_for_key (
- "file-chooser-folder",
- "/apps/evolution/shell/file_chooser_folder");
-
- e_shell_settings_install_property_for_key (
"start-offline",
"/apps/evolution/shell/start_offline");