[gedit] Window: add GtkFileChooserAction params to *_file_chooser_folder_uri()
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] Window: add GtkFileChooserAction params to *_file_chooser_folder_uri()
- Date: Sun, 7 Jun 2020 02:07:12 +0000 (UTC)
commit 94c89f3a822a7aa277824777c65fd36a25ab39c9
Author: Sébastien Wilmet <swilmet gnome org>
Date: Sun Jun 7 03:23:52 2020 +0200
Window: add GtkFileChooserAction params to *_file_chooser_folder_uri()
Just add the params, a later commit will use them.
gedit/gedit-commands-file.c | 11 +++++++----
gedit/gedit-window.c | 12 +++++++++---
gedit/gedit-window.h | 8 +++++---
3 files changed, 21 insertions(+), 10 deletions(-)
---
diff --git a/gedit/gedit-commands-file.c b/gedit/gedit-commands-file.c
index 50e6d6eea..e786327eb 100644
--- a/gedit/gedit-commands-file.c
+++ b/gedit/gedit-commands-file.c
@@ -394,7 +394,7 @@ file_chooser_open_done_cb (GeditFileChooserOpen *file_chooser,
}
/* Remember the folder we navigated to. */
- _gedit_window_set_file_chooser_folder_uri (window, folder_uri);
+ _gedit_window_set_file_chooser_folder_uri (window, GTK_FILE_CHOOSER_ACTION_OPEN, folder_uri);
g_free (folder_uri);
loaded_documents = gedit_commands_load_locations (window, files, encoding, 0, 0);
@@ -426,7 +426,7 @@ _gedit_cmd_file_open (GSimpleAction *action,
_gedit_file_chooser_open_set_transient_for (file_chooser, GTK_WINDOW (window));
- folder_uri = _gedit_window_get_file_chooser_folder_uri (window);
+ folder_uri = _gedit_window_get_file_chooser_folder_uri (window, GTK_FILE_CHOOSER_ACTION_OPEN);
if (folder_uri != NULL)
{
_gedit_file_chooser_open_set_current_folder_uri (file_chooser, folder_uri);
@@ -693,7 +693,9 @@ save_dialog_response_cb (GeditFileChooserDialog *dialog,
gchar *folder_uri;
folder_uri = g_file_get_uri (folder);
- _gedit_window_set_file_chooser_folder_uri (window, folder_uri);
+ _gedit_window_set_file_chooser_folder_uri (window,
+ GTK_FILE_CHOOSER_ACTION_SAVE,
+ folder_uri);
g_object_unref (folder);
g_free (folder_uri);
@@ -827,7 +829,8 @@ save_as_tab_async (GeditTab *tab,
GFile *default_folder;
gchar *docname;
- default_folder_uri = _gedit_window_get_file_chooser_folder_uri (window);
+ default_folder_uri = _gedit_window_get_file_chooser_folder_uri (window,
+ GTK_FILE_CHOOSER_ACTION_SAVE);
if (default_folder_uri != NULL)
{
default_folder = g_file_new_for_uri (default_folder_uri);
diff --git a/gedit/gedit-window.c b/gedit/gedit-window.c
index 295563237..747f29d9e 100644
--- a/gedit/gedit-window.c
+++ b/gedit/gedit-window.c
@@ -3381,18 +3381,24 @@ gedit_window_get_state (GeditWindow *window)
}
const gchar *
-_gedit_window_get_file_chooser_folder_uri (GeditWindow *window)
+_gedit_window_get_file_chooser_folder_uri (GeditWindow *window,
+ GtkFileChooserAction action)
{
g_return_val_if_fail (GEDIT_IS_WINDOW (window), NULL);
+ g_return_val_if_fail ((action == GTK_FILE_CHOOSER_ACTION_OPEN) ||
+ (action == GTK_FILE_CHOOSER_ACTION_SAVE), NULL);
return window->priv->file_chooser_folder_uri;
}
void
-_gedit_window_set_file_chooser_folder_uri (GeditWindow *window,
- const gchar *folder_uri)
+_gedit_window_set_file_chooser_folder_uri (GeditWindow *window,
+ GtkFileChooserAction action,
+ const gchar *folder_uri)
{
g_return_if_fail (GEDIT_IS_WINDOW (window));
+ g_return_if_fail ((action == GTK_FILE_CHOOSER_ACTION_OPEN) ||
+ (action == GTK_FILE_CHOOSER_ACTION_SAVE));
g_free (window->priv->file_chooser_folder_uri);
window->priv->file_chooser_folder_uri = g_strdup (folder_uri);
diff --git a/gedit/gedit-window.h b/gedit/gedit-window.h
index 4a05992cf..74195c1a5 100644
--- a/gedit/gedit-window.h
+++ b/gedit/gedit-window.h
@@ -153,11 +153,13 @@ void _gedit_window_move_tab_to_new_tab_group(GeditWindow *wi
gboolean _gedit_window_is_removing_tabs (GeditWindow *window);
const gchar *_gedit_window_get_file_chooser_folder_uri
- (GeditWindow *window);
+ (GeditWindow *window,
+ GtkFileChooserAction action);
void _gedit_window_set_file_chooser_folder_uri
- (GeditWindow *window,
- const gchar *folder_uri);
+ (GeditWindow *window,
+ GtkFileChooserAction action,
+ const gchar *folder_uri);
void _gedit_window_fullscreen (GeditWindow *window);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]