network: Replace GObject boilerplate with modern macros

This commit is contained in:
Robert Ancell 2019-11-06 14:00:07 +13:00
parent 0106a4ab90
commit d327e20a10
18 changed files with 240 additions and 422 deletions

View file

@ -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"));

View file

@ -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))
G_BEGIN_DECLS
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;
};
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

View file

@ -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"));

View file

@ -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))
G_DECLARE_FINAL_TYPE (CEPageDetails, ce_page_details, CE, PAGE_DETAILS, CEPage)
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;
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 */

View file

@ -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"));

View file

@ -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))
G_DECLARE_FINAL_TYPE (CEPageEthernet, ce_page_ethernet, CE, PAGE_ETHERNET, CEPage)
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;
};
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 */

View file

@ -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) {

View file

@ -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 */

View file

@ -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) {

View file

@ -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 */

View file

@ -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"));

View file

@ -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 */

View file

@ -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"));

View file

@ -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))
G_DECLARE_FINAL_TYPE (CEPageVpn, ce_page_vpn, CE, PAGE_VPN, CEPage)
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;
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 */

View file

@ -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"));

View file

@ -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 */

View file

@ -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);

View file

@ -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))
G_DECLARE_FINAL_TYPE (NetConnectionEditor, net_connection_editor, NET, CONNECTION_EDITOR, GtkDialog)
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;
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 */