[gnome-control-center] network: Replace GObject boilerplate with modern macros



commit d327e20a10a6ed0130a710974dd6cc0e8550d7ab
Author: Robert Ancell <robert ancell canonical com>
Date:   Wed Nov 6 14:00:07 2019 +1300

    network: Replace GObject boilerplate with modern macros

 .../connection-editor/ce-page-8021x-security.c     | 15 ++++-
 .../connection-editor/ce-page-8021x-security.h     | 39 ++----------
 panels/network/connection-editor/ce-page-details.c | 34 ++++++++++-
 panels/network/connection-editor/ce-page-details.h | 70 +++-------------------
 .../network/connection-editor/ce-page-ethernet.c   | 16 ++++-
 .../network/connection-editor/ce-page-ethernet.h   | 44 ++------------
 panels/network/connection-editor/ce-page-ip4.c     | 33 ++++++++--
 panels/network/connection-editor/ce-page-ip4.h     | 55 ++---------------
 panels/network/connection-editor/ce-page-ip6.c     | 35 +++++++++--
 panels/network/connection-editor/ce-page-ip6.h     | 56 ++---------------
 .../network/connection-editor/ce-page-security.c   | 14 ++++-
 .../network/connection-editor/ce-page-security.h   | 42 ++-----------
 panels/network/connection-editor/ce-page-vpn.c     | 17 +++++-
 panels/network/connection-editor/ce-page-vpn.h     | 45 ++------------
 panels/network/connection-editor/ce-page-wifi.c    | 14 ++++-
 panels/network/connection-editor/ce-page-wifi.h    | 44 ++------------
 .../connection-editor/net-connection-editor.c      | 34 ++++++++++-
 .../connection-editor/net-connection-editor.h      | 55 +----------------
 18 files changed, 240 insertions(+), 422 deletions(-)
---
diff --git a/panels/network/connection-editor/ce-page-8021x-security.c 
b/panels/network/connection-editor/ce-page-8021x-security.c
index 4c683c672..4b3242dc9 100644
--- a/panels/network/connection-editor/ce-page-8021x-security.c
+++ b/panels/network/connection-editor/ce-page-8021x-security.c
@@ -34,6 +34,19 @@
 #include "ce-page-ethernet.h"
 #include "ce-page-8021x-security.h"
 
+struct _CEPage8021xSecurity {
+       CEPage parent;
+
+        GtkBox    *box;
+        GtkSwitch *enable_8021x_switch;
+        GtkLabel  *security_label;
+
+        GtkWidget *security_widget;
+        WirelessSecurity *security;
+        GtkSizeGroup *group;
+        gboolean initial_have_8021x;
+};
+
 G_DEFINE_TYPE (CEPage8021xSecurity, ce_page_8021x_security, CE_TYPE_PAGE)
 
 static void
@@ -88,7 +101,7 @@ ce_page_8021x_security_new (NMConnection     *connection,
 {
        CEPage8021xSecurity *self;
 
-       self = CE_PAGE_8021X_SECURITY (ce_page_new (CE_TYPE_PAGE_8021X_SECURITY,
+       self = CE_PAGE_8021X_SECURITY (ce_page_new (ce_page_8021x_security_get_type (),
                                                    connection,
                                                    client,
                                                    
"/org/gnome/control-center/network/8021x-security-page.ui"));
diff --git a/panels/network/connection-editor/ce-page-8021x-security.h 
b/panels/network/connection-editor/ce-page-8021x-security.h
index e3fbef0a1..f42c74d71 100644
--- a/panels/network/connection-editor/ce-page-8021x-security.h
+++ b/panels/network/connection-editor/ce-page-8021x-security.h
@@ -20,47 +20,18 @@
  * (C) Copyright 2008 - 2012 Red Hat, Inc.
  */
 
-#ifndef __CE_PAGE_8021X_SECURITY_H
-#define __CE_PAGE_8021X_SECURITY_H
+#pragma once
 
 #include <NetworkManager.h>
-#include "wireless-security.h"
-
-#include <glib.h>
-#include <glib-object.h>
 
 #include "ce-page.h"
+#include "wireless-security.h"
 
-#define CE_TYPE_PAGE_8021X_SECURITY            (ce_page_8021x_security_get_type ())
-#define CE_PAGE_8021X_SECURITY(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
CE_TYPE_PAGE_8021X_SECURITY, CEPage8021xSecurity))
-#define CE_PAGE_8021X_SECURITY_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), 
CE_TYPE_PAGE_8021X_SECURITY, CEPage8021xSecurityClass))
-#define CE_IS_PAGE_8021X_SECURITY(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 
CE_TYPE_PAGE_8021X_SECURITY))
-#define CE_IS_PAGE_8021X_SECURITY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), 
CE_TYPE_PAGE_8021X_SECURITY))
-#define CE_PAGE_8021X_SECURITY_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), 
CE_TYPE_PAGE_8021X_SECURITY, CEPage8021xSecurityClass))
-
-typedef struct CEPage8021xSecurity      CEPage8021xSecurity;
-typedef struct CEPage8021xSecurityClass CEPage8021xSecurityClass;
-
-struct CEPage8021xSecurity {
-       CEPage parent;
-
-        GtkBox    *box;
-        GtkSwitch *enable_8021x_switch;
-        GtkLabel  *security_label;
-
-        GtkWidget *security_widget;
-        WirelessSecurity *security;
-        GtkSizeGroup *group;
-        gboolean initial_have_8021x;
-};
-
-struct CEPage8021xSecurityClass {
-       CEPageClass parent;
-};
+G_BEGIN_DECLS
 
-GType ce_page_8021x_security_get_type (void);
+G_DECLARE_FINAL_TYPE (CEPage8021xSecurity, ce_page_8021x_security, CE, PAGE_8021X_SECURITY, CEPage)
 
 CEPage *ce_page_8021x_security_new (NMConnection     *connection,
                                     NMClient         *client);
 
-#endif  /* __CE_PAGE_8021X_SECURITY_H */
+G_END_DECLS
diff --git a/panels/network/connection-editor/ce-page-details.c 
b/panels/network/connection-editor/ce-page-details.c
index d33872389..ccad4189c 100644
--- a/panels/network/connection-editor/ce-page-details.c
+++ b/panels/network/connection-editor/ce-page-details.c
@@ -28,6 +28,38 @@
 
 #include "ce-page-details.h"
 
+struct _CEPageDetails
+{
+        CEPage parent;
+
+        GtkCheckButton *all_user_check;
+        GtkCheckButton *auto_connect_check;
+        GtkLabel *dns_heading_label;
+        GtkLabel *dns_label;
+        GtkButton *forget_button;
+        GtkLabel *ipv4_heading_label;
+        GtkLabel *ipv4_label;
+        GtkLabel *ipv6_heading_label;
+        GtkLabel *ipv6_label;
+        GtkLabel *last_used_heading_label;
+        GtkLabel *last_used_label;
+        GtkLabel *mac_heading_label;
+        GtkLabel *mac_label;
+        GtkCheckButton *restrict_data_check;
+        GtkLabel *route_heading_label;
+        GtkLabel *route_label;
+        GtkLabel *security_heading_label;
+        GtkLabel *security_label;
+        GtkLabel *speed_heading_label;
+        GtkLabel *speed_label;
+        GtkLabel *strength_heading_label;
+        GtkLabel *strength_label;
+
+        NMDevice *device;
+        NMAccessPoint *ap;
+        NetConnectionEditor *editor;
+};
+
 G_DEFINE_TYPE (CEPageDetails, ce_page_details, CE_TYPE_PAGE)
 
 static void
@@ -389,7 +421,7 @@ ce_page_details_new (NMConnection        *connection,
 {
         CEPageDetails *self;
 
-        self = CE_PAGE_DETAILS (ce_page_new (CE_TYPE_PAGE_DETAILS,
+        self = CE_PAGE_DETAILS (ce_page_new (ce_page_details_get_type (),
                                              connection,
                                              client,
                                              "/org/gnome/control-center/network/details-page.ui"));
diff --git a/panels/network/connection-editor/ce-page-details.h 
b/panels/network/connection-editor/ce-page-details.h
index d337c8b88..4bea550c5 100644
--- a/panels/network/connection-editor/ce-page-details.h
+++ b/panels/network/connection-editor/ce-page-details.h
@@ -19,73 +19,21 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#ifndef __CE_PAGE_DETAILS_H
-#define __CE_PAGE_DETAILS_H
+#pragma once
 
-#include <glib-object.h>
+#include <NetworkManager.h>
 
-#include <gtk/gtk.h>
-#include "net-connection-editor.h"
 #include "ce-page.h"
+#include "net-connection-editor.h"
 
 G_BEGIN_DECLS
 
-#define CE_TYPE_PAGE_DETAILS          (ce_page_details_get_type ())
-#define CE_PAGE_DETAILS(o)            (G_TYPE_CHECK_INSTANCE_CAST ((o), CE_TYPE_PAGE_DETAILS, CEPageDetails))
-#define CE_PAGE_DETAILS_CLASS(k)      (G_TYPE_CHECK_CLASS_CAST((k), CE_TYPE_PAGE_DETAILS, 
CEPageDetailsClass))
-#define CE_IS_PAGE_DETAILS(o)         (G_TYPE_CHECK_INSTANCE_TYPE ((o), CE_TYPE_PAGE_DETAILS))
-#define CE_IS_PAGE_DETAILS_CLASS(k)   (G_TYPE_CHECK_CLASS_TYPE ((k), CE_TYPE_PAGE_DETAILS))
-#define CE_PAGE_DETAILS_GET_CLASS(o)  (G_TYPE_INSTANCE_GET_CLASS ((o), CE_TYPE_PAGE_DETAILS, 
CEPageDetailsClass))
-
-typedef struct _CEPageDetails          CEPageDetails;
-typedef struct _CEPageDetailsClass     CEPageDetailsClass;
-
-struct _CEPageDetails
-{
-        CEPage parent;
-
-        GtkCheckButton *all_user_check;
-        GtkCheckButton *auto_connect_check;
-        GtkLabel *dns_heading_label;
-        GtkLabel *dns_label;
-        GtkButton *forget_button;
-        GtkLabel *ipv4_heading_label;
-        GtkLabel *ipv4_label;
-        GtkLabel *ipv6_heading_label;
-        GtkLabel *ipv6_label;
-        GtkLabel *last_used_heading_label;
-        GtkLabel *last_used_label;
-        GtkLabel *mac_heading_label;
-        GtkLabel *mac_label;
-        GtkCheckButton *restrict_data_check;
-        GtkLabel *route_heading_label;
-        GtkLabel *route_label;
-        GtkLabel *security_heading_label;
-        GtkLabel *security_label;
-        GtkLabel *speed_heading_label;
-        GtkLabel *speed_label;
-        GtkLabel *strength_heading_label;
-        GtkLabel *strength_label;
+G_DECLARE_FINAL_TYPE (CEPageDetails, ce_page_details, CE, PAGE_DETAILS, CEPage)
 
-        NMDevice *device;
-        NMAccessPoint *ap;
-        NetConnectionEditor *editor;
-};
-
-struct _CEPageDetailsClass
-{
-        CEPageClass parent_class;
-};
-
-GType   ce_page_details_get_type (void);
-
-CEPage *ce_page_details_new      (NMConnection        *connection,
-                                  NMClient            *client,
-                                  NMDevice            *device,
-                                  NMAccessPoint       *ap,
-                                  NetConnectionEditor *editor);
+CEPage *ce_page_details_new (NMConnection        *connection,
+                             NMClient            *client,
+                             NMDevice            *device,
+                             NMAccessPoint       *ap,
+                             NetConnectionEditor *editor);
 
 G_END_DECLS
-
-#endif /* __CE_PAGE_DETAILS_H */
-
diff --git a/panels/network/connection-editor/ce-page-ethernet.c 
b/panels/network/connection-editor/ce-page-ethernet.c
index 137c57538..e88c55afd 100644
--- a/panels/network/connection-editor/ce-page-ethernet.c
+++ b/panels/network/connection-editor/ce-page-ethernet.c
@@ -31,6 +31,20 @@
 #include "ce-page-ethernet.h"
 #include "ui-helpers.h"
 
+struct _CEPageEthernet
+{
+        CEPage parent;
+
+        NMSettingConnection *setting_connection;
+        NMSettingWired *setting_wired;
+
+        GtkEntry        *name;
+        GtkComboBoxText *device_mac;
+        GtkComboBoxText *cloned_mac;
+        GtkSpinButton   *mtu;
+        GtkWidget       *mtu_label;
+};
+
 G_DEFINE_TYPE (CEPageEthernet, ce_page_ethernet, CE_TYPE_PAGE)
 
 static void
@@ -187,7 +201,7 @@ ce_page_ethernet_new (NMConnection     *connection,
 {
         CEPageEthernet *self;
 
-        self = CE_PAGE_ETHERNET (ce_page_new (CE_TYPE_PAGE_ETHERNET,
+        self = CE_PAGE_ETHERNET (ce_page_new (ce_page_ethernet_get_type (),
                                               connection,
                                               client,
                                               "/org/gnome/control-center/network/ethernet-page.ui"));
diff --git a/panels/network/connection-editor/ce-page-ethernet.h 
b/panels/network/connection-editor/ce-page-ethernet.h
index 39d173a96..5f3e4d108 100644
--- a/panels/network/connection-editor/ce-page-ethernet.h
+++ b/panels/network/connection-editor/ce-page-ethernet.h
@@ -19,53 +19,17 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#ifndef __CE_PAGE_ETHERNET_H
-#define __CE_PAGE_ETHERNET_H
-
-#include <glib-object.h>
+#pragma once
 
 #include <NetworkManager.h>
 
-#include <gtk/gtk.h>
 #include "ce-page.h"
 
 G_BEGIN_DECLS
 
-#define CE_TYPE_PAGE_ETHERNET          (ce_page_ethernet_get_type ())
-#define CE_PAGE_ETHERNET(o)            (G_TYPE_CHECK_INSTANCE_CAST ((o), CE_TYPE_PAGE_ETHERNET, 
CEPageEthernet))
-#define CE_PAGE_ETHERNET_CLASS(k)      (G_TYPE_CHECK_CLASS_CAST((k), CE_TYPE_PAGE_ETHERNET, 
CEPageEthernetClass))
-#define CE_IS_PAGE_ETHERNET(o)         (G_TYPE_CHECK_INSTANCE_TYPE ((o), CE_TYPE_PAGE_ETHERNET))
-#define CE_IS_PAGE_ETHERNET_CLASS(k)   (G_TYPE_CHECK_CLASS_TYPE ((k), CE_TYPE_PAGE_ETHERNET))
-#define CE_PAGE_ETHERNET_GET_CLASS(o)  (G_TYPE_INSTANCE_GET_CLASS ((o), CE_TYPE_PAGE_ETHERNET, 
CEPageEthernetClass))
-
-typedef struct _CEPageEthernet          CEPageEthernet;
-typedef struct _CEPageEthernetClass     CEPageEthernetClass;
-
-struct _CEPageEthernet
-{
-        CEPage parent;
-
-        NMSettingConnection *setting_connection;
-        NMSettingWired *setting_wired;
-
-        GtkEntry        *name;
-        GtkComboBoxText *device_mac;
-        GtkComboBoxText *cloned_mac;
-        GtkSpinButton   *mtu;
-        GtkWidget       *mtu_label;
-};
+G_DECLARE_FINAL_TYPE (CEPageEthernet, ce_page_ethernet, CE, PAGE_ETHERNET, CEPage)
 
-struct _CEPageEthernetClass
-{
-        CEPageClass parent_class;
-};
-
-GType   ce_page_ethernet_get_type (void);
-
-CEPage *ce_page_ethernet_new      (NMConnection     *connection,
-                                   NMClient         *client);
+CEPage *ce_page_ethernet_new (NMConnection     *connection,
+                              NMClient         *client);
 
 G_END_DECLS
-
-#endif /* __CE_PAGE_ETHERNET_H */
-
diff --git a/panels/network/connection-editor/ce-page-ip4.c b/panels/network/connection-editor/ce-page-ip4.c
index 0dca8491b..51552cb73 100644
--- a/panels/network/connection-editor/ce-page-ip4.c
+++ b/panels/network/connection-editor/ce-page-ip4.c
@@ -35,6 +35,31 @@
 static void ensure_empty_address_row (CEPageIP4 *self);
 static void ensure_empty_routes_row (CEPageIP4 *self);
 
+struct _CEPageIP4
+{
+        CEPage parent;
+
+        GtkBox         *address_box;
+        GtkSizeGroup   *address_sizegroup;
+        GtkSwitch      *auto_dns_switch;
+        GtkSwitch      *auto_routes_switch;
+        GtkRadioButton *automatic_radio;
+        GtkBox         *content_box;
+        GtkRadioButton *disabled_radio;
+        GtkEntry       *dns_entry;
+        GtkRadioButton *local_radio;
+        GtkRadioButton *manual_radio;
+        GtkCheckButton *never_default_check;
+        GtkBox         *routes_box;
+        GtkSizeGroup   *routes_metric_sizegroup;
+        GtkSizeGroup   *routes_sizegroup;
+
+        NMSettingIPConfig *setting;
+
+        GtkWidget      *address_list;
+        GtkWidget      *routes_list;
+};
+
 G_DEFINE_TYPE (CEPageIP4, ce_page_ip4, CE_TYPE_PAGE)
 
 enum {
@@ -872,10 +897,10 @@ ce_page_ip4_new (NMConnection     *connection,
 {
         CEPageIP4 *self;
 
-        self = CE_PAGE_IP4 (ce_page_new (CE_TYPE_PAGE_IP4,
-                                           connection,
-                                           client,
-                                           "/org/gnome/control-center/network/ip4-page.ui"));
+        self = CE_PAGE_IP4 (ce_page_new (ce_page_ip4_get_type (),
+                                         connection,
+                                         client,
+                                         "/org/gnome/control-center/network/ip4-page.ui"));
 
         self->setting = nm_connection_get_setting_ip4_config (connection);
         if (!self->setting) {
diff --git a/panels/network/connection-editor/ce-page-ip4.h b/panels/network/connection-editor/ce-page-ip4.h
index 2ae087fd7..f50bb1d00 100644
--- a/panels/network/connection-editor/ce-page-ip4.h
+++ b/panels/network/connection-editor/ce-page-ip4.h
@@ -19,62 +19,17 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#ifndef __CE_PAGE_IP4_H
-#define __CE_PAGE_IP4_H
+#pragma once
 
-#include <glib-object.h>
+#include <NetworkManager.h>
 
-#include <gtk/gtk.h>
 #include "ce-page.h"
 
 G_BEGIN_DECLS
 
-#define CE_TYPE_PAGE_IP4          (ce_page_ip4_get_type ())
-#define CE_PAGE_IP4(o)            (G_TYPE_CHECK_INSTANCE_CAST ((o), CE_TYPE_PAGE_IP4, CEPageIP4))
-#define CE_PAGE_IP4_CLASS(k)      (G_TYPE_CHECK_CLASS_CAST((k), CE_TYPE_PAGE_IP4, CEPageIP4Class))
-#define CE_IS_PAGE_IP4(o)         (G_TYPE_CHECK_INSTANCE_TYPE ((o), CE_TYPE_PAGE_IP4))
-#define CE_IS_PAGE_IP4_CLASS(k)   (G_TYPE_CHECK_CLASS_TYPE ((k), CE_TYPE_PAGE_IP4))
-#define CE_PAGE_IP4_GET_CLASS(o)  (G_TYPE_INSTANCE_GET_CLASS ((o), CE_TYPE_PAGE_IP4, CEPageIP4Class))
+G_DECLARE_FINAL_TYPE (CEPageIP4, ce_page_ip4, CE, PAGE_IP4, CEPage)
 
-typedef struct _CEPageIP4          CEPageIP4;
-typedef struct _CEPageIP4Class     CEPageIP4Class;
-
-struct _CEPageIP4
-{
-        CEPage parent;
-
-        GtkBox         *address_box;
-        GtkSizeGroup   *address_sizegroup;
-        GtkSwitch      *auto_dns_switch;
-        GtkSwitch      *auto_routes_switch;
-        GtkRadioButton *automatic_radio;
-        GtkBox         *content_box;
-        GtkRadioButton *disabled_radio;
-        GtkEntry       *dns_entry;
-        GtkRadioButton *local_radio;
-        GtkRadioButton *manual_radio;
-        GtkCheckButton *never_default_check;
-        GtkBox         *routes_box;
-        GtkSizeGroup   *routes_metric_sizegroup;
-        GtkSizeGroup   *routes_sizegroup;
-
-        NMSettingIPConfig *setting;
-
-        GtkWidget      *address_list;
-        GtkWidget      *routes_list;
-};
-
-struct _CEPageIP4Class
-{
-        CEPageClass parent_class;
-};
-
-GType   ce_page_ip4_get_type (void);
-
-CEPage *ce_page_ip4_new      (NMConnection     *connection,
-                              NMClient         *client);
+CEPage *ce_page_ip4_new (NMConnection     *connection,
+                         NMClient         *client);
 
 G_END_DECLS
-
-#endif /* __CE_PAGE_IP4_H */
-
diff --git a/panels/network/connection-editor/ce-page-ip6.c b/panels/network/connection-editor/ce-page-ip6.c
index 2c002ccde..4ebdbebfe 100644
--- a/panels/network/connection-editor/ce-page-ip6.c
+++ b/panels/network/connection-editor/ce-page-ip6.c
@@ -35,6 +35,33 @@
 static void ensure_empty_address_row (CEPageIP6 *self);
 static void ensure_empty_routes_row (CEPageIP6 *self);
 
+
+struct _CEPageIP6
+{
+        CEPage parent;
+
+        GtkBox         *address_box;
+        GtkSizeGroup   *address_sizegroup;
+        GtkSwitch      *auto_dns_switch;
+        GtkSwitch      *auto_routes_switch;
+        GtkRadioButton *automatic_radio;
+        GtkBox         *content_box;
+        GtkRadioButton *dhcp_radio;
+        GtkRadioButton *disabled_radio;
+        GtkEntry       *dns_entry;
+        GtkRadioButton *local_radio;
+        GtkRadioButton *manual_radio;
+        GtkCheckButton *never_default_check;
+        GtkBox         *routes_box;
+        GtkSizeGroup   *routes_metric_sizegroup;
+        GtkSizeGroup   *routes_sizegroup;
+
+        NMSettingIPConfig *setting;
+
+        GtkWidget       *address_list;
+        GtkWidget       *routes_list;
+};
+
 G_DEFINE_TYPE (CEPageIP6, ce_page_ip6, CE_TYPE_PAGE)
 
 enum {
@@ -794,10 +821,10 @@ ce_page_ip6_new (NMConnection     *connection,
 {
         CEPageIP6 *self;
 
-        self = CE_PAGE_IP6 (ce_page_new (CE_TYPE_PAGE_IP6,
-                                           connection,
-                                           client,
-                                           "/org/gnome/control-center/network/ip6-page.ui"));
+        self = CE_PAGE_IP6 (ce_page_new (ce_page_ip6_get_type (),
+                                         connection,
+                                         client,
+                                         "/org/gnome/control-center/network/ip6-page.ui"));
 
         self->setting = nm_connection_get_setting_ip6_config (connection);
         if (!self->setting) {
diff --git a/panels/network/connection-editor/ce-page-ip6.h b/panels/network/connection-editor/ce-page-ip6.h
index e6c1c2ac9..6c07d28f5 100644
--- a/panels/network/connection-editor/ce-page-ip6.h
+++ b/panels/network/connection-editor/ce-page-ip6.h
@@ -19,63 +19,17 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#ifndef __CE_PAGE_IP6_H
-#define __CE_PAGE_IP6_H
+#pragma once
 
-#include <glib-object.h>
+#include <NetworkManager.h>
 
-#include <gtk/gtk.h>
 #include "ce-page.h"
 
 G_BEGIN_DECLS
 
-#define CE_TYPE_PAGE_IP6          (ce_page_ip6_get_type ())
-#define CE_PAGE_IP6(o)            (G_TYPE_CHECK_INSTANCE_CAST ((o), CE_TYPE_PAGE_IP6, CEPageIP6))
-#define CE_PAGE_IP6_CLASS(k)      (G_TYPE_CHECK_CLASS_CAST((k), CE_TYPE_PAGE_IP6, CEPageIP6Class))
-#define CE_IS_PAGE_IP6(o)         (G_TYPE_CHECK_INSTANCE_TYPE ((o), CE_TYPE_PAGE_IP6))
-#define CE_IS_PAGE_IP6_CLASS(k)   (G_TYPE_CHECK_CLASS_TYPE ((k), CE_TYPE_PAGE_IP6))
-#define CE_PAGE_IP6_GET_CLASS(o)  (G_TYPE_INSTANCE_GET_CLASS ((o), CE_TYPE_PAGE_IP6, CEPageIP6Class))
+G_DECLARE_FINAL_TYPE (CEPageIP6, ce_page_ip6, CE, PAGE_IP6, CEPage)
 
-typedef struct _CEPageIP6          CEPageIP6;
-typedef struct _CEPageIP6Class     CEPageIP6Class;
-
-struct _CEPageIP6
-{
-        CEPage parent;
-
-        GtkBox         *address_box;
-        GtkSizeGroup   *address_sizegroup;
-        GtkSwitch      *auto_dns_switch;
-        GtkSwitch      *auto_routes_switch;
-        GtkRadioButton *automatic_radio;
-        GtkBox         *content_box;
-        GtkRadioButton *dhcp_radio;
-        GtkRadioButton *disabled_radio;
-        GtkEntry       *dns_entry;
-        GtkRadioButton *local_radio;
-        GtkRadioButton *manual_radio;
-        GtkCheckButton *never_default_check;
-        GtkBox         *routes_box;
-        GtkSizeGroup   *routes_metric_sizegroup;
-        GtkSizeGroup   *routes_sizegroup;
-
-        NMSettingIPConfig *setting;
-
-        GtkWidget       *address_list;
-        GtkWidget       *routes_list;
-};
-
-struct _CEPageIP6Class
-{
-        CEPageClass parent_class;
-};
-
-GType   ce_page_ip6_get_type (void);
-
-CEPage *ce_page_ip6_new      (NMConnection     *connection,
-                              NMClient         *client);
+CEPage *ce_page_ip6_new (NMConnection     *connection,
+                         NMClient         *client);
 
 G_END_DECLS
-
-#endif /* __CE_PAGE_IP6_H */
-
diff --git a/panels/network/connection-editor/ce-page-security.c 
b/panels/network/connection-editor/ce-page-security.c
index 5bf979c9d..e15179d64 100644
--- a/panels/network/connection-editor/ce-page-security.c
+++ b/panels/network/connection-editor/ce-page-security.c
@@ -34,6 +34,18 @@
 #include "ws-wpa-eap.h"
 #include "ws-wpa-psk.h"
 
+struct _CEPageSecurity
+{
+        CEPage parent;
+
+        GtkBox      *box;
+        GtkComboBox *security_combo;
+        GtkLabel    *security_label;
+
+        GtkSizeGroup *group;
+        gboolean     adhoc;
+};
+
 G_DEFINE_TYPE (CEPageSecurity, ce_page_security, CE_TYPE_PAGE)
 
 enum {
@@ -441,7 +453,7 @@ ce_page_security_new (NMConnection      *connection,
         NMUtilsSecurityType default_type = NMU_SEC_NONE;
         NMSettingWirelessSecurity *sws;
 
-        self = CE_PAGE_SECURITY (ce_page_new (CE_TYPE_PAGE_SECURITY,
+        self = CE_PAGE_SECURITY (ce_page_new (ce_page_security_get_type (),
                                               connection,
                                               client,
                                               "/org/gnome/control-center/network/security-page.ui"));
diff --git a/panels/network/connection-editor/ce-page-security.h 
b/panels/network/connection-editor/ce-page-security.h
index d71c1d97b..5c8d8a720 100644
--- a/panels/network/connection-editor/ce-page-security.h
+++ b/panels/network/connection-editor/ce-page-security.h
@@ -19,49 +19,17 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#ifndef __CE_PAGE_SECURITY_H
-#define __CE_PAGE_SECURITY_H
+#pragma once
 
-#include <glib-object.h>
+#include <NetworkManager.h>
 
-#include <gtk/gtk.h>
 #include "ce-page.h"
 
 G_BEGIN_DECLS
 
-#define CE_TYPE_PAGE_SECURITY          (ce_page_security_get_type ())
-#define CE_PAGE_SECURITY(o)            (G_TYPE_CHECK_INSTANCE_CAST ((o), CE_TYPE_PAGE_SECURITY, 
CEPageSecurity))
-#define CE_PAGE_SECURITY_CLASS(k)      (G_TYPE_CHECK_CLASS_CAST((k), CE_TYPE_PAGE_SECURITY, 
CEPageSecurityClass))
-#define CE_IS_PAGE_SECURITY(o)         (G_TYPE_CHECK_INSTANCE_TYPE ((o), CE_TYPE_PAGE_SECURITY))
-#define CE_IS_PAGE_SECURITY_CLASS(k)   (G_TYPE_CHECK_CLASS_TYPE ((k), CE_TYPE_PAGE_SECURITY))
-#define CE_PAGE_SECURITY_GET_CLASS(o)  (G_TYPE_INSTANCE_GET_CLASS ((o), CE_TYPE_PAGE_SECURITY, 
CEPageSecurityClass))
+G_DECLARE_FINAL_TYPE (CEPageSecurity, ce_page_security, CE, PAGE_SECURITY, CEPage)
 
-typedef struct _CEPageSecurity          CEPageSecurity;
-typedef struct _CEPageSecurityClass     CEPageSecurityClass;
-
-struct _CEPageSecurity
-{
-        CEPage parent;
-
-        GtkBox      *box;
-        GtkComboBox *security_combo;
-        GtkLabel    *security_label;
-
-        GtkSizeGroup *group;
-        gboolean     adhoc;
-};
-
-struct _CEPageSecurityClass
-{
-        CEPageClass parent_class;
-};
-
-GType   ce_page_security_get_type (void);
-
-CEPage *ce_page_security_new      (NMConnection     *connection,
-                                   NMClient         *client);
+CEPage *ce_page_security_new (NMConnection     *connection,
+                              NMClient         *client);
 
 G_END_DECLS
-
-#endif /* __CE_PAGE_SECURITY_H */
-
diff --git a/panels/network/connection-editor/ce-page-vpn.c b/panels/network/connection-editor/ce-page-vpn.c
index 795946ef8..42cdcdd73 100644
--- a/panels/network/connection-editor/ce-page-vpn.c
+++ b/panels/network/connection-editor/ce-page-vpn.c
@@ -29,6 +29,21 @@
 #include "ce-page-vpn.h"
 #include "vpn-helpers.h"
 
+struct _CEPageVpn
+{
+        CEPage parent;
+
+        GtkLabel *failure_label;
+        GtkEntry *name_entry;
+        GtkBox   *page;
+
+        NMSettingConnection *setting_connection;
+        NMSettingVpn *setting_vpn;
+
+       NMVpnEditorPlugin *plugin;
+       NMVpnEditor *editor;
+};
+
 G_DEFINE_TYPE (CEPageVpn, ce_page_vpn, CE_TYPE_PAGE)
 
 /* Hack to make the plugin-provided editor widget fit in better with
@@ -184,7 +199,7 @@ ce_page_vpn_new (NMConnection     *connection,
 {
         CEPageVpn *self;
 
-        self = CE_PAGE_VPN (ce_page_new (CE_TYPE_PAGE_VPN,
+        self = CE_PAGE_VPN (ce_page_new (ce_page_vpn_get_type (),
                                         connection,
                                         client,
                                         "/org/gnome/control-center/network/vpn-page.ui"));
diff --git a/panels/network/connection-editor/ce-page-vpn.h b/panels/network/connection-editor/ce-page-vpn.h
index 4c95f75f6..8f8920959 100644
--- a/panels/network/connection-editor/ce-page-vpn.h
+++ b/panels/network/connection-editor/ce-page-vpn.h
@@ -19,54 +19,17 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#ifndef __CE_PAGE_VPN_H
-#define __CE_PAGE_VPN_H
-
-#include <glib-object.h>
+#pragma once
 
 #include <NetworkManager.h>
 
-#include <gtk/gtk.h>
 #include "ce-page.h"
 
 G_BEGIN_DECLS
 
-#define CE_TYPE_PAGE_VPN          (ce_page_vpn_get_type ())
-#define CE_PAGE_VPN(o)            (G_TYPE_CHECK_INSTANCE_CAST ((o), CE_TYPE_PAGE_VPN, CEPageVpn))
-#define CE_PAGE_VPN_CLASS(k)      (G_TYPE_CHECK_CLASS_CAST((k), CE_TYPE_PAGE_VPN, CEPageVpnClass))
-#define CE_IS_PAGE_VPN(o)         (G_TYPE_CHECK_INSTANCE_TYPE ((o), CE_TYPE_PAGE_VPN))
-#define CE_IS_PAGE_VPN_CLASS(k)   (G_TYPE_CHECK_CLASS_TYPE ((k), CE_TYPE_PAGE_VPN))
-#define CE_PAGE_VPN_GET_CLASS(o)  (G_TYPE_INSTANCE_GET_CLASS ((o), CE_TYPE_PAGE_VPN, CEPageVpnClass))
-
-typedef struct _CEPageVpn          CEPageVpn;
-typedef struct _CEPageVpnClass     CEPageVpnClass;
-
-struct _CEPageVpn
-{
-        CEPage parent;
-
-        GtkLabel *failure_label;
-        GtkEntry *name_entry;
-        GtkBox   *page;
-
-        NMSettingConnection *setting_connection;
-        NMSettingVpn *setting_vpn;
+G_DECLARE_FINAL_TYPE (CEPageVpn, ce_page_vpn, CE, PAGE_VPN, CEPage)
 
-       NMVpnEditorPlugin *plugin;
-       NMVpnEditor *editor;
-};
-
-struct _CEPageVpnClass
-{
-        CEPageClass parent_class;
-};
-
-GType   ce_page_vpn_get_type (void);
-
-CEPage *ce_page_vpn_new      (NMConnection     *connection,
-                             NMClient         *client);
+CEPage *ce_page_vpn_new (NMConnection     *connection,
+                         NMClient         *client);
 
 G_END_DECLS
-
-#endif /* __CE_PAGE_VPN_H */
-
diff --git a/panels/network/connection-editor/ce-page-wifi.c b/panels/network/connection-editor/ce-page-wifi.c
index 3e948d0e1..36807144e 100644
--- a/panels/network/connection-editor/ce-page-wifi.c
+++ b/panels/network/connection-editor/ce-page-wifi.c
@@ -31,6 +31,18 @@
 #include "ce-page-wifi.h"
 #include "ui-helpers.h"
 
+struct _CEPageWifi
+{
+        CEPage parent;
+
+        GtkComboBoxText *bssid_combo;
+        GtkComboBoxText *cloned_mac_combo;
+        GtkComboBoxText *mac_combo;
+        GtkEntry        *ssid_entry;
+
+        NMSettingWireless *setting;
+};
+
 G_DEFINE_TYPE (CEPageWifi, ce_page_wifi, CE_TYPE_PAGE)
 
 static void
@@ -175,7 +187,7 @@ ce_page_wifi_new (NMConnection     *connection,
 {
         CEPageWifi *self;
 
-        self = CE_PAGE_WIFI (ce_page_new (CE_TYPE_PAGE_WIFI,
+        self = CE_PAGE_WIFI (ce_page_new (ce_page_wifi_get_type (),
                                           connection,
                                           client,
                                           "/org/gnome/control-center/network/wifi-page.ui"));
diff --git a/panels/network/connection-editor/ce-page-wifi.h b/panels/network/connection-editor/ce-page-wifi.h
index e7764fc99..5a4d87b62 100644
--- a/panels/network/connection-editor/ce-page-wifi.h
+++ b/panels/network/connection-editor/ce-page-wifi.h
@@ -19,49 +19,15 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#ifndef __CE_PAGE_WIFI_H
-#define __CE_PAGE_WIFI_H
+#pragma once
 
-#include <glib-object.h>
+#include <NetworkManager.h>
 
-#include <gtk/gtk.h>
 #include "ce-page.h"
 
-G_BEGIN_DECLS
+G_DECLARE_FINAL_TYPE (CEPageWifi, ce_page_wifi, CE, PAGE_WIFI, CEPage)
 
-#define CE_TYPE_PAGE_WIFI          (ce_page_wifi_get_type ())
-#define CE_PAGE_WIFI(o)            (G_TYPE_CHECK_INSTANCE_CAST ((o), CE_TYPE_PAGE_WIFI, CEPageWifi))
-#define CE_PAGE_WIFI_CLASS(k)      (G_TYPE_CHECK_CLASS_CAST((k), CE_TYPE_PAGE_WIFI, CEPageWifiClass))
-#define CE_IS_PAGE_WIFI(o)         (G_TYPE_CHECK_INSTANCE_TYPE ((o), CE_TYPE_PAGE_WIFI))
-#define CE_IS_PAGE_WIFI_CLASS(k)   (G_TYPE_CHECK_CLASS_TYPE ((k), CE_TYPE_PAGE_WIFI))
-#define CE_PAGE_WIFI_GET_CLASS(o)  (G_TYPE_INSTANCE_GET_CLASS ((o), CE_TYPE_PAGE_WIFI, CEPageWifiClass))
-
-typedef struct _CEPageWifi          CEPageWifi;
-typedef struct _CEPageWifiClass     CEPageWifiClass;
-
-struct _CEPageWifi
-{
-        CEPage parent;
-
-        GtkComboBoxText *bssid_combo;
-        GtkComboBoxText *cloned_mac_combo;
-        GtkComboBoxText *mac_combo;
-        GtkEntry        *ssid_entry;
-
-        NMSettingWireless *setting;
-};
-
-struct _CEPageWifiClass
-{
-        CEPageClass parent_class;
-};
-
-GType   ce_page_wifi_get_type (void);
-
-CEPage *ce_page_wifi_new      (NMConnection     *connection,
-                               NMClient         *client);
+CEPage *ce_page_wifi_new (NMConnection     *connection,
+                          NMClient         *client);
 
 G_END_DECLS
-
-#endif /* __CE_PAGE_WIFI_H */
-
diff --git a/panels/network/connection-editor/net-connection-editor.c 
b/panels/network/connection-editor/net-connection-editor.c
index 70a607f6f..e96d1ff07 100644
--- a/panels/network/connection-editor/net-connection-editor.c
+++ b/panels/network/connection-editor/net-connection-editor.c
@@ -47,6 +47,36 @@ enum {
 
 static guint signals[LAST_SIGNAL] = { 0 };
 
+struct _NetConnectionEditor
+{
+        GtkDialog parent;
+
+        GtkWidget        *parent_window;
+        NMClient         *client;
+        NMDevice         *device;
+
+        NMConnection     *connection;
+        NMConnection     *orig_connection;
+        gboolean          is_new_connection;
+        gboolean          is_changed;
+        NMAccessPoint    *ap;
+
+        GtkButton        *cancel_button;
+        GtkButton        *apply_button;
+        GtkNotebook      *notebook;
+        GtkFrame         *add_connection_frame;
+        GtkNotebook      *toplevel_notebook;
+
+        GSList *initializing_pages;
+        GSList *pages;
+
+        guint                    permission_id;
+        NMClientPermissionResult can_modify;
+
+        gboolean          title_set;
+        gboolean          show_when_initialized;
+};
+
 G_DEFINE_TYPE (NetConnectionEditor, net_connection_editor, GTK_TYPE_DIALOG)
 
 static void page_changed (NetConnectionEditor *self);
@@ -191,7 +221,7 @@ net_connection_editor_class_init (NetConnectionEditorClass *class)
         signals[DONE] = g_signal_new ("done",
                                       G_OBJECT_CLASS_TYPE (object_class),
                                       G_SIGNAL_RUN_FIRST,
-                                      G_STRUCT_OFFSET (NetConnectionEditorClass, done),
+                                      0,
                                       NULL, NULL,
                                       NULL,
                                       G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
@@ -769,7 +799,7 @@ net_connection_editor_new (GtkWindow        *parent_window,
 {
         NetConnectionEditor *self;
 
-        self = g_object_new (NET_TYPE_CONNECTION_EDITOR,
+        self = g_object_new (net_connection_editor_get_type (),
                              /* This doesn't seem to work for a template, so it is also hardcoded. */
                              "use-header-bar", 1,
                              NULL);
diff --git a/panels/network/connection-editor/net-connection-editor.h 
b/panels/network/connection-editor/net-connection-editor.h
index 675b88fd9..39c94b174 100644
--- a/panels/network/connection-editor/net-connection-editor.h
+++ b/panels/network/connection-editor/net-connection-editor.h
@@ -19,64 +19,15 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#ifndef __NET_CONNECTION_EDITOR_H
-#define __NET_CONNECTION_EDITOR_H
-
-#include <glib-object.h>
+#pragma once
 
 #include <gtk/gtk.h>
 #include <NetworkManager.h>
 
 G_BEGIN_DECLS
 
-#define NET_TYPE_CONNECTION_EDITOR         (net_connection_editor_get_type ())
-#define NET_CONNECTION_EDITOR(o)            (G_TYPE_CHECK_INSTANCE_CAST ((o), NET_TYPE_CONNECTION_EDITOR, 
NetConnectionEditor))
-#define NET_CONNECTION_EDITOR_CLASS(k)      (G_TYPE_CHECK_CLASS_CAST((k), NET_TYPE_CONNECTION_EDITOR, 
NetConnectionEditorClass))
-#define NET_IS_CONNECTION_EDITOR(o)         (G_TYPE_CHECK_INSTANCE_TYPE ((o), NET_TYPE_CONNECTION_EDITOR))
-#define NET_IS_CONNECTION_EDITOR_CLASS(k)   (G_TYPE_CHECK_CLASS_TYPE ((k), NET_TYPE_CONNECTION_EDITOR))
-#define NET_CONNECTION_EDITOR_GET_CLASS(o)  (G_TYPE_INSTANCE_GET_CLASS ((o), NET_TYPE_CONNECTION_EDITOR, 
NetConnectionEditorClass))
-
-typedef struct _NetConnectionEditor          NetConnectionEditor;
-typedef struct _NetConnectionEditorClass     NetConnectionEditorClass;
-
-struct _NetConnectionEditor
-{
-        GtkDialog parent;
-
-        GtkWidget        *parent_window;
-        NMClient         *client;
-        NMDevice         *device;
-
-        NMConnection     *connection;
-        NMConnection     *orig_connection;
-        gboolean          is_new_connection;
-        gboolean          is_changed;
-        NMAccessPoint    *ap;
-
-        GtkButton        *cancel_button;
-        GtkButton        *apply_button;
-        GtkNotebook      *notebook;
-        GtkFrame         *add_connection_frame;
-        GtkNotebook      *toplevel_notebook;
+G_DECLARE_FINAL_TYPE (NetConnectionEditor, net_connection_editor, NET, CONNECTION_EDITOR, GtkDialog)
 
-        GSList *initializing_pages;
-        GSList *pages;
-
-        guint                    permission_id;
-        NMClientPermissionResult can_modify;
-
-        gboolean          title_set;
-        gboolean          show_when_initialized;
-};
-
-struct _NetConnectionEditorClass
-{
-        GtkDialogClass parent_class;
-
-        void (*done) (NetConnectionEditor *details, gboolean success);
-};
-
-GType                net_connection_editor_get_type (void);
 NetConnectionEditor *net_connection_editor_new      (GtkWindow        *parent_window,
                                                      NMConnection     *connection,
                                                      NMDevice         *device,
@@ -90,5 +41,3 @@ void                 net_connection_editor_reset    (NetConnectionEditor   *edit
 
 G_END_DECLS
 
-#endif /* __NET_CONNECTION_EDITOR_H */
-


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