From edd11358f3f0cd089a5c993743414563948764c5 Mon Sep 17 00:00:00 2001 From: "Nickolay V. Shmyrev" Date: Sat, 21 Jan 2006 19:17:11 +0000 Subject: [PATCH] Save last uri in file chooser dialog. Fix for the bug #327950. * shell/ev-application.c: (ev_application_shutdown), (ev_application_set_chooser_uri), (ev_application_get_chooser_uri): * shell/ev-application.h: * shell/ev-window.c: (file_open_dialog_response_cb), (ev_window_cmd_file_open): Save last uri in file chooser dialog. Fix for the bug #327950. --- ChangeLog | 10 ++++++++++ shell/ev-application.c | 12 ++++++++++++ shell/ev-application.h | 5 +++++ shell/ev-window.c | 7 ++++++- 4 files changed, 33 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index ac98d2b1..12d56595 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2006-01-21 Nickolay V. Shmyrev + + * shell/ev-application.c: (ev_application_shutdown), + (ev_application_set_chooser_uri), (ev_application_get_chooser_uri): + * shell/ev-application.h: + * shell/ev-window.c: (file_open_dialog_response_cb), + (ev_window_cmd_file_open): + + Save last uri in file chooser dialog. Fix for the bug #327950. + 2006-01-20 Nickolay V. Shmyrev * NEWS: diff --git a/shell/ev-application.c b/shell/ev-application.c index e633ce43..8802f68a 100644 --- a/shell/ev-application.c +++ b/shell/ev-application.c @@ -304,7 +304,9 @@ ev_application_shutdown (EvApplication *application) application->recent_model = NULL; } + g_free (application->last_chooser_uri); g_object_unref (application); + gtk_main_quit (); } @@ -376,4 +378,14 @@ void ev_application_save_toolbars_model (EvApplication *application) application->toolbars_file, "1.0"); } +void ev_application_set_chooser_uri (EvApplication *application, gchar *uri) +{ + g_free (application->last_chooser_uri); + application->last_chooser_uri = g_strdup (uri); +} + +const gchar* ev_application_get_chooser_uri (EvApplication *application) +{ + return application->last_chooser_uri; +} diff --git a/shell/ev-application.h b/shell/ev-application.h index 8dcd2f7c..bad967da 100644 --- a/shell/ev-application.h +++ b/shell/ev-application.h @@ -53,6 +53,8 @@ struct _EvApplication { EggToolbarsModel *toolbars_model; EggRecentModel *recent_model; + + gchar *last_chooser_uri; }; struct _EvApplicationClass { @@ -81,6 +83,9 @@ GList *ev_application_get_windows (EvApplication *application); EggToolbarsModel *ev_application_get_toolbars_model (EvApplication *application); void ev_application_save_toolbars_model (EvApplication *application); EggRecentModel *ev_application_get_recent_model (EvApplication *application); +void ev_application_set_chooser_uri (EvApplication *application, + gchar *uri); +const gchar *ev_application_get_chooser_uri (EvApplication *application); G_END_DECLS diff --git a/shell/ev-window.c b/shell/ev-window.c index 7e6a1bc9..a3a4457d 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -1093,6 +1093,8 @@ file_open_dialog_response_cb (GtkWidget *chooser, g_slist_foreach (uris, (GFunc)g_free, NULL); g_slist_free (uris); } + ev_application_set_chooser_uri (EV_APP, + gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (chooser))); gtk_widget_destroy (chooser); } @@ -1113,7 +1115,10 @@ ev_window_cmd_file_open (GtkAction *action, EvWindow *window) ev_document_types_add_filters (chooser, NULL); gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER (chooser), TRUE); gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (chooser), FALSE); - + if (ev_application_get_chooser_uri (EV_APP) != NULL) + gtk_file_chooser_set_uri (GTK_FILE_CHOOSER (chooser), + ev_application_get_chooser_uri (EV_APP)); + g_signal_connect (chooser, "response", G_CALLBACK (file_open_dialog_response_cb), window); -- 2.43.5