[gedit/zbrown/deteplification-src: 437/633] File choosers: add comments, simplify




commit 3546289c29c2d869c04ec64ac73f08b7f0fcbf83
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sat Jun 13 23:00:00 2020 +0200

    File choosers: add comments, simplify

 gedit/gedit-file-chooser-open-dialog.c | 2 ++
 gedit/gedit-file-chooser-open-native.c | 3 +++
 gedit/gedit-file-chooser-open.c        | 8 ++------
 gedit/gedit-file-chooser-open.h        | 3 ---
 gedit/gedit-file-chooser.c             | 5 +++++
 5 files changed, 12 insertions(+), 9 deletions(-)
---
diff --git a/gedit/gedit-file-chooser-open-dialog.c b/gedit/gedit-file-chooser-open-dialog.c
index 8fe69eb15..1975f51f9 100644
--- a/gedit/gedit-file-chooser-open-dialog.c
+++ b/gedit/gedit-file-chooser-open-dialog.c
@@ -21,6 +21,8 @@
 #include <glib/gi18n.h>
 #include "gedit-encodings-combo-box.h"
 
+/* A GtkFileChooserDialog to *open* files. */
+
 struct _GeditFileChooserOpenDialogPrivate
 {
        GeditEncodingsComboBox *encodings_combo_box;
diff --git a/gedit/gedit-file-chooser-open-native.c b/gedit/gedit-file-chooser-open-native.c
index 7a5a09cbb..3a3ba5aaf 100644
--- a/gedit/gedit-file-chooser-open-native.c
+++ b/gedit/gedit-file-chooser-open-native.c
@@ -20,6 +20,9 @@
 #include "gedit-file-chooser-open-native.h"
 #include <glib/gi18n.h>
 
+/* A GtkFileChooserNative to *open* files. */
+/* TODO: finish the implementation. */
+
 struct _GeditFileChooserOpenNativePrivate
 {
        gint something;
diff --git a/gedit/gedit-file-chooser-open.c b/gedit/gedit-file-chooser-open.c
index 2acc65ad4..96f018230 100644
--- a/gedit/gedit-file-chooser-open.c
+++ b/gedit/gedit-file-chooser-open.c
@@ -21,12 +21,9 @@
 #include "gedit-file-chooser-open-dialog.h"
 #include "gedit-file-chooser-open-native.h"
 
-struct _GeditFileChooserOpenPrivate
-{
-       gint something;
-};
+/* Common code for file choosers that *open* files. */
 
-G_DEFINE_TYPE_WITH_PRIVATE (GeditFileChooserOpen, _gedit_file_chooser_open, GEDIT_TYPE_FILE_CHOOSER)
+G_DEFINE_TYPE (GeditFileChooserOpen, _gedit_file_chooser_open, GEDIT_TYPE_FILE_CHOOSER)
 
 static GtkFileChooser *
 get_gtk_file_chooser (GeditFileChooserOpen *chooser)
@@ -58,7 +55,6 @@ _gedit_file_chooser_open_class_init (GeditFileChooserOpenClass *klass)
 static void
 _gedit_file_chooser_open_init (GeditFileChooserOpen *chooser)
 {
-       chooser->priv = _gedit_file_chooser_open_get_instance_private (chooser);
 }
 
 GeditFileChooserOpen *
diff --git a/gedit/gedit-file-chooser-open.h b/gedit/gedit-file-chooser-open.h
index f150928d8..80f1a16bd 100644
--- a/gedit/gedit-file-chooser-open.h
+++ b/gedit/gedit-file-chooser-open.h
@@ -33,13 +33,10 @@ G_BEGIN_DECLS
 
 typedef struct _GeditFileChooserOpen         GeditFileChooserOpen;
 typedef struct _GeditFileChooserOpenClass    GeditFileChooserOpenClass;
-typedef struct _GeditFileChooserOpenPrivate  GeditFileChooserOpenPrivate;
 
 struct _GeditFileChooserOpen
 {
        GeditFileChooser parent;
-
-       GeditFileChooserOpenPrivate *priv;
 };
 
 struct _GeditFileChooserOpenClass
diff --git a/gedit/gedit-file-chooser.c b/gedit/gedit-file-chooser.c
index 97322effa..74c0d4059 100644
--- a/gedit/gedit-file-chooser.c
+++ b/gedit/gedit-file-chooser.c
@@ -45,12 +45,17 @@ G_DEFINE_TYPE_WITH_PRIVATE (GeditFileChooser, _gedit_file_chooser, G_TYPE_OBJECT
 gboolean
 _gedit_file_chooser_is_native (void)
 {
+       /* TODO: finish the implementation of the native variants. */
        return FALSE;
 }
 
 static gboolean
 mime_types_are_supported (void)
 {
+/* Note that the #ifdef could be moved to where this function is called, to have
+ * much more code between the #ifdef/#else/#endif. The goal is to always compile
+ * all the code on all platforms, to catch compilation problems earlier.
+ */
 #ifdef G_OS_WIN32
        /* See the GtkFileChooserNative documentation, a GtkFileFilter with
         * mime-types is not supported on Windows.


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