[tepl] IoErrorInfoBar: easier GObject style



commit b7a068b5655cf50749c191f2682a2ff9a6051601
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Tue Nov 10 01:11:23 2020 +0100

    IoErrorInfoBar: easier GObject style

 tepl/tepl-io-error-info-bar.c |  8 +++++++-
 tepl/tepl-io-error-info-bar.h | 24 ++++++++++++++++++++----
 2 files changed, 27 insertions(+), 5 deletions(-)
---
diff --git a/tepl/tepl-io-error-info-bar.c b/tepl/tepl-io-error-info-bar.c
index 8f69c40..f28fca3 100644
--- a/tepl/tepl-io-error-info-bar.c
+++ b/tepl/tepl-io-error-info-bar.c
@@ -8,9 +8,14 @@
 #include <glib/gi18n-lib.h>
 #include "tepl-utils.h"
 
+struct _TeplIoErrorInfoBarPrivate
+{
+       gint something;
+};
+
 /* Verbose error reporting for file I/O operations (load, save, etc.). */
 
-G_DEFINE_TYPE (TeplIoErrorInfoBar, _tepl_io_error_info_bar, TEPL_TYPE_INFO_BAR)
+G_DEFINE_TYPE_WITH_PRIVATE (TeplIoErrorInfoBar, _tepl_io_error_info_bar, TEPL_TYPE_INFO_BAR)
 
 static gboolean
 is_recoverable_error (const GError *error)
@@ -206,6 +211,7 @@ _tepl_io_error_info_bar_class_init (TeplIoErrorInfoBarClass *klass)
 static void
 _tepl_io_error_info_bar_init (TeplIoErrorInfoBar *info_bar)
 {
+       info_bar->priv = _tepl_io_error_info_bar_get_instance_private (info_bar);
 }
 
 TeplIoErrorInfoBar *
diff --git a/tepl/tepl-io-error-info-bar.h b/tepl/tepl-io-error-info-bar.h
index 3662394..d1495e3 100644
--- a/tepl/tepl-io-error-info-bar.h
+++ b/tepl/tepl-io-error-info-bar.h
@@ -10,16 +10,32 @@
 
 G_BEGIN_DECLS
 
-#define TEPL_TYPE_IO_ERROR_INFO_BAR (_tepl_io_error_info_bar_get_type ())
-G_DECLARE_DERIVABLE_TYPE (TeplIoErrorInfoBar, _tepl_io_error_info_bar,
-                         TEPL, IO_ERROR_INFO_BAR,
-                         TeplInfoBar)
+#define TEPL_TYPE_IO_ERROR_INFO_BAR             (_tepl_io_error_info_bar_get_type ())
+#define TEPL_IO_ERROR_INFO_BAR(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
TEPL_TYPE_IO_ERROR_INFO_BAR, TeplIoErrorInfoBar))
+#define TEPL_IO_ERROR_INFO_BAR_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), 
TEPL_TYPE_IO_ERROR_INFO_BAR, TeplIoErrorInfoBarClass))
+#define TEPL_IS_IO_ERROR_INFO_BAR(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 
TEPL_TYPE_IO_ERROR_INFO_BAR))
+#define TEPL_IS_IO_ERROR_INFO_BAR_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), 
TEPL_TYPE_IO_ERROR_INFO_BAR))
+#define TEPL_IO_ERROR_INFO_BAR_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), 
TEPL_TYPE_IO_ERROR_INFO_BAR, TeplIoErrorInfoBarClass))
+
+typedef struct _TeplIoErrorInfoBar         TeplIoErrorInfoBar;
+typedef struct _TeplIoErrorInfoBarClass    TeplIoErrorInfoBarClass;
+typedef struct _TeplIoErrorInfoBarPrivate  TeplIoErrorInfoBarPrivate;
+
+struct _TeplIoErrorInfoBar
+{
+       TeplInfoBar parent;
+
+       TeplIoErrorInfoBarPrivate *priv;
+};
 
 struct _TeplIoErrorInfoBarClass
 {
        TeplInfoBarClass parent_class;
 };
 
+G_GNUC_INTERNAL
+GType                  _tepl_io_error_info_bar_get_type                        (void);
+
 G_GNUC_INTERNAL
 TeplIoErrorInfoBar *   _tepl_io_error_info_bar_new                             (void);
 


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