[gedit] FileChooserDialog: simplify the create() function



commit ed98c59425622abe3c5c8e34ffa4a1b7ddcdf0ac
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Thu Jun 4 22:02:49 2020 +0200

    FileChooserDialog: simplify the create() function
    
    Remove the @encoding parameter, it was always NULL.

 gedit/gedit-commands-file.c           |  2 --
 gedit/gedit-file-chooser-dialog-gtk.c | 21 +++++++--------------
 gedit/gedit-file-chooser-dialog-gtk.h | 21 +++++++++++----------
 gedit/gedit-file-chooser-dialog-osx.h | 21 +++++++++++----------
 gedit/gedit-file-chooser-dialog-osx.m | 15 +++++++--------
 gedit/gedit-file-chooser-dialog.c     | 17 +++++++----------
 gedit/gedit-file-chooser-dialog.h     |  1 -
 7 files changed, 43 insertions(+), 55 deletions(-)
---
diff --git a/gedit/gedit-commands-file.c b/gedit/gedit-commands-file.c
index 39137c4f8..d3498312a 100644
--- a/gedit/gedit-commands-file.c
+++ b/gedit/gedit-commands-file.c
@@ -456,7 +456,6 @@ _gedit_cmd_file_open (GSimpleAction *action,
                                                        GEDIT_FILE_CHOOSER_OPEN |
                                                        GEDIT_FILE_CHOOSER_ENABLE_ENCODING |
                                                        GEDIT_FILE_CHOOSER_ENABLE_DEFAULT_FILTERS,
-                                                       NULL,
                                                        _("_Cancel"), GTK_RESPONSE_CANCEL,
                                                        _("_Open"), GTK_RESPONSE_OK);
 
@@ -848,7 +847,6 @@ save_as_tab_async (GeditTab            *tab,
                                                        GEDIT_FILE_CHOOSER_ENABLE_ENCODING |
                                                        GEDIT_FILE_CHOOSER_ENABLE_LINE_ENDING |
                                                        GEDIT_FILE_CHOOSER_ENABLE_DEFAULT_FILTERS,
-                                                       NULL,
                                                        _("_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 c61b902f7..c0c23d55d 100644
--- a/gedit/gedit-file-chooser-dialog-gtk.c
+++ b/gedit/gedit-file-chooser-dialog-gtk.c
@@ -562,14 +562,13 @@ gedit_file_chooser_dialog_gtk_init (GeditFileChooserDialogGtk *dialog)
 }
 
 GeditFileChooserDialog *
-gedit_file_chooser_dialog_gtk_create (const gchar             *title,
-                                     GtkWindow               *parent,
-                                     GeditFileChooserFlags    flags,
-                                     const GtkSourceEncoding *encoding,
-                                     const gchar             *cancel_label,
-                                     GtkResponseType          cancel_response,
-                                     const gchar             *accept_label,
-                                     GtkResponseType          accept_response)
+gedit_file_chooser_dialog_gtk_create (const gchar           *title,
+                                     GtkWindow             *parent,
+                                     GeditFileChooserFlags  flags,
+                                     const gchar           *cancel_label,
+                                     GtkResponseType        cancel_response,
+                                     const gchar           *accept_label,
+                                     GtkResponseType        accept_response)
 {
        GeditFileChooserDialogGtk *result;
        GtkFileFilter *filter;
@@ -602,12 +601,6 @@ gedit_file_chooser_dialog_gtk_create (const gchar             *title,
                          G_CALLBACK (action_changed),
                          NULL);
 
-       if (encoding != NULL)
-       {
-               gedit_encodings_combo_box_set_selected_encoding (GEDIT_ENCODINGS_COMBO_BOX 
(result->option_menu),
-                                                                encoding);
-       }
-
        active_filter = g_settings_get_int (result->filter_settings, GEDIT_SETTINGS_ACTIVE_FILE_FILTER);
        gedit_debug_message (DEBUG_COMMANDS, "Active filter: %d", active_filter);
 
diff --git a/gedit/gedit-file-chooser-dialog-gtk.h b/gedit/gedit-file-chooser-dialog-gtk.h
index 39dfca982..c1e7f2cb6 100644
--- a/gedit/gedit-file-chooser-dialog-gtk.h
+++ b/gedit/gedit-file-chooser-dialog-gtk.h
@@ -29,16 +29,17 @@ G_BEGIN_DECLS
 
 #define GEDIT_TYPE_FILE_CHOOSER_DIALOG_GTK (gedit_file_chooser_dialog_gtk_get_type ())
 
-G_DECLARE_FINAL_TYPE (GeditFileChooserDialogGtk, gedit_file_chooser_dialog_gtk, GEDIT, 
FILE_CHOOSER_DIALOG_GTK, GtkFileChooserDialog)
-
-GeditFileChooserDialog *gedit_file_chooser_dialog_gtk_create           (const gchar             *title,
-                                                                        GtkWindow               *parent,
-                                                                        GeditFileChooserFlags    flags,
-                                                                        const GtkSourceEncoding *encoding,
-                                                                        const gchar             
*cancel_label,
-                                                                        GtkResponseType          
cancel_response,
-                                                                        const gchar             
*accept_label,
-                                                                        GtkResponseType          
accept_response);
+G_DECLARE_FINAL_TYPE (GeditFileChooserDialogGtk, gedit_file_chooser_dialog_gtk,
+                     GEDIT, FILE_CHOOSER_DIALOG_GTK,
+                     GtkFileChooserDialog)
+
+GeditFileChooserDialog *       gedit_file_chooser_dialog_gtk_create    (const gchar           *title,
+                                                                        GtkWindow             *parent,
+                                                                        GeditFileChooserFlags  flags,
+                                                                        const gchar           *cancel_label,
+                                                                        GtkResponseType        
cancel_response,
+                                                                        const gchar           *accept_label,
+                                                                        GtkResponseType        
accept_response);
 
 G_END_DECLS
 
diff --git a/gedit/gedit-file-chooser-dialog-osx.h b/gedit/gedit-file-chooser-dialog-osx.h
index d9263f9ce..b8f246d54 100644
--- a/gedit/gedit-file-chooser-dialog-osx.h
+++ b/gedit/gedit-file-chooser-dialog-osx.h
@@ -29,16 +29,17 @@ G_BEGIN_DECLS
 
 #define GEDIT_TYPE_FILE_CHOOSER_DIALOG_OSX (gedit_file_chooser_dialog_osx_get_type ())
 
-G_DECLARE_FINAL_TYPE (GeditFileChooserDialogOSX, gedit_file_chooser_dialog_osx, GEDIT, 
FILE_CHOOSER_DIALOG_OSX, GObject)
-
-GeditFileChooserDialog *gedit_file_chooser_dialog_osx_create           (const gchar              *title,
-                                                                        GtkWindow                *parent,
-                                                                        GeditFileChooserFlags     flags,
-                                                                        const GtkSourceEncoding  *encoding,
-                                                                        const gchar              
*cancel_label,
-                                                                        GtkResponseType           
cancel_response,
-                                                                        const gchar              
*accept_label,
-                                                                        GtkResponseType           
accept_response);
+G_DECLARE_FINAL_TYPE (GeditFileChooserDialogOSX, gedit_file_chooser_dialog_osx,
+                     GEDIT, FILE_CHOOSER_DIALOG_OSX,
+                     GObject)
+
+GeditFileChooserDialog *       gedit_file_chooser_dialog_osx_create    (const gchar           *title,
+                                                                        GtkWindow             *parent,
+                                                                        GeditFileChooserFlags  flags,
+                                                                        const gchar           *cancel_label,
+                                                                        GtkResponseType        
cancel_response,
+                                                                        const gchar           *accept_label,
+                                                                        GtkResponseType        
accept_response);
 
 G_END_DECLS
 
diff --git a/gedit/gedit-file-chooser-dialog-osx.m b/gedit/gedit-file-chooser-dialog-osx.m
index 898a70c1a..3eb88e248 100644
--- a/gedit/gedit-file-chooser-dialog-osx.m
+++ b/gedit/gedit-file-chooser-dialog-osx.m
@@ -878,14 +878,13 @@ on_parent_destroyed (GtkWindow                 *parent,
 }
 
 GeditFileChooserDialog *
-gedit_file_chooser_dialog_osx_create (const gchar             *title,
-                                     GtkWindow               *parent,
-                                     GeditFileChooserFlags    flags,
-                                     const GtkSourceEncoding *encoding,
-                                     const gchar             *cancel_label,
-                                     GtkResponseType          cancel_response,
-                                     const gchar             *accept_label,
-                                     GtkResponseType          accept_response)
+gedit_file_chooser_dialog_osx_create (const gchar           *title,
+                                     GtkWindow             *parent,
+                                     GeditFileChooserFlags  flags,
+                                     const gchar           *cancel_label,
+                                     GtkResponseType        cancel_response,
+                                     const gchar           *accept_label,
+                                     GtkResponseType        accept_response)
 {
        GeditFileChooserDialogOSX *ret;
        gchar *nomnem;
diff --git a/gedit/gedit-file-chooser-dialog.c b/gedit/gedit-file-chooser-dialog.c
index d52cfaed3..2a3af34d4 100644
--- a/gedit/gedit-file-chooser-dialog.c
+++ b/gedit/gedit-file-chooser-dialog.c
@@ -68,20 +68,18 @@ gedit_file_chooser_dialog_default_init (GeditFileChooserDialogInterface *iface)
 }
 
 GeditFileChooserDialog *
-gedit_file_chooser_dialog_create (const gchar              *title,
-                                  GtkWindow                *parent,
-                                  GeditFileChooserFlags    flags,
-                                  const GtkSourceEncoding *encoding,
-                                  const gchar              *cancel_label,
-                                  GtkResponseType           cancel_response,
-                                  const gchar              *accept_label,
-                                  GtkResponseType           accept_response)
+gedit_file_chooser_dialog_create (const gchar           *title,
+                                 GtkWindow             *parent,
+                                 GeditFileChooserFlags  flags,
+                                 const gchar           *cancel_label,
+                                 GtkResponseType        cancel_response,
+                                 const gchar           *accept_label,
+                                 GtkResponseType        accept_response)
 {
 #ifdef OS_OSX
        return gedit_file_chooser_dialog_osx_create (title,
                                                     parent,
                                                     flags,
-                                                    encoding,
                                                     cancel_label,
                                                     cancel_response,
                                                     accept_label,
@@ -90,7 +88,6 @@ gedit_file_chooser_dialog_create (const gchar              *title,
        return gedit_file_chooser_dialog_gtk_create (title,
                                                     parent,
                                                     flags,
-                                                    encoding,
                                                     cancel_label,
                                                     cancel_response,
                                                     accept_label,
diff --git a/gedit/gedit-file-chooser-dialog.h b/gedit/gedit-file-chooser-dialog.h
index 4a2e7b767..c6e314018 100644
--- a/gedit/gedit-file-chooser-dialog.h
+++ b/gedit/gedit-file-chooser-dialog.h
@@ -88,7 +88,6 @@ GeditFileChooserDialog *
                gedit_file_chooser_dialog_create                (const gchar              *title,
                                                                 GtkWindow                *parent,
                                                                 GeditFileChooserFlags     flags,
-                                                                const GtkSourceEncoding  *encoding,
                                                                 const gchar              *cancel_label,
                                                                 GtkResponseType           cancel_response,
                                                                 const gchar              *accept_label,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]