[evince] shell: Do not save file chooser open/save uri



commit 3df6a6169f11c11a04069e0017d7fedc18b6ef57
Author: Carlos Garcia Campos <carlosgc gnome org>
Date:   Mon Aug 29 15:56:25 2011 +0200

    shell: Do not save file chooser open/save uri
    
    It doesn't make sense anymore since we have multiple processes.

 shell/ev-application.c |   36 ------------------------------------
 shell/ev-application.h |    5 -----
 shell/ev-window.c      |   42 ++++++------------------------------------
 3 files changed, 6 insertions(+), 77 deletions(-)
---
diff --git a/shell/ev-application.c b/shell/ev-application.c
index 600880a..6e61721 100644
--- a/shell/ev-application.c
+++ b/shell/ev-application.c
@@ -69,9 +69,6 @@ struct _EvApplication {
 #ifdef WITH_SMCLIENT
 	EggSMClient *smclient;
 #endif
-
-	gchar *filechooser_open_uri;
-	gchar *filechooser_save_uri;
 };
 
 struct _EvApplicationClass {
@@ -1050,10 +1047,6 @@ ev_application_shutdown (EvApplication *application)
         application->dot_dir = NULL;
         g_free (application->data_dir);
         application->data_dir = NULL;
-	g_free (application->filechooser_open_uri);
-        application->filechooser_open_uri = NULL;
-	g_free (application->filechooser_save_uri);
-	application->filechooser_save_uri = NULL;
 
 	g_object_unref (application);
         instance = NULL;
@@ -1194,35 +1187,6 @@ ev_application_get_media_keys (EvApplication *application)
 }
 
 void
-ev_application_set_filechooser_uri (EvApplication       *application,
-				    GtkFileChooserAction action,
-				    const gchar         *uri)
-{
-	if (action == GTK_FILE_CHOOSER_ACTION_OPEN) {
-		g_free (application->filechooser_open_uri);
-		application->filechooser_open_uri = g_strdup (uri);
-	} else if (action == GTK_FILE_CHOOSER_ACTION_SAVE) {
-		g_free (application->filechooser_save_uri);
-		application->filechooser_save_uri = g_strdup (uri);
-	}
-}
-
-const gchar *
-ev_application_get_filechooser_uri (EvApplication       *application,
-				    GtkFileChooserAction action)
-{
-	if (action == GTK_FILE_CHOOSER_ACTION_OPEN) {
-		if (application->filechooser_open_uri)
-			return application->filechooser_open_uri;
-	} else if (action == GTK_FILE_CHOOSER_ACTION_SAVE) {
-		if (application->filechooser_save_uri)
-			return application->filechooser_save_uri;
-	}
-
-	return NULL;
-}
-
-void
 ev_application_screensaver_enable (EvApplication *application)
 {
 	totem_scrsaver_enable (application->scr_saver);
diff --git a/shell/ev-application.h b/shell/ev-application.h
index c00b554..4f767e8 100644
--- a/shell/ev-application.h
+++ b/shell/ev-application.h
@@ -71,11 +71,6 @@ guint             ev_application_get_n_windows       (EvApplication   *applicati
 const gchar *     ev_application_get_uri             (EvApplication   *application);
 GObject		 *ev_application_get_media_keys	     (EvApplication   *application);
 
-void 		  ev_application_set_filechooser_uri (EvApplication   *application,
-						      GtkFileChooserAction action,
-						      const gchar     *uri);
-const gchar	 *ev_application_get_filechooser_uri (EvApplication   *application,
-						      GtkFileChooserAction action);
 void		  ev_application_screensaver_enable  (EvApplication   *application);
 void		  ev_application_screensaver_disable (EvApplication   *application);
 const gchar      *ev_application_get_dot_dir         (EvApplication   *application,
diff --git a/shell/ev-window.c b/shell/ev-window.c
index 4cd3f58..e0888eb 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -2386,7 +2386,6 @@ file_open_dialog_response_cb (GtkWidget *chooser,
 {
 	if (response_id == GTK_RESPONSE_OK) {
 		GSList *uris;
-		gchar  *uri;
 
 		uris = gtk_file_chooser_get_uris (GTK_FILE_CHOOSER (chooser));
 
@@ -2396,12 +2395,6 @@ file_open_dialog_response_cb (GtkWidget *chooser,
 
 		g_slist_foreach (uris, (GFunc)g_free, NULL);
 		g_slist_free (uris);
-
-		uri = gtk_file_chooser_get_current_folder_uri (GTK_FILE_CHOOSER (chooser));
-		ev_application_set_filechooser_uri (EV_APP,
-						    GTK_FILE_CHOOSER_ACTION_OPEN,
-						    uri);
-		g_free (uri);
 	}
 
 	gtk_widget_destroy (chooser);
@@ -2411,7 +2404,7 @@ static void
 ev_window_cmd_file_open (GtkAction *action, EvWindow *window)
 {
 	GtkWidget   *chooser;
-	const gchar *default_uri;
+	const gchar *default_uri = NULL;
 	gchar       *parent_uri = NULL;
 
 	chooser = gtk_file_chooser_dialog_new (_("Open Document"),
@@ -2426,8 +2419,7 @@ ev_window_cmd_file_open (GtkAction *action, EvWindow *window)
 	gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER (chooser), TRUE);
 	gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (chooser), FALSE);
 
-	default_uri = ev_application_get_filechooser_uri (EV_APP, GTK_FILE_CHOOSER_ACTION_OPEN);
-	if (!default_uri && window->priv->uri) {
+	if (window->priv->uri) {
 		GFile *file, *parent;
 
 		file = g_file_new_for_uri (window->priv->uri);
@@ -2877,7 +2869,6 @@ file_save_dialog_response_cb (GtkWidget *fc,
 			      EvWindow  *ev_window)
 {
 	gchar *uri;
-	GFile *file, *parent;
 
 	if (response_id != GTK_RESPONSE_OK) {
 		gtk_widget_destroy (fc);
@@ -2885,19 +2876,6 @@ file_save_dialog_response_cb (GtkWidget *fc,
 	}
 
 	uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (fc));
-	file = g_file_new_for_uri (uri);
-	parent = g_file_get_parent (file);
-	g_object_unref (file);
-	if (parent) {
-		gchar *folder_uri;
-
-		folder_uri = g_file_get_uri (parent);
-		ev_application_set_filechooser_uri (EV_APP,
-						    GTK_FILE_CHOOSER_ACTION_SAVE,
-						    folder_uri);
-		g_free (folder_uri);
-		g_object_unref (parent);
-	}
 
 	/* FIXME: remote copy should be done here rather than in the save job, 
 	 * so that we can track progress and cancel the operation
@@ -2922,7 +2900,7 @@ ev_window_cmd_save_as (GtkAction *action, EvWindow *ev_window)
 	GtkWidget *fc;
 	gchar *base_name;
 	GFile *file;
-	const gchar *default_uri;
+	const gchar *folder;
 
 	fc = gtk_file_chooser_dialog_new (
 		_("Save a Copy"),
@@ -2944,17 +2922,9 @@ ev_window_cmd_save_as (GtkAction *action, EvWindow *ev_window)
 	base_name = g_file_get_basename (file);
 	gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (fc), base_name);
 
-	default_uri = ev_application_get_filechooser_uri (EV_APP, GTK_FILE_CHOOSER_ACTION_SAVE);
-	if (default_uri) {
-		gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (fc), default_uri);
-	} else {
-		const gchar *folder;
-
-		folder = g_get_user_special_dir (G_USER_DIRECTORY_DOCUMENTS);
-		gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (fc),
-						     folder ? folder : g_get_home_dir ());
-	}
-
+	folder = g_get_user_special_dir (G_USER_DIRECTORY_DOCUMENTS);
+	gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (fc),
+					     folder ? folder : g_get_home_dir ());
 	g_object_unref (file);
 	g_free (base_name);
 



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