diff options
author | raveit65 <[email protected]> | 2016-05-07 17:18:49 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2016-05-26 16:15:22 +0200 |
commit | fb156ec21432f792bc7ab630db74efe60d57c1e5 (patch) | |
tree | 8ea6af767cbd69ce4b71734158744668671c226e | |
parent | 44f6596da2c037ba370ef5b3f95d4f3473bd5ad0 (diff) | |
download | atril-fb156ec21432f792bc7ab630db74efe60d57c1e5.tar.bz2 atril-fb156ec21432f792bc7ab630db74efe60d57c1e5.tar.xz |
shell: Do not save file chooser open/save uri
It doesn't make sense anymore since we have multiple processes.
taken from:
https://git.gnome.org/browse/evince/commit/shell/ev-window.c?h=gnome-3-2&id=3df6a61
-rw-r--r-- | shell/ev-application.c | 36 | ||||
-rw-r--r-- | shell/ev-application.h | 6 | ||||
-rw-r--r-- | shell/ev-window.c | 40 |
3 files changed, 6 insertions, 76 deletions
diff --git a/shell/ev-application.c b/shell/ev-application.c index 5d24d7a4..c008f57c 100644 --- a/shell/ev-application.c +++ b/shell/ev-application.c @@ -62,9 +62,6 @@ struct _EvApplication { TotemScrsaver *scr_saver; EggSMClient *smclient; - - gchar *filechooser_open_uri; - gchar *filechooser_save_uri; }; struct _EvApplicationClass { @@ -938,10 +935,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; @@ -1077,35 +1070,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 22369253..4724148e 100644 --- a/shell/ev-application.h +++ b/shell/ev-application.h @@ -70,12 +70,6 @@ gboolean ev_application_has_window (EvApplication *application); guint ev_application_get_n_windows (EvApplication *application); 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 180ce3a5..64896b63 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -2481,7 +2481,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)); @@ -2492,11 +2491,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); @@ -2506,7 +2500,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"), @@ -2521,8 +2515,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); @@ -2972,7 +2965,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); @@ -2980,19 +2972,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 @@ -3017,7 +2996,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"), @@ -3039,16 +3018,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); |