[gedit] File choosers: always setup filters
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] File choosers: always setup filters
- Date: Sat, 13 Jun 2020 21:04:52 +0000 (UTC)
commit 518a51e6d800a684b4fb0d43164828ffa064ab52
Author: Sébastien Wilmet <swilmet gnome org>
Date: Thu Jun 11 18:34:59 2020 +0200
File choosers: always setup filters
gedit/gedit-file-chooser-dialog-gtk.c | 2 -
gedit/gedit-file-chooser-open.c | 1 -
gedit/gedit-file-chooser.c | 88 +++++++++++++++++------------------
gedit/gedit-file-chooser.h | 3 --
4 files changed, 44 insertions(+), 50 deletions(-)
---
diff --git a/gedit/gedit-file-chooser-dialog-gtk.c b/gedit/gedit-file-chooser-dialog-gtk.c
index c26810e9c..4b8b4dbb0 100644
--- a/gedit/gedit-file-chooser-dialog-gtk.c
+++ b/gedit/gedit-file-chooser-dialog-gtk.c
@@ -449,8 +449,6 @@ gedit_file_chooser_dialog_gtk_create (const gchar *title,
_gedit_file_chooser_set_gtk_file_chooser (result->gedit_file_chooser,
GTK_FILE_CHOOSER (result));
- _gedit_file_chooser_setup_filters (result->gedit_file_chooser);
-
if (parent != NULL)
{
gtk_window_set_transient_for (GTK_WINDOW (result), parent);
diff --git a/gedit/gedit-file-chooser-open.c b/gedit/gedit-file-chooser-open.c
index 792f1ee0b..acfa8ae20 100644
--- a/gedit/gedit-file-chooser-open.c
+++ b/gedit/gedit-file-chooser-open.c
@@ -112,7 +112,6 @@ _gedit_file_chooser_open_init (GeditFileChooserOpen *chooser)
_gedit_file_chooser_set_gtk_file_chooser (GEDIT_FILE_CHOOSER (chooser),
GTK_FILE_CHOOSER (chooser->priv->chooser_native));
- _gedit_file_chooser_setup_filters (GEDIT_FILE_CHOOSER (chooser));
g_signal_connect (chooser->priv->chooser_native,
"response",
diff --git a/gedit/gedit-file-chooser.c b/gedit/gedit-file-chooser.c
index 558bcb496..93a9f83de 100644
--- a/gedit/gedit-file-chooser.c
+++ b/gedit/gedit-file-chooser.c
@@ -511,56 +511,13 @@ notify_filter_cb (GtkFileChooser *gtk_chooser,
}
static void
-_gedit_file_chooser_dispose (GObject *object)
-{
- GeditFileChooser *chooser = GEDIT_FILE_CHOOSER (object);
-
- g_clear_object (&chooser->priv->gtk_chooser);
-
- G_OBJECT_CLASS (_gedit_file_chooser_parent_class)->dispose (object);
-}
-
-static void
-_gedit_file_chooser_class_init (GeditFileChooserClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->dispose = _gedit_file_chooser_dispose;
-}
-
-static void
-_gedit_file_chooser_init (GeditFileChooser *chooser)
-{
- chooser->priv = _gedit_file_chooser_get_instance_private (chooser);
-}
-
-GeditFileChooser *
-_gedit_file_chooser_new (void)
-{
- return g_object_new (GEDIT_TYPE_FILE_CHOOSER, NULL);
-}
-
-void
-_gedit_file_chooser_set_gtk_file_chooser (GeditFileChooser *chooser,
- GtkFileChooser *gtk_chooser)
-{
- g_return_if_fail (GEDIT_IS_FILE_CHOOSER (chooser));
- g_return_if_fail (GTK_IS_FILE_CHOOSER (gtk_chooser));
-
- g_set_object (&chooser->priv->gtk_chooser, gtk_chooser);
-}
-
-void
-_gedit_file_chooser_setup_filters (GeditFileChooser *chooser)
+setup_filters (GeditFileChooser *chooser)
{
GeditSettings *settings;
GSettings *file_chooser_state_settings;
gint active_filter;
GtkFileFilter *filter;
- g_return_if_fail (GEDIT_IS_FILE_CHOOSER (chooser));
- g_return_if_fail (chooser->priv->gtk_chooser != NULL);
-
settings = _gedit_settings_get_singleton ();
file_chooser_state_settings = _gedit_settings_peek_file_chooser_state_settings (settings);
active_filter = g_settings_get_int (file_chooser_state_settings, GEDIT_SETTINGS_ACTIVE_FILE_FILTER);
@@ -596,3 +553,46 @@ _gedit_file_chooser_setup_filters (GeditFileChooser *chooser)
G_CALLBACK (notify_filter_cb),
NULL);
}
+
+static void
+_gedit_file_chooser_dispose (GObject *object)
+{
+ GeditFileChooser *chooser = GEDIT_FILE_CHOOSER (object);
+
+ g_clear_object (&chooser->priv->gtk_chooser);
+
+ G_OBJECT_CLASS (_gedit_file_chooser_parent_class)->dispose (object);
+}
+
+static void
+_gedit_file_chooser_class_init (GeditFileChooserClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->dispose = _gedit_file_chooser_dispose;
+}
+
+static void
+_gedit_file_chooser_init (GeditFileChooser *chooser)
+{
+ chooser->priv = _gedit_file_chooser_get_instance_private (chooser);
+}
+
+GeditFileChooser *
+_gedit_file_chooser_new (void)
+{
+ return g_object_new (GEDIT_TYPE_FILE_CHOOSER, NULL);
+}
+
+void
+_gedit_file_chooser_set_gtk_file_chooser (GeditFileChooser *chooser,
+ GtkFileChooser *gtk_chooser)
+{
+ g_return_if_fail (GEDIT_IS_FILE_CHOOSER (chooser));
+ g_return_if_fail (GTK_IS_FILE_CHOOSER (gtk_chooser));
+ g_return_if_fail (chooser->priv->gtk_chooser == NULL);
+
+ chooser->priv->gtk_chooser = g_object_ref (gtk_chooser);
+
+ setup_filters (chooser);
+}
diff --git a/gedit/gedit-file-chooser.h b/gedit/gedit-file-chooser.h
index 73a0f8c9a..2d3ed5f75 100644
--- a/gedit/gedit-file-chooser.h
+++ b/gedit/gedit-file-chooser.h
@@ -57,9 +57,6 @@ G_GNUC_INTERNAL
void _gedit_file_chooser_set_gtk_file_chooser (GeditFileChooser *chooser,
GtkFileChooser *gtk_chooser);
-G_GNUC_INTERNAL
-void _gedit_file_chooser_setup_filters (GeditFileChooser *chooser);
-
G_END_DECLS
#endif /* GEDIT_FILE_CHOOSER_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]