[gedit] FileChooser: small code refactoring
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] FileChooser: small code refactoring
- Date: Mon, 8 Jun 2020 18:41:40 +0000 (UTC)
commit bf8584b89baa463fcea273a829ec966e0f53676e
Author: Sébastien Wilmet <swilmet gnome org>
Date: Mon Jun 8 20:39:08 2020 +0200
FileChooser: small code refactoring
gedit/gedit-file-chooser.c | 32 +++++++++++++++++---------------
1 file changed, 17 insertions(+), 15 deletions(-)
---
diff --git a/gedit/gedit-file-chooser.c b/gedit/gedit-file-chooser.c
index eea6719bb..604b9d97b 100644
--- a/gedit/gedit-file-chooser.c
+++ b/gedit/gedit-file-chooser.c
@@ -109,26 +109,28 @@ notify_filter_cb (GtkFileChooser *chooser,
gpointer user_data)
{
GtkFileFilter *filter;
+ const gchar *name;
+ gint id = 0;
+ GeditSettings *settings;
+ GSettings *file_chooser_state_settings;
+
+ /* Remember the selected filter. */
filter = gtk_file_chooser_get_filter (chooser);
- if (filter != NULL)
+ if (filter == NULL)
{
- /* Store ID of selected filter */
- const gchar *name;
- gint id = 0;
- GeditSettings *settings;
- GSettings *file_chooser_state_settings;
-
- name = gtk_file_filter_get_name (filter);
- g_return_if_fail (name != NULL);
-
- if (strcmp (name, ALL_FILES) == 0)
- id = 1;
+ return;
+ }
- settings = _gedit_settings_get_singleton ();
- file_chooser_state_settings = _gedit_settings_peek_file_chooser_state_settings (settings);
- g_settings_set_int (file_chooser_state_settings, GEDIT_SETTINGS_ACTIVE_FILE_FILTER, id);
+ name = gtk_file_filter_get_name (filter);
+ if (g_strcmp0 (name, ALL_FILES) == 0)
+ {
+ id = 1;
}
+
+ settings = _gedit_settings_get_singleton ();
+ file_chooser_state_settings = _gedit_settings_peek_file_chooser_state_settings (settings);
+ g_settings_set_int (file_chooser_state_settings, GEDIT_SETTINGS_ACTIVE_FILE_FILTER, id);
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]