[gedit] File choosers: move some functions down the class hierarchy
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] File choosers: move some functions down the class hierarchy
- Date: Sat, 13 Jun 2020 21:05:42 +0000 (UTC)
commit 75656c7073e0e022e5bad763b51fd143885ce179
Author: Sébastien Wilmet <swilmet gnome org>
Date: Fri Jun 12 11:34:31 2020 +0200
File choosers: move some functions down the class hierarchy
gedit/gedit-commands-file.c | 7 ++++---
gedit/gedit-file-chooser-open.c | 26 --------------------------
gedit/gedit-file-chooser-open.h | 12 ------------
gedit/gedit-file-chooser.c | 27 ++++++++++++++++++++++++++-
gedit/gedit-file-chooser.h | 13 ++++++++++++-
5 files changed, 42 insertions(+), 43 deletions(-)
---
diff --git a/gedit/gedit-commands-file.c b/gedit/gedit-commands-file.c
index ecbbd737e..e05b96c26 100644
--- a/gedit/gedit-commands-file.c
+++ b/gedit/gedit-commands-file.c
@@ -381,8 +381,8 @@ file_chooser_open_done_cb (GeditFileChooserOpen *file_chooser,
}
files = _gedit_file_chooser_open_get_files (file_chooser);
- encoding = _gedit_file_chooser_open_get_encoding (file_chooser);
- folder_uri = _gedit_file_chooser_open_get_current_folder_uri (file_chooser);
+ encoding = _gedit_file_chooser_get_encoding (GEDIT_FILE_CHOOSER (file_chooser));
+ folder_uri = _gedit_file_chooser_get_current_folder_uri (GEDIT_FILE_CHOOSER (file_chooser));
g_object_unref (file_chooser);
if (window == NULL)
@@ -430,7 +430,8 @@ _gedit_cmd_file_open (GSimpleAction *action,
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);
+ _gedit_file_chooser_set_current_folder_uri (GEDIT_FILE_CHOOSER (file_chooser),
+ folder_uri);
}
}
diff --git a/gedit/gedit-file-chooser-open.c b/gedit/gedit-file-chooser-open.c
index 2b9d5bf5a..ae9c610cb 100644
--- a/gedit/gedit-file-chooser-open.c
+++ b/gedit/gedit-file-chooser-open.c
@@ -73,29 +73,3 @@ _gedit_file_chooser_open_get_files (GeditFileChooserOpen *chooser)
return gtk_file_chooser_get_files (get_gtk_file_chooser (chooser));
}
-
-gchar *
-_gedit_file_chooser_open_get_current_folder_uri (GeditFileChooserOpen *chooser)
-{
- g_return_val_if_fail (GEDIT_IS_FILE_CHOOSER_OPEN (chooser), NULL);
-
- return gtk_file_chooser_get_current_folder_uri (get_gtk_file_chooser (chooser));
-}
-
-void
-_gedit_file_chooser_open_set_current_folder_uri (GeditFileChooserOpen *chooser,
- const gchar *uri)
-{
- g_return_if_fail (GEDIT_IS_FILE_CHOOSER_OPEN (chooser));
-
- gtk_file_chooser_set_current_folder_uri (get_gtk_file_chooser (chooser), uri);
-}
-
-const GtkSourceEncoding *
-_gedit_file_chooser_open_get_encoding (GeditFileChooserOpen *chooser)
-{
- g_return_val_if_fail (GEDIT_IS_FILE_CHOOSER_OPEN (chooser), NULL);
-
- /* Stub */
- return NULL;
-}
diff --git a/gedit/gedit-file-chooser-open.h b/gedit/gedit-file-chooser-open.h
index 6c233c455..f150928d8 100644
--- a/gedit/gedit-file-chooser-open.h
+++ b/gedit/gedit-file-chooser-open.h
@@ -20,7 +20,6 @@
#ifndef GEDIT_FILE_CHOOSER_OPEN_H
#define GEDIT_FILE_CHOOSER_OPEN_H
-#include <gtksourceview/gtksource.h>
#include "gedit-file-chooser.h"
G_BEGIN_DECLS
@@ -57,17 +56,6 @@ GeditFileChooserOpen * _gedit_file_chooser_open_new (void);
G_GNUC_INTERNAL
GSList * _gedit_file_chooser_open_get_files (GeditFileChooserOpen *chooser);
-G_GNUC_INTERNAL
-gchar * _gedit_file_chooser_open_get_current_folder_uri (GeditFileChooserOpen
*chooser);
-
-G_GNUC_INTERNAL
-void _gedit_file_chooser_open_set_current_folder_uri (GeditFileChooserOpen *chooser,
- const gchar *uri);
-
-G_GNUC_INTERNAL
-const GtkSourceEncoding *
- _gedit_file_chooser_open_get_encoding (GeditFileChooserOpen *chooser);
-
G_END_DECLS
#endif /* GEDIT_FILE_CHOOSER_OPEN_H */
diff --git a/gedit/gedit-file-chooser.c b/gedit/gedit-file-chooser.c
index ccc0ce0b6..a69565e0d 100644
--- a/gedit/gedit-file-chooser.c
+++ b/gedit/gedit-file-chooser.c
@@ -19,7 +19,6 @@
#include "gedit-file-chooser.h"
#include <glib/gi18n.h>
-#include <gtksourceview/gtksource.h>
#include "gedit-settings.h"
/* Common code between the different GeditFileChooser's. */
@@ -720,3 +719,29 @@ _gedit_file_chooser_show (GeditFileChooser *chooser)
g_warn_if_reached ();
}
}
+
+gchar *
+_gedit_file_chooser_get_current_folder_uri (GeditFileChooser *chooser)
+{
+ g_return_val_if_fail (GEDIT_IS_FILE_CHOOSER (chooser), NULL);
+
+ return gtk_file_chooser_get_current_folder_uri (chooser->priv->gtk_chooser);
+}
+
+void
+_gedit_file_chooser_set_current_folder_uri (GeditFileChooser *chooser,
+ const gchar *uri)
+{
+ g_return_if_fail (GEDIT_IS_FILE_CHOOSER (chooser));
+
+ gtk_file_chooser_set_current_folder_uri (chooser->priv->gtk_chooser, uri);
+}
+
+const GtkSourceEncoding *
+_gedit_file_chooser_get_encoding (GeditFileChooser *chooser)
+{
+ g_return_val_if_fail (GEDIT_IS_FILE_CHOOSER (chooser), NULL);
+
+ /* Stub */
+ return NULL;
+}
diff --git a/gedit/gedit-file-chooser.h b/gedit/gedit-file-chooser.h
index c9b5e751b..ef069b918 100644
--- a/gedit/gedit-file-chooser.h
+++ b/gedit/gedit-file-chooser.h
@@ -20,7 +20,7 @@
#ifndef GEDIT_FILE_CHOOSER_H
#define GEDIT_FILE_CHOOSER_H
-#include <gtk/gtk.h>
+#include <gtksourceview/gtksource.h>
G_BEGIN_DECLS
@@ -70,6 +70,17 @@ void _gedit_file_chooser_set_transient_for (GeditFileChooser
*chooser,
G_GNUC_INTERNAL
void _gedit_file_chooser_show (GeditFileChooser *chooser);
+G_GNUC_INTERNAL
+gchar * _gedit_file_chooser_get_current_folder_uri (GeditFileChooser *chooser);
+
+G_GNUC_INTERNAL
+void _gedit_file_chooser_set_current_folder_uri (GeditFileChooser *chooser,
+ const gchar *uri);
+
+G_GNUC_INTERNAL
+const GtkSourceEncoding *
+ _gedit_file_chooser_get_encoding (GeditFileChooser *chooser);
+
G_END_DECLS
#endif /* GEDIT_FILE_CHOOSER_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]