[libgweather/wip/tintou/modern-code: 7/8] timezone-menu: declare GWeatherTimezoneMenu with G_DECLARE_FINAL_TYPE




commit e6ed138d04376e32536d95581ab5f2c1cc44e347
Author: Corentin Noël <corentin noel collabora com>
Date:   Wed Oct 7 16:33:31 2020 +0200

    timezone-menu: declare GWeatherTimezoneMenu with G_DECLARE_FINAL_TYPE
    
    This allows the remove some boilerplate code and use autopointers.

 libgweather/gweather-timezone-menu.c |  6 ++++++
 libgweather/gweather-timezone-menu.h | 24 ++----------------------
 2 files changed, 8 insertions(+), 22 deletions(-)
---
diff --git a/libgweather/gweather-timezone-menu.c b/libgweather/gweather-timezone-menu.c
index 1914caff..41e9b2ec 100644
--- a/libgweather/gweather-timezone-menu.c
+++ b/libgweather/gweather-timezone-menu.c
@@ -34,6 +34,12 @@
  * A #GtkComboBox subclass for choosing a #GWeatherTimezone
  */
 
+struct _GWeatherTimezoneMenu {
+    GtkComboBox parent_instance;
+
+    GWeatherTimezone *zone;
+};
+
 G_DEFINE_TYPE (GWeatherTimezoneMenu, gweather_timezone_menu, GTK_TYPE_COMBO_BOX)
 
 enum {
diff --git a/libgweather/gweather-timezone-menu.h b/libgweather/gweather-timezone-menu.h
index ed9930a8..c89085a7 100644
--- a/libgweather/gweather-timezone-menu.h
+++ b/libgweather/gweather-timezone-menu.h
@@ -28,30 +28,10 @@
 #include <gtk/gtk.h>
 #include <libgweather/gweather-location.h>
 
-typedef struct _GWeatherTimezoneMenu GWeatherTimezoneMenu;
-typedef struct _GWeatherTimezoneMenuClass GWeatherTimezoneMenuClass;
-
-#define GWEATHER_TYPE_TIMEZONE_MENU            (gweather_timezone_menu_get_type ())
-#define GWEATHER_TIMEZONE_MENU(object)         (G_TYPE_CHECK_INSTANCE_CAST ((object), 
GWEATHER_TYPE_TIMEZONE_MENU, GWeatherTimezoneMenu))
-#define GWEATHER_TIMEZONE_MENU_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), 
GWEATHER_TYPE_TIMEZONE_MENU, GWeatherTimezoneMenuClass))
-#define GWEATHER_IS_TIMEZONE_MENU(object)      (G_TYPE_CHECK_INSTANCE_TYPE ((object), 
GWEATHER_TYPE_TIMEZONE_MENU))
-#define GWEATHER_IS_TIMEZONE_MENU_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), 
GWEATHER_TYPE_TIMEZONE_MENU))
-#define GWEATHER_TIMEZONE_MENU_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), 
GWEATHER_TYPE_TIMEZONE_MENU, GWeatherTimezoneMenuClass))
-
-struct _GWeatherTimezoneMenu {
-    GtkComboBox parent;
-
-    /*< private >*/
-    GWeatherTimezone *zone;
-};
-
-struct _GWeatherTimezoneMenuClass {
-    GtkComboBoxClass parent_class;
-
-};
+#define GWEATHER_TYPE_TIMEZONE_MENU (gweather_timezone_menu_get_type ())
 
 GWEATHER_EXTERN
-GType       gweather_timezone_menu_get_type         (void);
+G_DECLARE_FINAL_TYPE (GWeatherTimezoneMenu, gweather_timezone_menu, GWEATHER, TIMEZONE_MENU, GtkComboBox)
 
 GWEATHER_EXTERN
 GtkWidget  *gweather_timezone_menu_new              (GWeatherLocation     *top);


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