[gnome-control-center] network: Convert CEPage from a class to an interface
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] network: Convert CEPage from a class to an interface
- Date: Wed, 6 Nov 2019 12:38:29 +0000 (UTC)
commit 9759121e7f229ba180dfcf560e4602d5339b7d0f
Author: Robert Ancell <robert ancell canonical com>
Date: Wed Nov 6 17:07:42 2019 +1300
network: Convert CEPage from a class to an interface
.../connection-editor/ce-page-8021x-security.c | 21 ++++++++++-----
.../connection-editor/ce-page-8021x-security.h | 2 +-
panels/network/connection-editor/ce-page-details.c | 17 ++++++++----
panels/network/connection-editor/ce-page-details.h | 2 +-
.../network/connection-editor/ce-page-ethernet.c | 19 ++++++++-----
.../network/connection-editor/ce-page-ethernet.h | 2 +-
panels/network/connection-editor/ce-page-ip4.c | 19 ++++++++-----
panels/network/connection-editor/ce-page-ip4.h | 2 +-
panels/network/connection-editor/ce-page-ip6.c | 19 ++++++++-----
panels/network/connection-editor/ce-page-ip6.h | 2 +-
.../network/connection-editor/ce-page-security.c | 21 ++++++++++-----
.../network/connection-editor/ce-page-security.h | 2 +-
panels/network/connection-editor/ce-page-vpn.c | 21 ++++++++++-----
panels/network/connection-editor/ce-page-vpn.h | 2 +-
panels/network/connection-editor/ce-page-wifi.c | 19 ++++++++-----
panels/network/connection-editor/ce-page-wifi.h | 2 +-
panels/network/connection-editor/ce-page.c | 27 +++++++------------
panels/network/connection-editor/ce-page.h | 31 +++-------------------
18 files changed, 128 insertions(+), 102 deletions(-)
---
diff --git a/panels/network/connection-editor/ce-page-8021x-security.c
b/panels/network/connection-editor/ce-page-8021x-security.c
index fc35e6cca..043d97e03 100644
--- a/panels/network/connection-editor/ce-page-8021x-security.c
+++ b/panels/network/connection-editor/ce-page-8021x-security.c
@@ -35,7 +35,7 @@
#include "ce-page-8021x-security.h"
struct _CEPage8021xSecurity {
- CEPage parent;
+ GObject parent;
GtkBuilder *builder;
GtkBox *box;
@@ -50,7 +50,10 @@ struct _CEPage8021xSecurity {
gboolean initial_have_8021x;
};
-G_DEFINE_TYPE (CEPage8021xSecurity, ce_page_8021x_security, CE_TYPE_PAGE)
+static void ce_page_iface_init (CEPageInterface *);
+
+G_DEFINE_TYPE_WITH_CODE (CEPage8021xSecurity, ce_page_8021x_security, G_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE (ce_page_get_type (), ce_page_iface_init))
static void
enable_toggled (CEPage8021xSecurity *self)
@@ -182,13 +185,17 @@ static void
ce_page_8021x_security_class_init (CEPage8021xSecurityClass *security_class)
{
GObjectClass *object_class = G_OBJECT_CLASS (security_class);
- CEPageClass *parent_class = CE_PAGE_CLASS (security_class);
object_class->dispose = ce_page_8021x_security_dispose;
- parent_class->get_security_setting = ce_page_8021x_security_get_security_setting;
- parent_class->get_widget = ce_page_8021x_security_get_widget;
- parent_class->get_title = ce_page_8021x_security_get_title;
- parent_class->validate = ce_page_8021x_security_validate;
+}
+
+static void
+ce_page_iface_init (CEPageInterface *iface)
+{
+ iface->get_security_setting = ce_page_8021x_security_get_security_setting;
+ iface->get_widget = ce_page_8021x_security_get_widget;
+ iface->get_title = ce_page_8021x_security_get_title;
+ iface->validate = ce_page_8021x_security_validate;
}
CEPage *
diff --git a/panels/network/connection-editor/ce-page-8021x-security.h
b/panels/network/connection-editor/ce-page-8021x-security.h
index b89bd39f9..446e891a3 100644
--- a/panels/network/connection-editor/ce-page-8021x-security.h
+++ b/panels/network/connection-editor/ce-page-8021x-security.h
@@ -29,7 +29,7 @@
G_BEGIN_DECLS
-G_DECLARE_FINAL_TYPE (CEPage8021xSecurity, ce_page_8021x_security, CE, PAGE_8021X_SECURITY, CEPage)
+G_DECLARE_FINAL_TYPE (CEPage8021xSecurity, ce_page_8021x_security, CE, PAGE_8021X_SECURITY, GObject)
CEPage *ce_page_8021x_security_new (NMConnection *connection);
diff --git a/panels/network/connection-editor/ce-page-details.c
b/panels/network/connection-editor/ce-page-details.c
index 34339ca17..5f6d91bd9 100644
--- a/panels/network/connection-editor/ce-page-details.c
+++ b/panels/network/connection-editor/ce-page-details.c
@@ -30,7 +30,7 @@
struct _CEPageDetails
{
- CEPage parent;
+ GObject parent;
GtkBuilder *builder;
GtkCheckButton *all_user_check;
@@ -63,7 +63,10 @@ struct _CEPageDetails
NetConnectionEditor *editor;
};
-G_DEFINE_TYPE (CEPageDetails, ce_page_details, CE_TYPE_PAGE)
+static void ce_page_iface_init (CEPageInterface *);
+
+G_DEFINE_TYPE_WITH_CODE (CEPageDetails, ce_page_details, G_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE (ce_page_get_type (), ce_page_iface_init))
static void
forget_cb (CEPageDetails *self)
@@ -429,11 +432,15 @@ static void
ce_page_details_class_init (CEPageDetailsClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
- CEPageClass *page_class = CE_PAGE_CLASS (class);
object_class->dispose = ce_page_details_dispose;
- page_class->get_widget = ce_page_details_get_widget;
- page_class->get_title = ce_page_details_get_title;
+}
+
+static void
+ce_page_iface_init (CEPageInterface *iface)
+{
+ iface->get_widget = ce_page_details_get_widget;
+ iface->get_title = ce_page_details_get_title;
}
CEPage *
diff --git a/panels/network/connection-editor/ce-page-details.h
b/panels/network/connection-editor/ce-page-details.h
index c8e5c5f27..d57f312af 100644
--- a/panels/network/connection-editor/ce-page-details.h
+++ b/panels/network/connection-editor/ce-page-details.h
@@ -28,7 +28,7 @@
G_BEGIN_DECLS
-G_DECLARE_FINAL_TYPE (CEPageDetails, ce_page_details, CE, PAGE_DETAILS, CEPage)
+G_DECLARE_FINAL_TYPE (CEPageDetails, ce_page_details, CE, PAGE_DETAILS, GObject)
CEPage *ce_page_details_new (NMConnection *connection,
NMDevice *device,
diff --git a/panels/network/connection-editor/ce-page-ethernet.c
b/panels/network/connection-editor/ce-page-ethernet.c
index 670da53ee..ecab9fdf3 100644
--- a/panels/network/connection-editor/ce-page-ethernet.c
+++ b/panels/network/connection-editor/ce-page-ethernet.c
@@ -33,7 +33,7 @@
struct _CEPageEthernet
{
- CEPage parent;
+ GObject parent;
GtkBuilder *builder;
GtkComboBoxText *cloned_mac;
@@ -48,7 +48,10 @@ struct _CEPageEthernet
NMSettingWired *setting_wired;
};
-G_DEFINE_TYPE (CEPageEthernet, ce_page_ethernet, CE_TYPE_PAGE)
+static void ce_page_iface_init (CEPageInterface *);
+
+G_DEFINE_TYPE_WITH_CODE (CEPageEthernet, ce_page_ethernet, G_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE (ce_page_get_type (), ce_page_iface_init))
static void
mtu_changed (CEPageEthernet *self)
@@ -210,12 +213,16 @@ static void
ce_page_ethernet_class_init (CEPageEthernetClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
- CEPageClass *page_class = CE_PAGE_CLASS (class);
object_class->dispose = ce_page_ethernet_dispose;
- page_class->get_widget = ce_page_ethernet_get_widget;
- page_class->get_title = ce_page_ethernet_get_title;
- page_class->validate = ce_page_ethernet_validate;
+}
+
+static void
+ce_page_iface_init (CEPageInterface *iface)
+{
+ iface->get_widget = ce_page_ethernet_get_widget;
+ iface->get_title = ce_page_ethernet_get_title;
+ iface->validate = ce_page_ethernet_validate;
}
CEPage *
diff --git a/panels/network/connection-editor/ce-page-ethernet.h
b/panels/network/connection-editor/ce-page-ethernet.h
index 5f3e4d108..3b4f6681d 100644
--- a/panels/network/connection-editor/ce-page-ethernet.h
+++ b/panels/network/connection-editor/ce-page-ethernet.h
@@ -27,7 +27,7 @@
G_BEGIN_DECLS
-G_DECLARE_FINAL_TYPE (CEPageEthernet, ce_page_ethernet, CE, PAGE_ETHERNET, CEPage)
+G_DECLARE_FINAL_TYPE (CEPageEthernet, ce_page_ethernet, CE, PAGE_ETHERNET, GObject)
CEPage *ce_page_ethernet_new (NMConnection *connection,
NMClient *client);
diff --git a/panels/network/connection-editor/ce-page-ip4.c b/panels/network/connection-editor/ce-page-ip4.c
index 9b9ad8592..b8f4a4af4 100644
--- a/panels/network/connection-editor/ce-page-ip4.c
+++ b/panels/network/connection-editor/ce-page-ip4.c
@@ -37,7 +37,7 @@ static void ensure_empty_routes_row (CEPageIP4 *self);
struct _CEPageIP4
{
- CEPage parent;
+ GObject parent;
GtkBuilder *builder;
GtkBox *address_box;
@@ -62,7 +62,10 @@ struct _CEPageIP4
GtkWidget *routes_list;
};
-G_DEFINE_TYPE (CEPageIP4, ce_page_ip4, CE_TYPE_PAGE)
+static void ce_page_iface_init (CEPageInterface *);
+
+G_DEFINE_TYPE_WITH_CODE (CEPageIP4, ce_page_ip4, G_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE (ce_page_get_type (), ce_page_iface_init))
enum {
METHOD_COL_NAME,
@@ -890,12 +893,16 @@ static void
ce_page_ip4_class_init (CEPageIP4Class *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
- CEPageClass *page_class = CE_PAGE_CLASS (class);
object_class->dispose = ce_page_ip4_dispose;
- page_class->get_widget = ce_page_ip4_get_widget;
- page_class->get_title = ce_page_ip4_get_title;
- page_class->validate = ce_page_ip4_validate;
+}
+
+static void
+ce_page_iface_init (CEPageInterface *iface)
+{
+ iface->get_widget = ce_page_ip4_get_widget;
+ iface->get_title = ce_page_ip4_get_title;
+ iface->validate = ce_page_ip4_validate;
}
CEPage *
diff --git a/panels/network/connection-editor/ce-page-ip4.h b/panels/network/connection-editor/ce-page-ip4.h
index f50bb1d00..e6713c924 100644
--- a/panels/network/connection-editor/ce-page-ip4.h
+++ b/panels/network/connection-editor/ce-page-ip4.h
@@ -27,7 +27,7 @@
G_BEGIN_DECLS
-G_DECLARE_FINAL_TYPE (CEPageIP4, ce_page_ip4, CE, PAGE_IP4, CEPage)
+G_DECLARE_FINAL_TYPE (CEPageIP4, ce_page_ip4, CE, PAGE_IP4, GObject)
CEPage *ce_page_ip4_new (NMConnection *connection,
NMClient *client);
diff --git a/panels/network/connection-editor/ce-page-ip6.c b/panels/network/connection-editor/ce-page-ip6.c
index 16e81e43b..f654d705b 100644
--- a/panels/network/connection-editor/ce-page-ip6.c
+++ b/panels/network/connection-editor/ce-page-ip6.c
@@ -38,7 +38,7 @@ static void ensure_empty_routes_row (CEPageIP6 *self);
struct _CEPageIP6
{
- CEPage parent;
+ GObject parent;
GtkBuilder *builder;
GtkBox *address_box;
@@ -64,7 +64,10 @@ struct _CEPageIP6
GtkWidget *routes_list;
};
-G_DEFINE_TYPE (CEPageIP6, ce_page_ip6, CE_TYPE_PAGE)
+static void ce_page_iface_init (CEPageInterface *);
+
+G_DEFINE_TYPE_WITH_CODE (CEPageIP6, ce_page_ip6, G_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE (ce_page_get_type (), ce_page_iface_init))
enum {
METHOD_COL_NAME,
@@ -813,12 +816,16 @@ static void
ce_page_ip6_class_init (CEPageIP6Class *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
- CEPageClass *page_class = CE_PAGE_CLASS (class);
object_class->dispose = ce_page_ip6_dispose;
- page_class->get_widget = ce_page_ip6_get_widget;
- page_class->get_title = ce_page_ip6_get_title;
- page_class->validate = ce_page_ip6_validate;
+}
+
+static void
+ce_page_iface_init (CEPageInterface *iface)
+{
+ iface->get_widget = ce_page_ip6_get_widget;
+ iface->get_title = ce_page_ip6_get_title;
+ iface->validate = ce_page_ip6_validate;
}
CEPage *
diff --git a/panels/network/connection-editor/ce-page-ip6.h b/panels/network/connection-editor/ce-page-ip6.h
index 6c07d28f5..60e847080 100644
--- a/panels/network/connection-editor/ce-page-ip6.h
+++ b/panels/network/connection-editor/ce-page-ip6.h
@@ -27,7 +27,7 @@
G_BEGIN_DECLS
-G_DECLARE_FINAL_TYPE (CEPageIP6, ce_page_ip6, CE, PAGE_IP6, CEPage)
+G_DECLARE_FINAL_TYPE (CEPageIP6, ce_page_ip6, CE, PAGE_IP6, GObject)
CEPage *ce_page_ip6_new (NMConnection *connection,
NMClient *client);
diff --git a/panels/network/connection-editor/ce-page-security.c
b/panels/network/connection-editor/ce-page-security.c
index 619d2e8c3..00da42324 100644
--- a/panels/network/connection-editor/ce-page-security.c
+++ b/panels/network/connection-editor/ce-page-security.c
@@ -36,7 +36,7 @@
struct _CEPageSecurity
{
- CEPage parent;
+ GObject parent;
GtkBuilder *builder;
GtkBox *box;
@@ -50,7 +50,10 @@ struct _CEPageSecurity
gboolean adhoc;
};
-G_DEFINE_TYPE (CEPageSecurity, ce_page_security, CE_TYPE_PAGE)
+static void ce_page_iface_init (CEPageInterface *);
+
+G_DEFINE_TYPE_WITH_CODE (CEPageSecurity, ce_page_security, G_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE (ce_page_get_type (), ce_page_iface_init))
enum {
S_NAME_COLUMN,
@@ -452,13 +455,17 @@ static void
ce_page_security_class_init (CEPageSecurityClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
- CEPageClass *page_class = CE_PAGE_CLASS (class);
object_class->dispose = ce_page_security_dispose;
- page_class->get_security_setting = ce_page_security_get_security_setting;
- page_class->get_widget = ce_page_security_get_widget;
- page_class->get_title = ce_page_security_get_title;
- page_class->validate = ce_page_security_validate;
+}
+
+static void
+ce_page_iface_init (CEPageInterface *iface)
+{
+ iface->get_security_setting = ce_page_security_get_security_setting;
+ iface->get_widget = ce_page_security_get_widget;
+ iface->get_title = ce_page_security_get_title;
+ iface->validate = ce_page_security_validate;
}
CEPage *
diff --git a/panels/network/connection-editor/ce-page-security.h
b/panels/network/connection-editor/ce-page-security.h
index 82d07f37e..b585bdeb6 100644
--- a/panels/network/connection-editor/ce-page-security.h
+++ b/panels/network/connection-editor/ce-page-security.h
@@ -27,7 +27,7 @@
G_BEGIN_DECLS
-G_DECLARE_FINAL_TYPE (CEPageSecurity, ce_page_security, CE, PAGE_SECURITY, CEPage)
+G_DECLARE_FINAL_TYPE (CEPageSecurity, ce_page_security, CE, PAGE_SECURITY, GObject)
CEPage *ce_page_security_new (NMConnection *connection);
diff --git a/panels/network/connection-editor/ce-page-vpn.c b/panels/network/connection-editor/ce-page-vpn.c
index a9d334c8c..136a25abf 100644
--- a/panels/network/connection-editor/ce-page-vpn.c
+++ b/panels/network/connection-editor/ce-page-vpn.c
@@ -31,7 +31,7 @@
struct _CEPageVpn
{
- CEPage parent;
+ GObject parent;
GtkBuilder *builder;
GtkBox *box;
@@ -46,7 +46,10 @@ struct _CEPageVpn
NMVpnEditor *editor;
};
-G_DEFINE_TYPE (CEPageVpn, ce_page_vpn, CE_TYPE_PAGE)
+static void ce_page_iface_init (CEPageInterface *);
+
+G_DEFINE_TYPE_WITH_CODE (CEPageVpn, ce_page_vpn, G_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE (ce_page_get_type (), ce_page_iface_init))
/* Hack to make the plugin-provided editor widget fit in better with
* the control center by changing
@@ -185,14 +188,18 @@ ce_page_vpn_init (CEPageVpn *self)
static void
ce_page_vpn_class_init (CEPageVpnClass *class)
{
- CEPageClass *page_class = CE_PAGE_CLASS (class);
GObjectClass *object_class = G_OBJECT_CLASS (class);
object_class->dispose = ce_page_vpn_dispose;
- page_class->get_security_setting = ce_page_vpn_get_security_setting;
- page_class->get_widget = ce_page_vpn_get_widget;
- page_class->get_title = ce_page_vpn_get_title;
- page_class->validate = ce_page_vpn_validate;
+}
+
+static void
+ce_page_iface_init (CEPageInterface *iface)
+{
+ iface->get_security_setting = ce_page_vpn_get_security_setting;
+ iface->get_widget = ce_page_vpn_get_widget;
+ iface->get_title = ce_page_vpn_get_title;
+ iface->validate = ce_page_vpn_validate;
}
static void
diff --git a/panels/network/connection-editor/ce-page-vpn.h b/panels/network/connection-editor/ce-page-vpn.h
index bc7b1e850..339e39281 100644
--- a/panels/network/connection-editor/ce-page-vpn.h
+++ b/panels/network/connection-editor/ce-page-vpn.h
@@ -27,7 +27,7 @@
G_BEGIN_DECLS
-G_DECLARE_FINAL_TYPE (CEPageVpn, ce_page_vpn, CE, PAGE_VPN, CEPage)
+G_DECLARE_FINAL_TYPE (CEPageVpn, ce_page_vpn, CE, PAGE_VPN, GObject)
CEPage *ce_page_vpn_new (NMConnection *connection);
diff --git a/panels/network/connection-editor/ce-page-wifi.c b/panels/network/connection-editor/ce-page-wifi.c
index bd90b4519..727d58dd3 100644
--- a/panels/network/connection-editor/ce-page-wifi.c
+++ b/panels/network/connection-editor/ce-page-wifi.c
@@ -33,7 +33,7 @@
struct _CEPageWifi
{
- CEPage parent;
+ GObject parent;
GtkBuilder *builder;
GtkComboBoxText *bssid_combo;
@@ -46,7 +46,10 @@ struct _CEPageWifi
NMSettingWireless *setting;
};
-G_DEFINE_TYPE (CEPageWifi, ce_page_wifi, CE_TYPE_PAGE)
+static void ce_page_iface_init (CEPageInterface *);
+
+G_DEFINE_TYPE_WITH_CODE (CEPageWifi, ce_page_wifi, G_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE (ce_page_get_type (), ce_page_iface_init))
static void
connect_wifi_page (CEPageWifi *self)
@@ -196,12 +199,16 @@ static void
ce_page_wifi_class_init (CEPageWifiClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
- CEPageClass *page_class = CE_PAGE_CLASS (class);
object_class->dispose = ce_page_wifi_dispose;
- page_class->get_widget = ce_page_wifi_get_widget;
- page_class->get_title = ce_page_wifi_get_title;
- page_class->validate = ce_page_wifi_class_validate;
+}
+
+static void
+ce_page_iface_init (CEPageInterface *iface)
+{
+ iface->get_widget = ce_page_wifi_get_widget;
+ iface->get_title = ce_page_wifi_get_title;
+ iface->validate = ce_page_wifi_class_validate;
}
CEPage *
diff --git a/panels/network/connection-editor/ce-page-wifi.h b/panels/network/connection-editor/ce-page-wifi.h
index 5a4d87b62..5e790ead9 100644
--- a/panels/network/connection-editor/ce-page-wifi.h
+++ b/panels/network/connection-editor/ce-page-wifi.h
@@ -25,7 +25,7 @@
#include "ce-page.h"
-G_DECLARE_FINAL_TYPE (CEPageWifi, ce_page_wifi, CE, PAGE_WIFI, CEPage)
+G_DECLARE_FINAL_TYPE (CEPageWifi, ce_page_wifi, CE, PAGE_WIFI, GObject)
CEPage *ce_page_wifi_new (NMConnection *connection,
NMClient *client);
diff --git a/panels/network/connection-editor/ce-page.c b/panels/network/connection-editor/ce-page.c
index 6075ae4f1..ae3b99eb2 100644
--- a/panels/network/connection-editor/ce-page.c
+++ b/panels/network/connection-editor/ce-page.c
@@ -33,7 +33,7 @@
#include "ce-page.h"
-G_DEFINE_ABSTRACT_TYPE (CEPage, ce_page, G_TYPE_OBJECT)
+G_DEFINE_INTERFACE (CEPage, ce_page, G_TYPE_OBJECT)
enum {
CHANGED,
@@ -49,8 +49,8 @@ ce_page_validate (CEPage *self, NMConnection *connection, GError **error)
g_return_val_if_fail (CE_IS_PAGE (self), FALSE);
g_return_val_if_fail (NM_IS_CONNECTION (connection), FALSE);
- if (CE_PAGE_GET_CLASS (self)->validate)
- return CE_PAGE_GET_CLASS (self)->validate (self, connection, error);
+ if (CE_PAGE_GET_IFACE (self)->validate)
+ return CE_PAGE_GET_IFACE (self)->validate (self, connection, error);
return TRUE;
}
@@ -60,7 +60,7 @@ ce_page_get_widget (CEPage *self)
{
g_return_val_if_fail (CE_IS_PAGE (self), NULL);
- return CE_PAGE_GET_CLASS (self)->get_widget (self);
+ return CE_PAGE_GET_IFACE (self)->get_widget (self);
}
const char *
@@ -68,7 +68,7 @@ ce_page_get_title (CEPage *self)
{
g_return_val_if_fail (CE_IS_PAGE (self), NULL);
- return CE_PAGE_GET_CLASS (self)->get_title (self);
+ return CE_PAGE_GET_IFACE (self)->get_title (self);
}
void
@@ -80,18 +80,11 @@ ce_page_changed (CEPage *self)
}
static void
-ce_page_init (CEPage *self)
+ce_page_default_init (CEPageInterface *iface)
{
-}
-
-static void
-ce_page_class_init (CEPageClass *page_class)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (page_class);
-
signals[CHANGED] =
g_signal_new ("changed",
- G_OBJECT_CLASS_TYPE (object_class),
+ G_TYPE_FROM_INTERFACE (iface),
G_SIGNAL_RUN_FIRST,
0,
NULL, NULL,
@@ -100,7 +93,7 @@ ce_page_class_init (CEPageClass *page_class)
signals[INITIALIZED] =
g_signal_new ("initialized",
- G_OBJECT_CLASS_TYPE (object_class),
+ G_TYPE_FROM_INTERFACE (iface),
G_SIGNAL_RUN_FIRST,
0,
NULL, NULL,
@@ -344,8 +337,8 @@ ce_page_cloned_mac_combo_valid (GtkComboBoxText *combo)
const gchar *
ce_page_get_security_setting (CEPage *self)
{
- if (CE_PAGE_GET_CLASS (self)->get_security_setting)
- return CE_PAGE_GET_CLASS (self)->get_security_setting (self);
+ if (CE_PAGE_GET_IFACE (self)->get_security_setting)
+ return CE_PAGE_GET_IFACE (self)->get_security_setting (self);
return NULL;
}
diff --git a/panels/network/connection-editor/ce-page.h b/panels/network/connection-editor/ce-page.h
index 7224d7965..a3375de9f 100644
--- a/panels/network/connection-editor/ce-page.h
+++ b/panels/network/connection-editor/ce-page.h
@@ -19,8 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef __CE_PAGE_H
-#define __CE_PAGE_H
+#pragma once
#include <glib-object.h>
@@ -30,24 +29,11 @@
G_BEGIN_DECLS
-#define CE_TYPE_PAGE (ce_page_get_type ())
-#define CE_PAGE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), CE_TYPE_PAGE, CEPage))
-#define CE_PAGE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), CE_TYPE_PAGE, CEPageClass))
-#define CE_IS_PAGE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), CE_TYPE_PAGE))
-#define CE_IS_PAGE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), CE_TYPE_PAGE))
-#define CE_PAGE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), CE_TYPE_PAGE, CEPageClass))
+G_DECLARE_INTERFACE (CEPage, ce_page, CE, PAGE, GObject)
-typedef struct _CEPage CEPage;
-typedef struct _CEPageClass CEPageClass;
-
-struct _CEPage
+struct _CEPageInterface
{
- GObject parent;
-};
-
-struct _CEPageClass
-{
- GObjectClass parent_class;
+ GTypeInterface g_iface;
gboolean (*validate) (CEPage *page, NMConnection *connection, GError **error);
GtkWidget *(*get_widget) (CEPage *page);
@@ -55,8 +41,6 @@ struct _CEPageClass
const gchar *(*get_security_setting) (CEPage *page);
};
-GType ce_page_get_type (void);
-
GtkWidget *ce_page_get_widget (CEPage *page);
const gchar *ce_page_get_title (CEPage *page);
const gchar *ce_page_get_security_setting (CEPage *page);
@@ -94,11 +78,4 @@ gchar * ce_page_get_next_available_name (const GPtrArray *connections,
NameFormat format,
const gchar *type_name);
-
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (CEPage, g_object_unref)
-
-
G_END_DECLS
-
-#endif /* __CE_PAGE_H */
-
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]