[gedit] FileChooserDialog: remove ENABLE_DEFAULT_FILTERS flag (always set)
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] FileChooserDialog: remove ENABLE_DEFAULT_FILTERS flag (always set)
- Date: Thu, 4 Jun 2020 20:47:06 +0000 (UTC)
commit 2e47d51dacaf5b4dfbe4d9d63e21b2e2e97154f1
Author: Sébastien Wilmet <swilmet gnome org>
Date: Thu Jun 4 22:44:33 2020 +0200
FileChooserDialog: remove ENABLE_DEFAULT_FILTERS flag (always set)
gedit/gedit-commands-file.c | 6 ++--
gedit/gedit-file-chooser-dialog-gtk.c | 59 +++++++++++++++++------------------
gedit/gedit-file-chooser-dialog.h | 3 +-
3 files changed, 31 insertions(+), 37 deletions(-)
---
diff --git a/gedit/gedit-commands-file.c b/gedit/gedit-commands-file.c
index 9a2107ee8..22ccfccfb 100644
--- a/gedit/gedit-commands-file.c
+++ b/gedit/gedit-commands-file.c
@@ -453,8 +453,7 @@ _gedit_cmd_file_open (GSimpleAction *action,
/* Translators: "Open Files" is the title of the file chooser window. */
open_dialog = gedit_file_chooser_dialog_create (C_("window title", "Open Files"),
window != NULL ? GTK_WINDOW (window) : NULL,
- GEDIT_FILE_CHOOSER_OPEN |
- GEDIT_FILE_CHOOSER_ENABLE_DEFAULT_FILTERS,
+ GEDIT_FILE_CHOOSER_OPEN,
_("_Cancel"), GTK_RESPONSE_CANCEL,
_("_Open"), GTK_RESPONSE_OK);
@@ -843,8 +842,7 @@ save_as_tab_async (GeditTab *tab,
save_dialog = gedit_file_chooser_dialog_create (C_("window title", "Save As"),
GTK_WINDOW (window),
GEDIT_FILE_CHOOSER_SAVE |
- GEDIT_FILE_CHOOSER_ENABLE_LINE_ENDING |
- GEDIT_FILE_CHOOSER_ENABLE_DEFAULT_FILTERS,
+ GEDIT_FILE_CHOOSER_ENABLE_LINE_ENDING,
_("_Cancel"), GTK_RESPONSE_CANCEL,
_("_Save"), GTK_RESPONSE_OK);
diff --git a/gedit/gedit-file-chooser-dialog-gtk.c b/gedit/gedit-file-chooser-dialog-gtk.c
index b7a860691..a52c54656 100644
--- a/gedit/gedit-file-chooser-dialog-gtk.c
+++ b/gedit/gedit-file-chooser-dialog-gtk.c
@@ -593,42 +593,39 @@ gedit_file_chooser_dialog_gtk_create (const gchar *title,
active_filter = g_settings_get_int (result->filter_settings, GEDIT_SETTINGS_ACTIVE_FILE_FILTER);
gedit_debug_message (DEBUG_COMMANDS, "Active filter: %d", active_filter);
- if ((flags & GEDIT_FILE_CHOOSER_ENABLE_DEFAULT_FILTERS) != 0)
+ /* "All Text Files" filter */
+ filter = gtk_file_filter_new ();
+ gtk_file_filter_set_name (filter, ALL_TEXT_FILES);
+ gtk_file_filter_add_custom (filter,
+ GTK_FILE_FILTER_MIME_TYPE,
+ all_text_files_filter,
+ NULL,
+ NULL);
+ gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (result), filter);
+
+ if (active_filter != 1)
{
- /* "All Text Files" filter */
- filter = gtk_file_filter_new ();
- gtk_file_filter_set_name (filter, ALL_TEXT_FILES);
- gtk_file_filter_add_custom (filter,
- GTK_FILE_FILTER_MIME_TYPE,
- all_text_files_filter,
- NULL,
- NULL);
- gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (result), filter);
-
- if (active_filter != 1)
- {
- /* Use this filter if set by user and as default */
- gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (result), filter);
- }
-
- /* "All Files" filter */
- filter = gtk_file_filter_new ();
- gtk_file_filter_set_name (filter, ALL_FILES);
- gtk_file_filter_add_pattern (filter, "*");
- gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (result), filter);
+ /* Use this filter if set by user and as default */
+ gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (result), filter);
+ }
- if (active_filter == 1)
- {
- /* Use this filter if set by user */
- gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (result), filter);
- }
+ /* "All Files" filter */
+ filter = gtk_file_filter_new ();
+ gtk_file_filter_set_name (filter, ALL_FILES);
+ gtk_file_filter_add_pattern (filter, "*");
+ gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (result), filter);
- g_signal_connect (result,
- "notify::filter",
- G_CALLBACK (filter_changed),
- NULL);
+ if (active_filter == 1)
+ {
+ /* Use this filter if set by user */
+ gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (result), filter);
}
+ g_signal_connect (result,
+ "notify::filter",
+ G_CALLBACK (filter_changed),
+ NULL);
+
if (parent != NULL)
{
gtk_window_set_transient_for (GTK_WINDOW (result), parent);
diff --git a/gedit/gedit-file-chooser-dialog.h b/gedit/gedit-file-chooser-dialog.h
index 466a191f3..6425b60e3 100644
--- a/gedit/gedit-file-chooser-dialog.h
+++ b/gedit/gedit-file-chooser-dialog.h
@@ -79,8 +79,7 @@ typedef enum
{
GEDIT_FILE_CHOOSER_SAVE = 1 << 0,
GEDIT_FILE_CHOOSER_OPEN = 1 << 1,
- GEDIT_FILE_CHOOSER_ENABLE_LINE_ENDING = 1 << 2,
- GEDIT_FILE_CHOOSER_ENABLE_DEFAULT_FILTERS = 1 << 3
+ GEDIT_FILE_CHOOSER_ENABLE_LINE_ENDING = 1 << 2
} GeditFileChooserFlags;
GeditFileChooserDialog *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]