[gedit/zbrown/deteplification-src: 366/633] FileChooserDialog: simplify the create() function




commit 17730004c4ad1667528ecf8f21be2809192aa861
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 785e6b57e..078a79121 100644
--- a/gedit/gedit-commands-file.c
+++ b/gedit/gedit-commands-file.c
@@ -457,7 +457,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);
 
@@ -849,7 +848,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 909c4c89d..f5e65afc2 100644
--- a/gedit/gedit-file-chooser-dialog-gtk.c
+++ b/gedit/gedit-file-chooser-dialog-gtk.c
@@ -590,14 +590,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;
@@ -630,12 +629,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 f897c81cd..ba4c0a165 100644
--- a/gedit/gedit-file-chooser-dialog-osx.m
+++ b/gedit/gedit-file-chooser-dialog-osx.m
@@ -892,14 +892,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 ede3c92e5..482a5e7a1 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 1a86cf745..8e898ca65 100644
--- a/gedit/gedit-file-chooser-dialog.h
+++ b/gedit/gedit-file-chooser-dialog.h
@@ -93,7 +93,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]