Don't save file dialog folder with GTK+ 3.1.10

The last used folder is restored by default.
This commit is contained in:
Christian Dywan 2011-10-10 21:49:27 +02:00
parent 2219399440
commit cb6a4290d6

View file

@ -2229,7 +2229,9 @@ static void
_action_open_activate (GtkAction* action, _action_open_activate (GtkAction* action,
MidoriBrowser* browser) MidoriBrowser* browser)
{ {
#if !GTK_CHECK_VERSION (3, 1, 10)
static gchar* last_dir = NULL; static gchar* last_dir = NULL;
#endif
gchar* uri = NULL; gchar* uri = NULL;
gboolean folder_set = FALSE; gboolean folder_set = FALSE;
GtkWidget* dialog; GtkWidget* dialog;
@ -2260,8 +2262,10 @@ _action_open_activate (GtkAction* action,
} }
} }
#if !GTK_CHECK_VERSION (3, 1, 10)
if (!folder_set && last_dir && *last_dir) if (!folder_set && last_dir && *last_dir)
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), last_dir); gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), last_dir);
#endif
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK)
{ {
@ -2270,10 +2274,11 @@ _action_open_activate (GtkAction* action,
folder = gtk_file_chooser_get_current_folder (GTK_FILE_CHOOSER (dialog)); folder = gtk_file_chooser_get_current_folder (GTK_FILE_CHOOSER (dialog));
uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (dialog)); uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (dialog));
midori_browser_set_current_uri (browser, uri); midori_browser_set_current_uri (browser, uri);
g_free (last_dir);
last_dir = folder;
g_free (uri); g_free (uri);
#if !GTK_CHECK_VERSION (3, 1, 10)
katze_assign (last_dir, folder);
#endif
} }
gtk_widget_destroy (dialog); gtk_widget_destroy (dialog);
} }