[gnome-control-center/wip/rancell/g-define-type] phase 4
- From: Robert Ancell <rancell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/wip/rancell/g-define-type] phase 4
- Date: Mon, 4 Sep 2017 09:41:58 +0000 (UTC)
commit 418faa929c95b99e033e80c71af5d00002397615
Author: Robert Ancell <robert ancell canonical com>
Date: Mon Sep 4 21:41:43 2017 +1200
phase 4
.../connection-editor/ce-page-8021x-security.c | 20 +-
.../connection-editor/ce-page-8021x-security.h | 28 +-
panels/network/connection-editor/ce-page-details.c | 42 +-
panels/network/connection-editor/ce-page-details.h | 27 +-
.../network/connection-editor/ce-page-ethernet.c | 28 +-
.../network/connection-editor/ce-page-ethernet.h | 32 +-
panels/network/connection-editor/ce-page-ip4.c | 48 ++-
panels/network/connection-editor/ce-page-ip4.h | 33 +--
panels/network/connection-editor/ce-page-ip6.c | 50 ++-
panels/network/connection-editor/ce-page-ip6.h | 34 +--
.../network/connection-editor/ce-page-security.c | 22 +-
.../network/connection-editor/ce-page-security.h | 27 +-
panels/network/connection-editor/ce-page-vpn.c | 26 +-
panels/network/connection-editor/ce-page-vpn.h | 32 +-
panels/network/connection-editor/ce-page-wifi.c | 31 +-
panels/network/connection-editor/ce-page-wifi.h | 24 +-
panels/network/connection-editor/ce-page.c | 131 ++++-
panels/network/connection-editor/ce-page.h | 32 +-
.../connection-editor/net-connection-editor.c | 29 +-
.../connection-editor/net-connection-editor.h | 45 +--
panels/network/net-device-ethernet.c | 16 +
panels/network/net-device-ethernet.h | 34 +--
panels/network/net-device-mobile.c | 137 +++---
panels/network/net-device-mobile.h | 26 +-
panels/network/net-device-simple.c | 42 +-
panels/network/net-device-simple.h | 17 +-
panels/network/net-device-wifi.c | 128 +++---
panels/network/net-device-wifi.h | 28 +-
panels/network/net-device.c | 24 +-
panels/network/net-device.h | 18 +-
panels/network/net-object.c | 85 +++-
panels/network/net-object.h | 20 +-
panels/network/net-proxy.c | 98 ++--
panels/network/net-proxy.h | 27 +-
panels/network/net-vpn.c | 97 ++--
panels/network/net-vpn.h | 27 +-
panels/printers/pp-print-device.c | 145 +++---
panels/printers/pp-print-device.h | 11 +-
panels/user-accounts/cc-crop-area.c | 301 ++++++------
panels/user-accounts/cc-crop-area.h | 25 +-
panels/user-accounts/um-account-dialog.c | 7 +-
panels/user-accounts/um-account-dialog.h | 8 +-
panels/user-accounts/um-cell-renderer-user-image.c | 27 +-
panels/user-accounts/um-cell-renderer-user-image.h | 21 +-
panels/user-accounts/um-realm-manager.c | 7 +-
panels/user-accounts/um-realm-manager.h | 8 +-
panels/user-accounts/um-user-image.c | 20 +-
panels/user-accounts/um-user-image.h | 22 +-
panels/user-accounts/um-user-panel.c | 562 ++++++++++----------
panels/user-accounts/um-user-panel.h | 24 +-
50 files changed, 1223 insertions(+), 1530 deletions(-)
---
diff --git a/panels/network/connection-editor/ce-page-8021x-security.c
b/panels/network/connection-editor/ce-page-8021x-security.c
index f7d3196..74f4913 100644
--- a/panels/network/connection-editor/ce-page-8021x-security.c
+++ b/panels/network/connection-editor/ce-page-8021x-security.c
@@ -33,6 +33,16 @@
#include "ce-page-ethernet.h"
#include "ce-page-8021x-security.h"
+struct _CEPage8021xSecurity {
+ CEPage parent_instance;
+
+ GtkSwitch *enabled;
+ GtkWidget *security_widget;
+ WirelessSecurity *security;
+ GtkSizeGroup *group;
+ gboolean initial_have_8021x;
+};
+
G_DEFINE_TYPE (CEPage8021xSecurity, ce_page_8021x_security, CE_TYPE_PAGE)
static void
@@ -60,12 +70,12 @@ finish_setup (CEPage8021xSecurity *page, gpointer unused, GError *error, gpointe
if (error)
return;
- vbox = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "vbox"));
- heading = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "heading_sec"));
+ vbox = GTK_WIDGET (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "vbox"));
+ heading = GTK_WIDGET (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "heading_sec"));
page->group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
- page->security = (WirelessSecurity *) ws_wpa_eap_new (CE_PAGE (page)->connection, TRUE, FALSE);
+ page->security = (WirelessSecurity *) ws_wpa_eap_new (ce_page_get_connection (CE_PAGE (page)), TRUE,
FALSE);
if (!page->security) {
g_warning ("Could not load 802.1x user interface.");
return;
@@ -103,12 +113,12 @@ ce_page_8021x_security_new (NMConnection *connection,
if (nm_connection_get_setting_802_1x (connection))
page->initial_have_8021x = TRUE;
- page->enabled = GTK_SWITCH (gtk_builder_get_object (CE_PAGE (page)->builder, "8021x_switch"));
+ page->enabled = GTK_SWITCH (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)),
"8021x_switch"));
g_signal_connect (page, "initialized", G_CALLBACK (finish_setup), NULL);
if (page->initial_have_8021x)
- CE_PAGE (page)->security_setting = NM_SETTING_802_1X_SETTING_NAME;
+ ce_page_set_security_setting (CE_PAGE (page), NM_SETTING_802_1X_SETTING_NAME);
return CE_PAGE (page);
}
diff --git a/panels/network/connection-editor/ce-page-8021x-security.h
b/panels/network/connection-editor/ce-page-8021x-security.h
index 3bbac2a..69c9213 100644
--- a/panels/network/connection-editor/ce-page-8021x-security.h
+++ b/panels/network/connection-editor/ce-page-8021x-security.h
@@ -31,31 +31,9 @@
#include "ce-page.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;
-
- GtkSwitch *enabled;
- GtkWidget *security_widget;
- WirelessSecurity *security;
- GtkSizeGroup *group;
- gboolean initial_have_8021x;
-};
-
-struct CEPage8021xSecurityClass {
- CEPageClass parent;
-};
-
-GType ce_page_8021x_security_get_type (void);
+#define CE_TYPE_PAGE_8021X_SECURITY ce_page_8021x_security_get_type ()
+
+G_DECLARE_FINAL_TYPE (CEPage8021xSecurity, ce_page_8021x_security, CE, PAGE_8021X_SECURITY, CEPage)
CEPage *ce_page_8021x_security_new (NMConnection *connection,
NMClient *client);
diff --git a/panels/network/connection-editor/ce-page-details.c
b/panels/network/connection-editor/ce-page-details.c
index 2d85836..901e33d 100644
--- a/panels/network/connection-editor/ce-page-details.c
+++ b/panels/network/connection-editor/ce-page-details.c
@@ -23,12 +23,22 @@
#include <glib-object.h>
#include <glib/gi18n.h>
+#include <gtk/gtk.h>
#include <NetworkManager.h>
#include "../panel-common.h"
#include "ce-page-details.h"
+struct _CEPageDetails
+{
+ CEPage parent_instance;
+
+ NMDevice *device;
+ NMAccessPoint *ap;
+ NetConnectionEditor *editor;
+};
+
G_DEFINE_TYPE (CEPageDetails, ce_page_details, CE_TYPE_PAGE)
static void
@@ -109,7 +119,7 @@ update_last_used (CEPageDetails *page, NMConnection *connection)
else
last_used = g_strdup_printf (ngettext ("%i day ago", "%i days ago", days), days);
out:
- panel_set_device_widget_details (CE_PAGE (page)->builder, "last_used", last_used);
+ panel_set_device_widget_details (ce_page_get_builder (CE_PAGE (page)), "last_used", last_used);
if (now != NULL)
g_date_time_unref (now);
if (then != NULL)
@@ -123,7 +133,7 @@ all_user_changed (GtkToggleButton *b, CEPageDetails *page)
gboolean all_users;
NMSettingConnection *sc;
- sc = nm_connection_get_setting_connection (CE_PAGE (page)->connection);
+ sc = nm_connection_get_setting_connection (ce_page_get_connection (CE_PAGE (page)));
all_users = gtk_toggle_button_get_active (b);
g_object_set (sc, "permissions", NULL, NULL);
@@ -163,7 +173,7 @@ connect_details_page (CEPageDetails *page)
ac = nm_device_get_active_connection (page->device);
p1 = ac ? nm_active_connection_get_uuid (ac) : NULL;
- p2 = nm_connection_get_uuid (CE_PAGE (page)->connection);
+ p2 = nm_connection_get_uuid (ce_page_get_connection (CE_PAGE (page)));
if (g_strcmp0 (p1, p2) == 0) {
device_is_active = TRUE;
if (NM_IS_DEVICE_WIFI (page->device))
@@ -176,7 +186,7 @@ connect_details_page (CEPageDetails *page)
str = g_strdup_printf (_("%d Mb/s"), speed);
else
str = NULL;
- panel_set_device_widget_details (CE_PAGE (page)->builder, "speed", str);
+ panel_set_device_widget_details (ce_page_get_builder (CE_PAGE (page)), "speed", str);
g_clear_pointer (&str, g_free);
if (NM_IS_DEVICE_WIFI (page->device))
@@ -184,12 +194,12 @@ connect_details_page (CEPageDetails *page)
else if (NM_IS_DEVICE_ETHERNET (page->device))
str = nm_device_ethernet_get_hw_address (NM_DEVICE_ETHERNET (page->device));
- panel_set_device_widget_details (CE_PAGE (page)->builder, "mac", str);
+ panel_set_device_widget_details (ce_page_get_builder (CE_PAGE (page)), "mac", str);
str = NULL;
if (device_is_active && active_ap)
str = get_ap_security_string (active_ap);
- panel_set_device_widget_details (CE_PAGE (page)->builder, "security", str);
+ panel_set_device_widget_details (ce_page_get_builder (CE_PAGE (page)), "security", str);
g_clear_pointer (&str, g_free);
strength = 0;
@@ -208,30 +218,30 @@ connect_details_page (CEPageDetails *page)
str = C_("Signal strength", "Good");
else
str = C_("Signal strength", "Excellent");
- panel_set_device_widget_details (CE_PAGE (page)->builder, "strength", str);
+ panel_set_device_widget_details (ce_page_get_builder (CE_PAGE (page)), "strength", str);
/* set IP entries */
if (device_is_active)
- panel_set_device_widgets (CE_PAGE (page)->builder, page->device);
+ panel_set_device_widgets (ce_page_get_builder (CE_PAGE (page)), page->device);
else
- panel_unset_device_widgets (CE_PAGE (page)->builder);
+ panel_unset_device_widgets (ce_page_get_builder (CE_PAGE (page)));
- if (!device_is_active && CE_PAGE (page)->connection)
- update_last_used (page, CE_PAGE (page)->connection);
+ if (!device_is_active && ce_page_get_connection (CE_PAGE (page)))
+ update_last_used (page, ce_page_get_connection (CE_PAGE (page)));
else
- panel_set_device_widget_details (CE_PAGE (page)->builder, "last_used", NULL);
+ panel_set_device_widget_details (ce_page_get_builder (CE_PAGE (page)), "last_used", NULL);
/* Auto connect check */
- widget = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)),
"auto_connect_check"));
- sc = nm_connection_get_setting_connection (CE_PAGE (page)->connection);
+ sc = nm_connection_get_setting_connection (ce_page_get_connection (CE_PAGE (page)));
g_object_bind_property (sc, "autoconnect",
widget, "active",
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
g_signal_connect_swapped (widget, "toggled", G_CALLBACK (ce_page_changed), page);
/* All users check */
- widget = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)),
"all_user_check"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget),
nm_setting_connection_get_num_permissions (sc) == 0);
@@ -240,7 +250,7 @@ connect_details_page (CEPageDetails *page)
g_signal_connect_swapped (widget, "toggled", G_CALLBACK (ce_page_changed), page);
/* Forget button */
- widget = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "button_forget"));
+ widget = GTK_WIDGET (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "button_forget"));
g_signal_connect (widget, "clicked", G_CALLBACK (forget_cb), page);
type = nm_setting_connection_get_connection_type (sc);
diff --git a/panels/network/connection-editor/ce-page-details.h
b/panels/network/connection-editor/ce-page-details.h
index fb85a25..faea602 100644
--- a/panels/network/connection-editor/ce-page-details.h
+++ b/panels/network/connection-editor/ce-page-details.h
@@ -24,37 +24,14 @@
#include <glib-object.h>
-#include <gtk/gtk.h>
#include "net-connection-editor.h"
#include "ce-page.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))
+#define CE_TYPE_PAGE_DETAILS ce_page_details_get_type ()
-typedef struct _CEPageDetails CEPageDetails;
-typedef struct _CEPageDetailsClass CEPageDetailsClass;
-
-struct _CEPageDetails
-{
- CEPage parent;
-
- NMDevice *device;
- NMAccessPoint *ap;
- NetConnectionEditor *editor;
-};
-
-struct _CEPageDetailsClass
-{
- CEPageClass parent_class;
-};
-
-GType ce_page_details_get_type (void);
+G_DECLARE_FINAL_TYPE (CEPageDetails, ce_page_details, CE, PAGE_DETAILS, CEPage)
CEPage *ce_page_details_new (NMConnection *connection,
NMClient *client,
diff --git a/panels/network/connection-editor/ce-page-ethernet.c
b/panels/network/connection-editor/ce-page-ethernet.c
index 2163cdb..af0f671 100644
--- a/panels/network/connection-editor/ce-page-ethernet.c
+++ b/panels/network/connection-editor/ce-page-ethernet.c
@@ -24,13 +24,27 @@
#include <glib-object.h>
#include <glib/gi18n.h>
#include <net/if_arp.h>
+#include <gtk/gtk.h>
#include <NetworkManager.h>
-
#include "ce-page-ethernet.h"
#include "ui-helpers.h"
+struct _CEPageEthernet
+{
+ CEPage parent_instance;
+
+ NMSettingConnection *setting_connection;
+ NMSettingWired *setting_wired;
+
+ GtkEntry *name;
+ GtkComboBoxText *device_mac;
+ GtkEntry *cloned_mac;
+ GtkSpinButton *mtu;
+ GtkWidget *mtu_label;
+};
+
G_DEFINE_TYPE (CEPageEthernet, ce_page_ethernet, CE_TYPE_PAGE)
static void
@@ -56,7 +70,7 @@ connect_ethernet_page (CEPageEthernet *page)
gtk_entry_set_text (page->name, name);
/* Device MAC address */
- mac_list = ce_page_get_mac_list (CE_PAGE (page)->client, NM_TYPE_DEVICE_ETHERNET,
+ mac_list = ce_page_get_mac_list (ce_page_get_client (CE_PAGE (page)), NM_TYPE_DEVICE_ETHERNET,
NM_DEVICE_ETHERNET_PERMANENT_HW_ADDRESS);
s_mac_str = nm_setting_wired_get_mac_address (setting);
ce_page_setup_mac_combo (page->device_mac, s_mac_str, mac_list);
@@ -172,11 +186,11 @@ ce_page_ethernet_new (NMConnection *connection,
"/org/gnome/control-center/network/ethernet-page.ui",
_("Identity")));
- page->name = GTK_ENTRY (gtk_builder_get_object (CE_PAGE (page)->builder, "entry_name"));
- page->device_mac = GTK_COMBO_BOX_TEXT (gtk_builder_get_object (CE_PAGE (page)->builder,
"combo_mac"));
- page->cloned_mac = GTK_ENTRY (gtk_builder_get_object (CE_PAGE (page)->builder, "entry_cloned_mac"));
- page->mtu = GTK_SPIN_BUTTON (gtk_builder_get_object (CE_PAGE (page)->builder, "spin_mtu"));
- page->mtu_label = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "label_mtu"));
+ page->name = GTK_ENTRY (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "entry_name"));
+ page->device_mac = GTK_COMBO_BOX_TEXT (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)),
"combo_mac"));
+ page->cloned_mac = GTK_ENTRY (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)),
"entry_cloned_mac"));
+ page->mtu = GTK_SPIN_BUTTON (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)),
"spin_mtu"));
+ page->mtu_label = GTK_WIDGET (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)),
"label_mtu"));
page->setting_connection = nm_connection_get_setting_connection (connection);
page->setting_wired = nm_connection_get_setting_wired (connection);
diff --git a/panels/network/connection-editor/ce-page-ethernet.h
b/panels/network/connection-editor/ce-page-ethernet.h
index 9c7c07d..706f706 100644
--- a/panels/network/connection-editor/ce-page-ethernet.h
+++ b/panels/network/connection-editor/ce-page-ethernet.h
@@ -26,41 +26,13 @@
#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))
+#define CE_TYPE_PAGE_ETHERNET ce_page_ethernet_get_type ()
-typedef struct _CEPageEthernet CEPageEthernet;
-typedef struct _CEPageEthernetClass CEPageEthernetClass;
-
-struct _CEPageEthernet
-{
- CEPage parent;
-
- NMSettingConnection *setting_connection;
- NMSettingWired *setting_wired;
-
- GtkEntry *name;
- GtkComboBoxText *device_mac;
- GtkEntry *cloned_mac;
- GtkSpinButton *mtu;
- GtkWidget *mtu_label;
-};
-
-struct _CEPageEthernetClass
-{
- CEPageClass parent_class;
-};
-
-GType ce_page_ethernet_get_type (void);
+G_DECLARE_FINAL_TYPE (CEPageEthernet, ce_page_ethernet, CE, PAGE_ETHERNET, CEPage)
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 0f34f6f..52bb092 100644
--- a/panels/network/connection-editor/ce-page-ip4.c
+++ b/panels/network/connection-editor/ce-page-ip4.c
@@ -26,17 +26,33 @@
#include <arpa/inet.h>
#include <glib-object.h>
#include <glib/gi18n.h>
+#include <gtk/gtk.h>
#include <NetworkManager.h>
#include "shell/list-box-helper.h"
#include "ce-page-ip4.h"
#include "ui-helpers.h"
-#define RADIO_IS_ACTIVE(x) (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object(CE_PAGE
(page)->builder, x))))
+#define RADIO_IS_ACTIVE(x) (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
(gtk_builder_get_object(ce_page_get_builder (CE_PAGE (page)), x))))
static void ensure_empty_address_row (CEPageIP4 *page);
static void ensure_empty_routes_row (CEPageIP4 *page);
+struct _CEPageIP4
+{
+ CEPage parent_instance;
+
+ NMSettingIPConfig *setting;
+
+ GtkToggleButton *disabled;
+ GtkWidget *address_list;
+ GtkSwitch *auto_dns;
+ GtkWidget *dns_entry;
+ GtkSwitch *auto_routes;
+ GtkWidget *routes_list;
+ GtkWidget *never_default;
+};
+
G_DEFINE_TYPE (CEPageIP4, ce_page_ip4, CE_TYPE_PAGE)
enum {
@@ -70,7 +86,7 @@ method_changed (GtkToggleButton *radio, CEPageIP4 *page)
routes_enabled = !RADIO_IS_ACTIVE ("radio_local");
}
- widget = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "address_section"));
+ widget = GTK_WIDGET (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)),
"address_section"));
gtk_widget_set_visible (widget, addr_enabled);
gtk_widget_set_sensitive (page->dns_entry, dns_enabled);
gtk_widget_set_sensitive (page->routes_list, routes_enabled);
@@ -253,7 +269,7 @@ add_address_row (CEPageIP4 *page,
gtk_container_add (GTK_CONTAINER (row_box), delete_button);
g_object_set_data (G_OBJECT (row), "delete-button", delete_button);
- group = GTK_SIZE_GROUP (gtk_builder_get_object (CE_PAGE (page)->builder, "address_sizegroup"));
+ group = GTK_SIZE_GROUP (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)),
"address_sizegroup"));
gtk_size_group_add_widget (group, delete_button);
gtk_container_add (GTK_CONTAINER (row), row_box);
@@ -289,7 +305,7 @@ add_address_section (CEPageIP4 *page)
GtkWidget *list;
gint i;
- widget = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "address_section"));
+ widget = GTK_WIDGET (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)),
"address_section"));
page->address_list = list = gtk_list_box_new ();
gtk_list_box_set_selection_mode (GTK_LIST_BOX (list), GTK_SELECTION_NONE);
@@ -327,11 +343,11 @@ add_dns_section (CEPageIP4 *page)
GString *string;
gint i;
- page->auto_dns = GTK_SWITCH (gtk_builder_get_object (CE_PAGE (page)->builder, "auto_dns_switch"));
+ page->auto_dns = GTK_SWITCH (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)),
"auto_dns_switch"));
gtk_switch_set_active (page->auto_dns, !nm_setting_ip_config_get_ignore_auto_dns (page->setting));
g_signal_connect (page->auto_dns, "notify::active", G_CALLBACK (switch_toggled), page);
- page->dns_entry = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "dns_entry"));
+ page->dns_entry = GTK_WIDGET (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)),
"dns_entry"));
entry = GTK_ENTRY (page->dns_entry);
string = g_string_new ("");
@@ -412,7 +428,7 @@ add_route_row (CEPageIP4 *page,
gtk_widget_set_hexpand (widget, TRUE);
gtk_container_add (GTK_CONTAINER (row_box), widget);
- group = GTK_SIZE_GROUP (gtk_builder_get_object (CE_PAGE (page)->builder, "routes_metric_sizegroup"));
+ group = GTK_SIZE_GROUP (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)),
"routes_metric_sizegroup"));
gtk_size_group_add_widget (group, widget);
delete_button = gtk_button_new ();
@@ -426,7 +442,7 @@ add_route_row (CEPageIP4 *page,
gtk_container_add (GTK_CONTAINER (row_box), delete_button);
g_object_set_data (G_OBJECT (row), "delete-button", delete_button);
- group = GTK_SIZE_GROUP (gtk_builder_get_object (CE_PAGE (page)->builder, "routes_sizegroup"));
+ group = GTK_SIZE_GROUP (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)),
"routes_sizegroup"));
gtk_size_group_add_widget (group, delete_button);
gtk_container_add (GTK_CONTAINER (row), row_box);
@@ -461,14 +477,14 @@ add_routes_section (CEPageIP4 *page)
GtkWidget *list;
gint i;
- widget = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "routes_section"));
+ widget = GTK_WIDGET (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)),
"routes_section"));
page->routes_list = list = gtk_list_box_new ();
gtk_list_box_set_selection_mode (GTK_LIST_BOX (list), GTK_SELECTION_NONE);
gtk_list_box_set_header_func (GTK_LIST_BOX (list), cc_list_box_update_header_func, NULL, NULL);
gtk_list_box_set_sort_func (GTK_LIST_BOX (list), (GtkListBoxSortFunc)sort_first_last, NULL, NULL);
gtk_container_add (GTK_CONTAINER (widget), list);
- page->auto_routes = GTK_SWITCH (gtk_builder_get_object (CE_PAGE (page)->builder,
"auto_routes_switch"));
+ page->auto_routes = GTK_SWITCH (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)),
"auto_routes_switch"));
gtk_switch_set_active (page->auto_routes, !nm_setting_ip_config_get_ignore_auto_routes
(page->setting));
g_signal_connect (page->auto_routes, "notify::active", G_CALLBACK (switch_toggled), page);
@@ -519,13 +535,13 @@ connect_ip4_page (CEPageIP4 *page)
add_dns_section (page);
add_routes_section (page);
- page->disabled = GTK_TOGGLE_BUTTON (gtk_builder_get_object (CE_PAGE (page)->builder,
"radio_disabled"));
+ page->disabled = GTK_TOGGLE_BUTTON (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)),
"radio_disabled"));
str_method = nm_setting_ip_config_get_method (page->setting);
disabled = g_strcmp0 (str_method, NM_SETTING_IP4_CONFIG_METHOD_DISABLED) == 0;
gtk_toggle_button_set_active (page->disabled, disabled);
g_signal_connect_swapped (page->disabled, "notify::active", G_CALLBACK (ce_page_changed), page);
- content = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "page_content"));
+ content = GTK_WIDGET (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "page_content"));
g_object_bind_property (page->disabled, "active",
content, "sensitive",
G_BINDING_SYNC_CREATE | G_BINDING_INVERT_BOOLEAN);
@@ -541,15 +557,15 @@ connect_ip4_page (CEPageIP4 *page)
method = IP4_METHOD_DISABLED;
}
- page->never_default = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder,
"never_default_check"));
+ page->never_default = GTK_WIDGET (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)),
"never_default_check"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->never_default),
nm_setting_ip_config_get_never_default (page->setting));
g_signal_connect_swapped (page->never_default, "toggled", G_CALLBACK (ce_page_changed), page);
/* Connect radio buttons */
- radios[RADIO_AUTOMATIC] = GTK_TOGGLE_BUTTON (gtk_builder_get_object (CE_PAGE (page)->builder,
"radio_automatic"));
- radios[RADIO_LOCAL] = GTK_TOGGLE_BUTTON (gtk_builder_get_object (CE_PAGE (page)->builder,
"radio_local"));
- radios[RADIO_MANUAL] = GTK_TOGGLE_BUTTON (gtk_builder_get_object (CE_PAGE (page)->builder,
"radio_manual"));
+ radios[RADIO_AUTOMATIC] = GTK_TOGGLE_BUTTON (gtk_builder_get_object (ce_page_get_builder (CE_PAGE
(page)), "radio_automatic"));
+ radios[RADIO_LOCAL] = GTK_TOGGLE_BUTTON (gtk_builder_get_object (ce_page_get_builder (CE_PAGE
(page)), "radio_local"));
+ radios[RADIO_MANUAL] = GTK_TOGGLE_BUTTON (gtk_builder_get_object (ce_page_get_builder (CE_PAGE
(page)), "radio_manual"));
radios[RADIO_DISABLED] = page->disabled;
for (i = RADIO_AUTOMATIC; i < RADIO_DISABLED; i++)
diff --git a/panels/network/connection-editor/ce-page-ip4.h b/panels/network/connection-editor/ce-page-ip4.h
index 31a8eb6..8eb736a 100644
--- a/panels/network/connection-editor/ce-page-ip4.h
+++ b/panels/network/connection-editor/ce-page-ip4.h
@@ -24,42 +24,13 @@
#include <glib-object.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))
+#define CE_TYPE_PAGE_IP4 ce_page_ip4_get_type ()
-typedef struct _CEPageIP4 CEPageIP4;
-typedef struct _CEPageIP4Class CEPageIP4Class;
-
-struct _CEPageIP4
-{
- CEPage parent;
-
- NMSettingIPConfig *setting;
-
- GtkToggleButton *disabled;
- GtkWidget *address_list;
- GtkSwitch *auto_dns;
- GtkWidget *dns_entry;
- GtkSwitch *auto_routes;
- GtkWidget *routes_list;
- GtkWidget *never_default;
-};
-
-struct _CEPageIP4Class
-{
- CEPageClass parent_class;
-};
-
-GType ce_page_ip4_get_type (void);
+G_DECLARE_FINAL_TYPE (CEPageIP4, ce_page_ip4, CE, PAGE_IP4, CEPage)
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 c9daab1..ec6154a 100644
--- a/panels/network/connection-editor/ce-page-ip6.c
+++ b/panels/network/connection-editor/ce-page-ip6.c
@@ -26,17 +26,33 @@
#include <arpa/inet.h>
#include <glib-object.h>
#include <glib/gi18n.h>
+#include <gtk/gtk.h>
#include <NetworkManager.h>
#include "shell/list-box-helper.h"
#include "ce-page-ip6.h"
#include "ui-helpers.h"
-#define RADIO_IS_ACTIVE(x) (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object(CE_PAGE
(page)->builder, x))))
+#define RADIO_IS_ACTIVE(x) (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
(gtk_builder_get_object(ce_page_get_builder (CE_PAGE (page)), x))))
static void ensure_empty_address_row (CEPageIP6 *page);
static void ensure_empty_routes_row (CEPageIP6 *page);
+struct _CEPageIP6
+{
+ CEPage parent_instance;
+
+ NMSettingIPConfig *setting;
+
+ GtkToggleButton *disabled;
+ GtkWidget *address_list;
+ GtkSwitch *auto_dns;
+ GtkWidget *dns_entry;
+ GtkSwitch *auto_routes;
+ GtkWidget *routes_list;
+ GtkWidget *never_default;
+};
+
G_DEFINE_TYPE (CEPageIP6, ce_page_ip6, CE_TYPE_PAGE)
enum {
@@ -71,7 +87,7 @@ method_changed (GtkToggleButton *button, CEPageIP6 *page)
routes_enabled = !RADIO_IS_ACTIVE ("radio_local");
}
- widget = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "address_section"));
+ widget = GTK_WIDGET (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)),
"address_section"));
gtk_widget_set_visible (widget, addr_enabled);
gtk_widget_set_sensitive (page->dns_entry, dns_enabled);
gtk_widget_set_sensitive (page->routes_list, routes_enabled);
@@ -232,7 +248,7 @@ add_address_row (CEPageIP6 *page,
gtk_container_add (GTK_CONTAINER (row_box), delete_button);
g_object_set_data (G_OBJECT (row), "delete-button", delete_button);
- group = GTK_SIZE_GROUP (gtk_builder_get_object (CE_PAGE (page)->builder, "address_sizegroup"));
+ group = GTK_SIZE_GROUP (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)),
"address_sizegroup"));
gtk_size_group_add_widget (group, delete_button);
gtk_container_add (GTK_CONTAINER (row), row_box);
@@ -267,7 +283,7 @@ add_address_section (CEPageIP6 *page)
GtkWidget *list;
gint i;
- widget = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "address_section"));
+ widget = GTK_WIDGET (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)),
"address_section"));
page->address_list = list = gtk_list_box_new ();
gtk_list_box_set_selection_mode (GTK_LIST_BOX (list), GTK_SELECTION_NONE);
@@ -298,11 +314,11 @@ add_dns_section (CEPageIP6 *page)
GString *string;
gint i;
- page->auto_dns = GTK_SWITCH (gtk_builder_get_object (CE_PAGE (page)->builder, "auto_dns_switch"));
+ page->auto_dns = GTK_SWITCH (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)),
"auto_dns_switch"));
gtk_switch_set_active (page->auto_dns, !nm_setting_ip_config_get_ignore_auto_dns (page->setting));
g_signal_connect (page->auto_dns, "notify::active", G_CALLBACK (switch_toggled), page);
- page->dns_entry = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "dns_entry"));
+ page->dns_entry = GTK_WIDGET (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)),
"dns_entry"));
entry = GTK_ENTRY (page->dns_entry);
string = g_string_new ("");
@@ -380,7 +396,7 @@ add_route_row (CEPageIP6 *page,
gtk_widget_set_hexpand (widget, TRUE);
gtk_container_add (GTK_CONTAINER (row_box), widget);
- group = GTK_SIZE_GROUP (gtk_builder_get_object (CE_PAGE (page)->builder, "routes_metric_sizegroup"));
+ group = GTK_SIZE_GROUP (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)),
"routes_metric_sizegroup"));
gtk_size_group_add_widget (group, widget);
delete_button = gtk_button_new ();
@@ -394,7 +410,7 @@ add_route_row (CEPageIP6 *page,
gtk_container_add (GTK_CONTAINER (row_box), delete_button);
g_object_set_data (G_OBJECT (row), "delete-button", delete_button);
- group = GTK_SIZE_GROUP (gtk_builder_get_object (CE_PAGE (page)->builder, "routes_sizegroup"));
+ group = GTK_SIZE_GROUP (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)),
"routes_sizegroup"));
gtk_size_group_add_widget (group, delete_button);
gtk_container_add (GTK_CONTAINER (row), row_box);
@@ -435,14 +451,14 @@ add_routes_section (CEPageIP6 *page)
GtkWidget *list;
gint i;
- widget = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "routes_section"));
+ widget = GTK_WIDGET (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)),
"routes_section"));
page->routes_list = list = gtk_list_box_new ();
gtk_list_box_set_selection_mode (GTK_LIST_BOX (list), GTK_SELECTION_NONE);
gtk_list_box_set_header_func (GTK_LIST_BOX (list), cc_list_box_update_header_func, NULL, NULL);
gtk_list_box_set_sort_func (GTK_LIST_BOX (list), (GtkListBoxSortFunc)sort_first_last, NULL, NULL);
gtk_container_add (GTK_CONTAINER (widget), list);
- page->auto_routes = GTK_SWITCH (gtk_builder_get_object (CE_PAGE (page)->builder,
"auto_routes_switch"));
+ page->auto_routes = GTK_SWITCH (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)),
"auto_routes_switch"));
gtk_switch_set_active (page->auto_routes, !nm_setting_ip_config_get_ignore_auto_routes
(page->setting));
g_signal_connect (page->auto_routes, "notify::active", G_CALLBACK (switch_toggled), page);
@@ -489,13 +505,13 @@ connect_ip6_page (CEPageIP6 *page)
add_dns_section (page);
add_routes_section (page);
- page->disabled = GTK_TOGGLE_BUTTON (gtk_builder_get_object (CE_PAGE (page)->builder,
"radio_disabled"));
+ page->disabled = GTK_TOGGLE_BUTTON (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)),
"radio_disabled"));
str_method = nm_setting_ip_config_get_method (page->setting);
disabled = g_strcmp0 (str_method, NM_SETTING_IP6_CONFIG_METHOD_IGNORE) == 0;
gtk_toggle_button_set_active (page->disabled, disabled);
g_signal_connect_swapped (page->disabled, "notify::active", G_CALLBACK (ce_page_changed), page);
- content = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "page_content"));
+ content = GTK_WIDGET (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "page_content"));
g_object_bind_property (page->disabled, "active",
content, "sensitive",
G_BINDING_SYNC_CREATE | G_BINDING_INVERT_BOOLEAN);
@@ -513,17 +529,17 @@ connect_ip6_page (CEPageIP6 *page)
method = IP6_METHOD_IGNORE;
}
- page->never_default = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder,
"never_default_check"));
+ page->never_default = GTK_WIDGET (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)),
"never_default_check"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->never_default),
nm_setting_ip_config_get_never_default (page->setting));
g_signal_connect_swapped (page->never_default, "toggled", G_CALLBACK (ce_page_changed), page);
/* Connect radio buttons */
- radios[RADIO_AUTOMATIC] = GTK_TOGGLE_BUTTON (gtk_builder_get_object (CE_PAGE (page)->builder,
"radio_automatic"));
- radios[RADIO_DHCP] = GTK_TOGGLE_BUTTON (gtk_builder_get_object (CE_PAGE (page)->builder,
"radio_dhcp"));
- radios[RADIO_LOCAL] = GTK_TOGGLE_BUTTON (gtk_builder_get_object (CE_PAGE (page)->builder,
"radio_local"));
- radios[RADIO_MANUAL] = GTK_TOGGLE_BUTTON (gtk_builder_get_object (CE_PAGE (page)->builder,
"radio_manual"));
+ radios[RADIO_AUTOMATIC] = GTK_TOGGLE_BUTTON (gtk_builder_get_object (ce_page_get_builder (CE_PAGE
(page)), "radio_automatic"));
+ radios[RADIO_DHCP] = GTK_TOGGLE_BUTTON (gtk_builder_get_object (ce_page_get_builder (CE_PAGE
(page)), "radio_dhcp"));
+ radios[RADIO_LOCAL] = GTK_TOGGLE_BUTTON (gtk_builder_get_object (ce_page_get_builder (CE_PAGE
(page)), "radio_local"));
+ radios[RADIO_MANUAL] = GTK_TOGGLE_BUTTON (gtk_builder_get_object (ce_page_get_builder (CE_PAGE
(page)), "radio_manual"));
radios[RADIO_DISABLED] = page->disabled;
for (i = RADIO_AUTOMATIC; i < RADIO_DISABLED; i++)
diff --git a/panels/network/connection-editor/ce-page-ip6.h b/panels/network/connection-editor/ce-page-ip6.h
index 57933b7..104d19e 100644
--- a/panels/network/connection-editor/ce-page-ip6.h
+++ b/panels/network/connection-editor/ce-page-ip6.h
@@ -23,43 +23,15 @@
#define __CE_PAGE_IP6_H
#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))
+#define CE_TYPE_PAGE_IP6 ce_page_ip6_get_type ()
-typedef struct _CEPageIP6 CEPageIP6;
-typedef struct _CEPageIP6Class CEPageIP6Class;
-
-struct _CEPageIP6
-{
- CEPage parent;
-
- NMSettingIPConfig *setting;
-
- GtkToggleButton *disabled;
- GtkWidget *address_list;
- GtkSwitch *auto_dns;
- GtkWidget *dns_entry;
- GtkSwitch *auto_routes;
- GtkWidget *routes_list;
- GtkWidget *never_default;
-};
-
-struct _CEPageIP6Class
-{
- CEPageClass parent_class;
-};
-
-GType ce_page_ip6_get_type (void);
+G_DECLARE_FINAL_TYPE (CEPageIP6, ce_page_ip6, CE, PAGE_IP6, CEPage)
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 d06e3ae..59b1e32 100644
--- a/panels/network/connection-editor/ce-page-security.c
+++ b/panels/network/connection-editor/ce-page-security.c
@@ -29,6 +29,16 @@
#include "wireless-security.h"
#include "ce-page-security.h"
+struct _CEPageSecurity
+{
+ CEPage parent_instance;
+
+ GtkComboBox *security_combo;
+ GtkWidget *security_heading;
+ GtkSizeGroup *group;
+ gboolean adhoc;
+};
+
G_DEFINE_TYPE (CEPageSecurity, ce_page_security, CE_TYPE_PAGE)
enum {
@@ -129,7 +139,7 @@ security_combo_changed (GtkComboBox *combo,
wsec_size_group_clear (page->group);
- vbox = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "vbox"));
+ vbox = GTK_WIDGET (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "vbox"));
children = gtk_container_get_children (GTK_CONTAINER (vbox));
for (l = children; l; l = l->next) {
gtk_container_remove (GTK_CONTAINER (vbox), GTK_WIDGET (l->data));
@@ -200,7 +210,7 @@ set_sensitive (GtkCellLayout *cell_layout,
static void
finish_setup (CEPageSecurity *page)
{
- NMConnection *connection = CE_PAGE (page)->connection;
+ NMConnection *connection = ce_page_get_connection (CE_PAGE (page));
NMSettingWireless *sw;
NMSettingWirelessSecurity *sws;
gboolean is_adhoc = FALSE;
@@ -219,8 +229,8 @@ finish_setup (CEPageSecurity *page)
page->group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
- page->security_heading = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder,
"heading_sec"));
- page->security_combo = combo = GTK_COMBO_BOX (gtk_builder_get_object (CE_PAGE (page)->builder,
"combo_sec"));
+ page->security_heading = GTK_WIDGET (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)),
"heading_sec"));
+ page->security_combo = combo = GTK_COMBO_BOX (gtk_builder_get_object (ce_page_get_builder (CE_PAGE
(page)), "combo_sec"));
dev_caps = NM_WIFI_DEVICE_CAP_CIPHER_WEP40
| NM_WIFI_DEVICE_CAP_CIPHER_WEP104
@@ -452,13 +462,13 @@ ce_page_security_new (NMConnection *connection,
default_type == NMU_SEC_LEAP ||
default_type == NMU_SEC_WPA_PSK ||
default_type == NMU_SEC_WPA2_PSK) {
- CE_PAGE (page)->security_setting = NM_SETTING_WIRELESS_SECURITY_SETTING_NAME;
+ ce_page_set_security_setting (CE_PAGE (page), NM_SETTING_WIRELESS_SECURITY_SETTING_NAME);
}
if (default_type == NMU_SEC_DYNAMIC_WEP ||
default_type == NMU_SEC_WPA_ENTERPRISE ||
default_type == NMU_SEC_WPA2_ENTERPRISE) {
- CE_PAGE (page)->security_setting = NM_SETTING_802_1X_SETTING_NAME;
+ ce_page_set_security_setting (CE_PAGE (page), NM_SETTING_802_1X_SETTING_NAME);
}
g_signal_connect (page, "initialized", G_CALLBACK (finish_setup), NULL);
diff --git a/panels/network/connection-editor/ce-page-security.h
b/panels/network/connection-editor/ce-page-security.h
index fa7e731..d49b9b2 100644
--- a/panels/network/connection-editor/ce-page-security.h
+++ b/panels/network/connection-editor/ce-page-security.h
@@ -29,32 +29,9 @@
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))
+#define CE_TYPE_PAGE_SECURITY ce_page_security_get_type ()
-typedef struct _CEPageSecurity CEPageSecurity;
-typedef struct _CEPageSecurityClass CEPageSecurityClass;
-
-struct _CEPageSecurity
-{
- CEPage parent;
-
- GtkComboBox *security_combo;
- GtkWidget *security_heading;
- GtkSizeGroup *group;
- gboolean adhoc;
-};
-
-struct _CEPageSecurityClass
-{
- CEPageClass parent_class;
-};
-
-GType ce_page_security_get_type (void);
+G_DECLARE_FINAL_TYPE (CEPageSecurity, ce_page_security, CE, PAGE_SECURITY, CEPage)
CEPage *ce_page_security_new (NMConnection *connection,
NMClient *client);
diff --git a/panels/network/connection-editor/ce-page-vpn.c b/panels/network/connection-editor/ce-page-vpn.c
index dd6d42f..fa27d3f 100644
--- a/panels/network/connection-editor/ce-page-vpn.c
+++ b/panels/network/connection-editor/ce-page-vpn.c
@@ -23,12 +23,27 @@
#include <glib-object.h>
#include <glib/gi18n.h>
+#include <gtk/gtk.h>
#include <NetworkManager.h>
#include "ce-page-vpn.h"
#include "vpn-helpers.h"
+struct _CEPageVpn
+{
+ CEPage parent_instance;
+
+ NMSettingConnection *setting_connection;
+ NMSettingVpn *setting_vpn;
+
+ GtkEntry *name;
+ GtkBox *box;
+
+ 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
@@ -76,7 +91,6 @@ vpn_gnome3ify_editor (GtkWidget *widget)
static void
load_vpn_plugin (CEPageVpn *page, NMConnection *connection)
{
- CEPage *parent = CE_PAGE (page);
GtkWidget *ui_widget, *failure;
page->editor = nm_vpn_editor_plugin_get_editor (page->plugin,
@@ -93,7 +107,7 @@ load_vpn_plugin (CEPageVpn *page, NMConnection *connection)
}
vpn_gnome3ify_editor (ui_widget);
- failure = GTK_WIDGET (gtk_builder_get_object (parent->builder, "failure_label"));
+ failure = GTK_WIDGET (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)),
"failure_label"));
gtk_widget_destroy (failure);
gtk_box_pack_start (page->box, ui_widget, TRUE, TRUE, 0);
@@ -161,7 +175,7 @@ ce_page_vpn_class_init (CEPageVpnClass *class)
static void
finish_setup (CEPageVpn *page, gpointer unused, GError *error, gpointer user_data)
{
- NMConnection *connection = CE_PAGE (page)->connection;
+ NMConnection *connection = ce_page_get_connection (CE_PAGE (page));
const char *vpn_type;
page->setting_connection = nm_connection_get_setting_connection (connection);
@@ -187,12 +201,12 @@ ce_page_vpn_new (NMConnection *connection,
"/org/gnome/control-center/network/vpn-page.ui",
_("Identity")));
- page->name = GTK_ENTRY (gtk_builder_get_object (CE_PAGE (page)->builder, "entry_name"));
- page->box = GTK_BOX (gtk_builder_get_object (CE_PAGE (page)->builder, "page"));
+ page->name = GTK_ENTRY (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "entry_name"));
+ page->box = GTK_BOX (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "page"));
g_signal_connect (page, "initialized", G_CALLBACK (finish_setup), NULL);
- CE_PAGE (page)->security_setting = NM_SETTING_VPN_SETTING_NAME;
+ ce_page_set_security_setting (CE_PAGE (page), NM_SETTING_VPN_SETTING_NAME);
return CE_PAGE (page);
}
diff --git a/panels/network/connection-editor/ce-page-vpn.h b/panels/network/connection-editor/ce-page-vpn.h
index 9fa7066..83dedc3 100644
--- a/panels/network/connection-editor/ce-page-vpn.h
+++ b/panels/network/connection-editor/ce-page-vpn.h
@@ -26,41 +26,13 @@
#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))
+#define CE_TYPE_PAGE_VPN ce_page_vpn_get_type ()
-typedef struct _CEPageVpn CEPageVpn;
-typedef struct _CEPageVpnClass CEPageVpnClass;
-
-struct _CEPageVpn
-{
- CEPage parent;
-
- NMSettingConnection *setting_connection;
- NMSettingVpn *setting_vpn;
-
- GtkEntry *name;
- GtkBox *box;
-
- NMVpnEditorPlugin *plugin;
- NMVpnEditor *editor;
-};
-
-struct _CEPageVpnClass
-{
- CEPageClass parent_class;
-};
-
-GType ce_page_vpn_get_type (void);
+G_DECLARE_FINAL_TYPE (CEPageVpn, ce_page_vpn, CE, PAGE_VPN, CEPage)
CEPage *ce_page_vpn_new (NMConnection *connection,
NMClient *client);
diff --git a/panels/network/connection-editor/ce-page-wifi.c b/panels/network/connection-editor/ce-page-wifi.c
index 08e8e37..27dca5f 100644
--- a/panels/network/connection-editor/ce-page-wifi.c
+++ b/panels/network/connection-editor/ce-page-wifi.c
@@ -31,6 +31,13 @@
#include "ce-page-wifi.h"
#include "ui-helpers.h"
+struct _CEPageWifi
+{
+ CEPage parent_instance;
+
+ NMSettingWireless *setting;
+};
+
G_DEFINE_TYPE (CEPageWifi, ce_page_wifi, CE_TYPE_PAGE)
static void
@@ -47,7 +54,7 @@ connect_wifi_page (CEPageWifi *page)
const gchar *cloned_mac;
gint i;
- widget = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)),
"entry_ssid"));
ssid = nm_setting_wireless_get_ssid (page->setting);
@@ -60,7 +67,7 @@ connect_wifi_page (CEPageWifi *page)
g_signal_connect_swapped (widget, "changed", G_CALLBACK (ce_page_changed), page);
- widget = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)),
"combo_bssid"));
bssid_array = g_ptr_array_new ();
@@ -74,9 +81,9 @@ connect_wifi_page (CEPageWifi *page)
g_strfreev (bssid_list);
g_signal_connect_swapped (widget, "changed", G_CALLBACK (ce_page_changed), page);
- widget = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)),
"combo_mac"));
- mac_list = ce_page_get_mac_list (CE_PAGE (page)->client, NM_TYPE_DEVICE_WIFI,
+ mac_list = ce_page_get_mac_list (ce_page_get_client (CE_PAGE (page)), NM_TYPE_DEVICE_WIFI,
NM_DEVICE_WIFI_PERMANENT_HW_ADDRESS);
s_mac_str = nm_setting_wireless_get_mac_address (page->setting);
ce_page_setup_mac_combo (GTK_COMBO_BOX_TEXT (widget), s_mac_str, mac_list);
@@ -84,7 +91,7 @@ connect_wifi_page (CEPageWifi *page)
g_signal_connect_swapped (widget, "changed", G_CALLBACK (ce_page_changed), page);
- widget = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)),
"entry_cloned_mac"));
cloned_mac = nm_setting_wireless_get_cloned_mac_address (page->setting);
gtk_entry_set_text (GTK_ENTRY (widget), cloned_mac ? cloned_mac : "");
@@ -99,20 +106,20 @@ ui_to_setting (CEPageWifi *page)
GtkWidget *entry;
char *device_mac, *cloned_mac;
- entry = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "entry_ssid"));
+ entry = GTK_WIDGET (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)), "entry_ssid"));
utf8_ssid = gtk_entry_get_text (GTK_ENTRY (entry));
if (!utf8_ssid || !*utf8_ssid)
ssid = NULL;
else {
ssid = g_bytes_new_static (utf8_ssid, strlen (utf8_ssid));
}
- entry = gtk_bin_get_child (GTK_BIN (gtk_builder_get_object (CE_PAGE (page)->builder,
"combo_bssid")));
+ entry = gtk_bin_get_child (GTK_BIN (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)),
"combo_bssid")));
bssid = gtk_entry_get_text (GTK_ENTRY (entry));
if (*bssid == '\0')
bssid = NULL;
- entry = gtk_bin_get_child (GTK_BIN (gtk_builder_get_object (CE_PAGE (page)->builder, "combo_mac")));
+ entry = gtk_bin_get_child (GTK_BIN (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)),
"combo_mac")));
device_mac = ce_page_trim_address (gtk_entry_get_text (GTK_ENTRY (entry)));
- entry = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "entry_cloned_mac"));
+ entry = GTK_WIDGET (gtk_builder_get_object (ce_page_get_builder (CE_PAGE (page)),
"entry_cloned_mac"));
cloned_mac = ce_page_trim_address (gtk_entry_get_text (GTK_ENTRY (entry)));
g_object_set (page->setting,
@@ -136,7 +143,7 @@ validate (CEPage *page,
GtkWidget *entry;
gboolean ret = TRUE;
- entry = gtk_bin_get_child (GTK_BIN (gtk_builder_get_object (page->builder, "combo_bssid")));
+ entry = gtk_bin_get_child (GTK_BIN (gtk_builder_get_object (ce_page_get_builder (page),
"combo_bssid")));
if (!ce_page_address_is_valid (gtk_entry_get_text (GTK_ENTRY (entry)))) {
widget_set_error (entry);
ret = FALSE;
@@ -144,7 +151,7 @@ validate (CEPage *page,
widget_unset_error (entry);
}
- entry = gtk_bin_get_child (GTK_BIN (gtk_builder_get_object (page->builder, "combo_mac")));
+ entry = gtk_bin_get_child (GTK_BIN (gtk_builder_get_object (ce_page_get_builder (page),
"combo_mac")));
if (!ce_page_address_is_valid (gtk_entry_get_text (GTK_ENTRY (entry)))) {
widget_set_error (entry);
ret = FALSE;
@@ -152,7 +159,7 @@ validate (CEPage *page,
widget_unset_error (entry);
}
- entry = GTK_WIDGET (gtk_builder_get_object (page->builder, "entry_cloned_mac"));
+ entry = GTK_WIDGET (gtk_builder_get_object (ce_page_get_builder (page), "entry_cloned_mac"));
if (!ce_page_address_is_valid (gtk_entry_get_text (GTK_ENTRY (entry)))) {
widget_set_error (entry);
ret = FALSE;
diff --git a/panels/network/connection-editor/ce-page-wifi.h b/panels/network/connection-editor/ce-page-wifi.h
index 28c3024..007ad7e 100644
--- a/panels/network/connection-editor/ce-page-wifi.h
+++ b/panels/network/connection-editor/ce-page-wifi.h
@@ -29,29 +29,9 @@
G_BEGIN_DECLS
-#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))
+#define CE_TYPE_PAGE_WIFI ce_page_wifi_get_type ()
-typedef struct _CEPageWifi CEPageWifi;
-typedef struct _CEPageWifiClass CEPageWifiClass;
-
-struct _CEPageWifi
-{
- CEPage parent;
-
- NMSettingWireless *setting;
-};
-
-struct _CEPageWifiClass
-{
- CEPageClass parent_class;
-};
-
-GType ce_page_wifi_get_type (void);
+G_DECLARE_FINAL_TYPE (CEPageWifi, ce_page_wifi, CE, PAGE_WIFI, CEPage)
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 1b4e082..e892419 100644
--- a/panels/network/connection-editor/ce-page.c
+++ b/panels/network/connection-editor/ce-page.c
@@ -32,6 +32,18 @@
#include "ce-page.h"
+typedef struct
+{
+ gboolean initialized;
+ GtkBuilder *builder;
+ GtkWidget *page;
+ gchar *title;
+ const gchar *security_setting;
+
+ NMConnection *connection;
+ NMClient *client;
+ GCancellable *cancellable;
+} CEPagePrivate;
G_DEFINE_ABSTRACT_TYPE (CEPage, ce_page, G_TYPE_OBJECT)
@@ -65,10 +77,11 @@ static void
dispose (GObject *object)
{
CEPage *self = CE_PAGE (object);
+ CEPagePrivate *priv = ce_page_get_instance_private (self);
- g_clear_object (&self->page);
- g_clear_object (&self->builder);
- g_clear_object (&self->connection);
+ g_clear_object (&priv->page);
+ g_clear_object (&priv->builder);
+ g_clear_object (&priv->connection);
G_OBJECT_CLASS (ce_page_parent_class)->dispose (object);
}
@@ -77,38 +90,81 @@ static void
finalize (GObject *object)
{
CEPage *self = CE_PAGE (object);
+ CEPagePrivate *priv = ce_page_get_instance_private (self);
- g_free (self->title);
- if (self->cancellable) {
- g_cancellable_cancel (self->cancellable);
- g_object_unref (self->cancellable);
+ g_free (priv->title);
+ if (priv->cancellable) {
+ g_cancellable_cancel (priv->cancellable);
+ g_object_unref (priv->cancellable);
}
G_OBJECT_CLASS (ce_page_parent_class)->finalize (object);
}
+GtkBuilder *
+ce_page_get_builder (CEPage *self)
+{
+ CEPagePrivate *priv;
+
+ g_return_val_if_fail (CE_IS_PAGE (self), NULL);
+
+ priv = ce_page_get_instance_private (self);
+ return priv->builder;
+}
+
+NMConnection *
+ce_page_get_connection (CEPage *self)
+{
+ CEPagePrivate *priv;
+
+ g_return_val_if_fail (CE_IS_PAGE (self), NULL);
+
+ priv = ce_page_get_instance_private (self);
+ return priv->connection;
+}
+
+NMClient *
+ce_page_get_client (CEPage *self)
+{
+ CEPagePrivate *priv;
+
+ g_return_val_if_fail (CE_IS_PAGE (self), NULL);
+
+ priv = ce_page_get_instance_private (self);
+ return priv->client;
+}
+
GtkWidget *
ce_page_get_page (CEPage *self)
{
+ CEPagePrivate *priv;
+
g_return_val_if_fail (CE_IS_PAGE (self), NULL);
- return self->page;
+ priv = ce_page_get_instance_private (self);
+ return priv->page;
}
const char *
ce_page_get_title (CEPage *self)
{
+ CEPagePrivate *priv;
+
g_return_val_if_fail (CE_IS_PAGE (self), NULL);
- return self->title;
+ priv = ce_page_get_instance_private (self);
+ return priv->title;
}
gboolean
ce_page_get_initialized (CEPage *self)
{
+ CEPagePrivate *priv;
+
g_return_val_if_fail (CE_IS_PAGE (self), FALSE);
- return self->initialized;
+ priv = ce_page_get_instance_private (self);
+ return priv->initialized;
}
void
@@ -126,13 +182,14 @@ get_property (GObject *object,
GParamSpec *pspec)
{
CEPage *self = CE_PAGE (object);
+ CEPagePrivate *priv = ce_page_get_instance_private (self);
switch (prop_id) {
case PROP_CONNECTION:
- g_value_set_object (value, self->connection);
+ g_value_set_object (value, priv->connection);
break;
case PROP_INITIALIZED:
- g_value_set_boolean (value, self->initialized);
+ g_value_set_boolean (value, priv->initialized);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -147,12 +204,13 @@ set_property (GObject *object,
GParamSpec *pspec)
{
CEPage *self = CE_PAGE (object);
+ CEPagePrivate *priv = ce_page_get_instance_private (self);
switch (prop_id) {
case PROP_CONNECTION:
- if (self->connection)
- g_object_unref (self->connection);
- self->connection = g_value_dup_object (value);
+ if (priv->connection)
+ g_object_unref (priv->connection);
+ priv->connection = g_value_dup_object (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -163,8 +221,9 @@ set_property (GObject *object,
static void
ce_page_init (CEPage *self)
{
- self->builder = gtk_builder_new ();
- self->cancellable = g_cancellable_new ();
+ CEPagePrivate *priv = ce_page_get_instance_private (self);
+ priv->builder = gtk_builder_new ();
+ priv->cancellable = g_cancellable_new ();
}
static void
@@ -222,29 +281,31 @@ ce_page_new (GType type,
const gchar *title)
{
CEPage *page;
+ CEPagePrivate *priv;
GError *error = NULL;
page = CE_PAGE (g_object_new (type,
"connection", connection,
NULL));
- page->title = g_strdup (title);
- page->client = client;
+ priv = ce_page_get_instance_private (page);
+ priv->title = g_strdup (title);
+ priv->client = client;
if (ui_resource) {
- if (!gtk_builder_add_from_resource (page->builder, ui_resource, &error)) {
+ if (!gtk_builder_add_from_resource (priv->builder, ui_resource, &error)) {
g_warning ("Couldn't load builder file: %s", error->message);
g_error_free (error);
g_object_unref (page);
return NULL;
}
- page->page = GTK_WIDGET (gtk_builder_get_object (page->builder, "page"));
- if (!page->page) {
+ priv->page = GTK_WIDGET (gtk_builder_get_object (priv->builder, "page"));
+ if (!priv->page) {
g_warning ("Couldn't load page widget from %s", ui_resource);
g_object_unref (page);
return NULL;
}
- g_object_ref_sink (page->page);
+ g_object_ref_sink (priv->page);
}
return page;
@@ -254,7 +315,8 @@ static void
emit_initialized (CEPage *page,
GError *error)
{
- page->initialized = TRUE;
+ CEPagePrivate *priv = ce_page_get_instance_private (page);
+ priv->initialized = TRUE;
g_signal_emit (page, signals[INITIALIZED], 0, error);
g_clear_error (&error);
}
@@ -265,6 +327,7 @@ ce_page_complete_init (CEPage *page,
GVariant *secrets,
GError *error)
{
+ CEPagePrivate *priv = ce_page_get_instance_private (page);
GError *update_error = NULL;
GVariant *setting_dict;
gboolean ignore_error = FALSE;
@@ -299,7 +362,7 @@ ce_page_complete_init (CEPage *page,
g_variant_unref (setting_dict);
/* Update the connection with the new secrets */
- if (nm_connection_update_secrets (page->connection,
+ if (nm_connection_update_secrets (priv->connection,
setting_name,
secrets,
&update_error)) {
@@ -434,7 +497,23 @@ ce_page_address_is_valid (const gchar *addr)
const gchar *
ce_page_get_security_setting (CEPage *page)
{
- return page->security_setting;
+ CEPagePrivate *priv;
+
+ g_return_val_if_fail (CE_IS_PAGE (page), NULL);
+
+ priv = ce_page_get_instance_private (page);
+ return priv->security_setting;
+}
+
+void
+ce_page_set_security_setting (CEPage *page, const gchar *security_setting)
+{
+ CEPagePrivate *priv;
+
+ g_return_if_fail (CE_IS_PAGE (page));
+
+ priv = ce_page_get_instance_private (page);
+ priv->security_setting = g_strdup (security_setting);
}
gint
diff --git a/panels/network/connection-editor/ce-page.h b/panels/network/connection-editor/ce-page.h
index 34cf4af..b28bd6e 100644
--- a/panels/network/connection-editor/ce-page.h
+++ b/panels/network/connection-editor/ce-page.h
@@ -30,30 +30,9 @@
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))
+#define CE_TYPE_PAGE ce_page_get_type ()
-typedef struct _CEPage CEPage;
-typedef struct _CEPageClass CEPageClass;
-
-struct _CEPage
-{
- GObject parent;
-
- gboolean initialized;
- GtkBuilder *builder;
- GtkWidget *page;
- gchar *title;
- const gchar *security_setting;
-
- NMConnection *connection;
- NMClient *client;
- GCancellable *cancellable;
-};
+G_DECLARE_DERIVABLE_TYPE (CEPage, ce_page, CE, PAGE, GObject)
struct _CEPageClass
{
@@ -64,10 +43,13 @@ struct _CEPageClass
void (*initialized) (CEPage *page, GError *error);
};
-GType ce_page_get_type (void);
-
+GtkBuilder *ce_page_get_builder (CEPage *page);
+NMConnection *ce_page_get_connection (CEPage *page);
+NMClient *ce_page_get_client (CEPage *page);
GtkWidget *ce_page_get_page (CEPage *page);
const gchar *ce_page_get_title (CEPage *page);
+void ce_page_set_security_setting (CEPage *page,
+ const gchar *security_setting);
const gchar *ce_page_get_security_setting (CEPage *page);
gboolean ce_page_validate (CEPage *page,
NMConnection *connection,
diff --git a/panels/network/connection-editor/net-connection-editor.c
b/panels/network/connection-editor/net-connection-editor.c
index 8c21667..195bf76 100644
--- a/panels/network/connection-editor/net-connection-editor.c
+++ b/panels/network/connection-editor/net-connection-editor.c
@@ -47,6 +47,33 @@ enum {
static guint signals[LAST_SIGNAL] = { 0 };
+struct _NetConnectionEditor
+{
+ GObject parent_instance;
+
+ GtkWidget *parent_window;
+ NMClient *client;
+ NMDevice *device;
+
+ NMConnection *connection;
+ NMConnection *orig_connection;
+ gboolean is_new_connection;
+ gboolean is_changed;
+ NMAccessPoint *ap;
+
+ GtkBuilder *builder;
+ GtkWidget *window;
+
+ 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, G_TYPE_OBJECT)
static void page_changed (CEPage *page, gpointer user_data);
@@ -217,7 +244,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);
diff --git a/panels/network/connection-editor/net-connection-editor.h
b/panels/network/connection-editor/net-connection-editor.h
index 431edf2..b16b5cd 100644
--- a/panels/network/connection-editor/net-connection-editor.h
+++ b/panels/network/connection-editor/net-connection-editor.h
@@ -29,51 +29,10 @@
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))
+#define NET_TYPE_CONNECTION_EDITOR net_connection_editor_get_type ()
-typedef struct _NetConnectionEditor NetConnectionEditor;
-typedef struct _NetConnectionEditorClass NetConnectionEditorClass;
+G_DECLARE_FINAL_TYPE (NetConnectionEditor, net_connection_editor, NET, CONNECTION_EDITOR, GObject)
-struct _NetConnectionEditor
-{
- GObject parent;
-
- GtkWidget *parent_window;
- NMClient *client;
- NMDevice *device;
-
- NMConnection *connection;
- NMConnection *orig_connection;
- gboolean is_new_connection;
- gboolean is_changed;
- NMAccessPoint *ap;
-
- GtkBuilder *builder;
- GtkWidget *window;
-
- GSList *initializing_pages;
- GSList *pages;
-
- guint permission_id;
- NMClientPermissionResult can_modify;
-
- gboolean title_set;
- gboolean show_when_initialized;
-};
-
-struct _NetConnectionEditorClass
-{
- GObjectClass 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,
diff --git a/panels/network/net-device-ethernet.c b/panels/network/net-device-ethernet.c
index 86689b2..a0d4aba 100644
--- a/panels/network/net-device-ethernet.c
+++ b/panels/network/net-device-ethernet.c
@@ -34,6 +34,22 @@
#include "net-device-ethernet.h"
+struct _NetDeviceEthernet
+{
+ NetDeviceSimple parent_instance;
+
+ GtkBuilder *builder;
+
+ GtkWidget *list;
+ GtkWidget *scrolled_window;
+ GtkWidget *details;
+ GtkWidget *details_button;
+ GtkWidget *add_profile_button;
+ gboolean updating_device;
+
+ GHashTable *connections;
+};
+
G_DEFINE_TYPE (NetDeviceEthernet, net_device_ethernet, NET_TYPE_DEVICE_SIMPLE)
static char *
diff --git a/panels/network/net-device-ethernet.h b/panels/network/net-device-ethernet.h
index 0d92fd1..7427980 100644
--- a/panels/network/net-device-ethernet.h
+++ b/panels/network/net-device-ethernet.h
@@ -28,39 +28,9 @@
G_BEGIN_DECLS
-#define NET_TYPE_DEVICE_ETHERNET (net_device_ethernet_get_type ())
-#define NET_DEVICE_ETHERNET(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), NET_TYPE_DEVICE_ETHERNET,
NetDeviceEthernet))
-#define NET_DEVICE_ETHERNET_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), NET_TYPE_DEVICE_ETHERNET,
NetDeviceEthernetClass))
-#define NET_IS_DEVICE_ETHERNET(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), NET_TYPE_DEVICE_ETHERNET))
-#define NET_IS_DEVICE_ETHERNET_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), NET_TYPE_DEVICE_ETHERNET))
-#define NET_DEVICE_ETHERNET_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), NET_TYPE_DEVICE_ETHERNET,
NetDeviceEthernetClass))
+#define NET_TYPE_DEVICE_ETHERNET net_device_ethernet_get_type ()
-typedef struct _NetDeviceEthernetPrivate NetDeviceEthernetPrivate;
-typedef struct _NetDeviceEthernet NetDeviceEthernet;
-typedef struct _NetDeviceEthernetClass NetDeviceEthernetClass;
-
-struct _NetDeviceEthernet
-{
- NetDeviceSimple parent;
-
- GtkBuilder *builder;
-
- GtkWidget *list;
- GtkWidget *scrolled_window;
- GtkWidget *details;
- GtkWidget *details_button;
- GtkWidget *add_profile_button;
- gboolean updating_device;
-
- GHashTable *connections;
-};
-
-struct _NetDeviceEthernetClass
-{
- NetDeviceSimpleClass parent_class;
-};
-
-GType net_device_ethernet_get_type (void);
+G_DECLARE_FINAL_TYPE (NetDeviceEthernet, net_device_ethernet, NET, DEVICE_ETHERNET, NetDeviceSimple)
G_END_DECLS
diff --git a/panels/network/net-device-mobile.c b/panels/network/net-device-mobile.c
index 062e4d1..fc25bdc 100644
--- a/panels/network/net-device-mobile.c
+++ b/panels/network/net-device-mobile.c
@@ -33,12 +33,12 @@
#include "network-dialogs.h"
#include "net-device-mobile.h"
-#define NET_DEVICE_MOBILE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NET_TYPE_DEVICE_MOBILE,
NetDeviceMobilePrivate))
-
static void nm_device_mobile_refresh_ui (NetDeviceMobile *device_mobile);
-struct _NetDeviceMobilePrivate
+struct _NetDeviceMobile
{
+ NetDevice parent_instance;
+
GtkBuilder *builder;
gboolean updating_device;
@@ -76,14 +76,14 @@ device_mobile_proxy_add_to_stack (NetObject *object,
NetDeviceMobile *device_mobile = NET_DEVICE_MOBILE (object);
/* add widgets to size group */
- widget = GTK_WIDGET (gtk_builder_get_object (device_mobile->priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (device_mobile->builder,
"heading_imei"));
gtk_size_group_add_widget (heading_size_group, widget);
- widget = GTK_WIDGET (gtk_builder_get_object (device_mobile->priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (device_mobile->builder,
"heading_network"));
gtk_size_group_add_widget (heading_size_group, widget);
- widget = GTK_WIDGET (gtk_builder_get_object (device_mobile->priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (device_mobile->builder,
"vbox7"));
gtk_stack_add_named (stack, widget, net_object_get_id (object));
return widget;
@@ -116,7 +116,7 @@ mobile_connection_changed_cb (GtkComboBox *combo_box, NetDeviceMobile *device_mo
CcNetworkPanel *panel;
GtkWidget *toplevel;
- if (device_mobile->priv->updating_device)
+ if (device_mobile->updating_device)
goto out;
ret = gtk_combo_box_get_active_iter (combo_box, &iter);
@@ -187,12 +187,12 @@ mobilebb_enabled_toggled (NMClient *client,
}
}
- sw = GTK_SWITCH (gtk_builder_get_object (device_mobile->priv->builder,
+ sw = GTK_SWITCH (gtk_builder_get_object (device_mobile->builder,
"device_off_switch"));
- device_mobile->priv->updating_device = TRUE;
+ device_mobile->updating_device = TRUE;
gtk_switch_set_active (sw, enabled);
- device_mobile->priv->updating_device = FALSE;
+ device_mobile->updating_device = FALSE;
}
static void
@@ -201,7 +201,6 @@ device_add_device_connections (NetDeviceMobile *device_mobile,
GtkListStore *liststore,
GtkComboBox *combobox)
{
- NetDeviceMobilePrivate *priv = device_mobile->priv;
GSList *list, *l;
GtkTreeIter treeiter;
NMActiveConnection *active_connection;
@@ -224,9 +223,9 @@ device_add_device_connections (NetDeviceMobile *device_mobile,
if (active_connection != NULL &&
g_strcmp0 (nm_connection_get_uuid (connection),
nm_active_connection_get_uuid (active_connection)) == 0) {
- priv->updating_device = TRUE;
+ device_mobile->updating_device = TRUE;
gtk_combo_box_set_active_iter (combobox, &treeiter);
- priv->updating_device = FALSE;
+ device_mobile->updating_device = FALSE;
}
}
@@ -246,17 +245,17 @@ device_mobile_refresh_equipment_id (NetDeviceMobile *device_mobile)
{
const gchar *equipment_id = NULL;
- if (device_mobile->priv->mm_object != NULL) {
+ if (device_mobile->mm_object != NULL) {
MMModem *modem;
/* Modem interface should always be present */
- modem = mm_object_peek_modem (device_mobile->priv->mm_object);
+ modem = mm_object_peek_modem (device_mobile->mm_object);
equipment_id = mm_modem_get_equipment_identifier (modem);
/* Set equipment ID */
if (equipment_id != NULL) {
g_debug ("[%s] Equipment ID set to '%s'",
- mm_object_get_path (device_mobile->priv->mm_object),
+ mm_object_get_path (device_mobile->mm_object),
equipment_id);
}
} else {
@@ -265,7 +264,7 @@ device_mobile_refresh_equipment_id (NetDeviceMobile *device_mobile)
"ControlCenter::EquipmentIdentifier");
}
- panel_set_device_widget_details (device_mobile->priv->builder, "imei", equipment_id);
+ panel_set_device_widget_details (device_mobile->builder, "imei", equipment_id);
}
static gchar *
@@ -276,12 +275,12 @@ device_mobile_find_provider (NetDeviceMobile *device_mobile,
NMAMobileProvider *provider;
GString *name = NULL;
- if (device_mobile->priv->mpd == NULL) {
+ if (device_mobile->mpd == NULL) {
GError *error = NULL;
/* Use defaults */
- device_mobile->priv->mpd = nma_mobile_providers_database_new_sync (NULL, NULL, NULL, &error);
- if (device_mobile->priv->mpd == NULL) {
+ device_mobile->mpd = nma_mobile_providers_database_new_sync (NULL, NULL, NULL, &error);
+ if (device_mobile->mpd == NULL) {
g_debug ("Couldn't load mobile providers database: %s",
error ? error->message : "");
g_clear_error (&error);
@@ -290,13 +289,13 @@ device_mobile_find_provider (NetDeviceMobile *device_mobile,
}
if (mccmnc != NULL) {
- provider = nma_mobile_providers_database_lookup_3gpp_mcc_mnc (device_mobile->priv->mpd,
mccmnc);
+ provider = nma_mobile_providers_database_lookup_3gpp_mcc_mnc (device_mobile->mpd, mccmnc);
if (provider != NULL)
name = g_string_new (nma_mobile_provider_get_name (provider));
}
if (sid != 0) {
- provider = nma_mobile_providers_database_lookup_cdma_sid (device_mobile->priv->mpd, sid);
+ provider = nma_mobile_providers_database_lookup_cdma_sid (device_mobile->mpd, sid);
if (provider != NULL) {
if (name == NULL)
name = g_string_new (nma_mobile_provider_get_name (provider));
@@ -311,13 +310,13 @@ device_mobile_find_provider (NetDeviceMobile *device_mobile,
static void
device_mobile_refresh_operator_name (NetDeviceMobile *device_mobile)
{
- if (device_mobile->priv->mm_object != NULL) {
+ if (device_mobile->mm_object != NULL) {
gchar *operator_name = NULL;
MMModem3gpp *modem_3gpp;
MMModemCdma *modem_cdma;
- modem_3gpp = mm_object_peek_modem_3gpp (device_mobile->priv->mm_object);
- modem_cdma = mm_object_peek_modem_cdma (device_mobile->priv->mm_object);
+ modem_3gpp = mm_object_peek_modem_3gpp (device_mobile->mm_object);
+ modem_cdma = mm_object_peek_modem_cdma (device_mobile->mm_object);
if (modem_3gpp != NULL) {
const gchar *operator_name_unsafe;
@@ -343,11 +342,11 @@ device_mobile_refresh_operator_name (NetDeviceMobile *device_mobile)
/* Set operator name */
if (operator_name != NULL) {
g_debug ("[%s] Operator name set to '%s'",
- mm_object_get_path (device_mobile->priv->mm_object),
+ mm_object_get_path (device_mobile->mm_object),
operator_name);
}
- panel_set_device_widget_details (device_mobile->priv->builder, "provider", operator_name);
+ panel_set_device_widget_details (device_mobile->builder, "provider", operator_name);
g_free (operator_name);
} else {
const gchar *gsm;
@@ -363,14 +362,14 @@ device_mobile_refresh_operator_name (NetDeviceMobile *device_mobile)
gchar *both;
both = g_strdup_printf ("%s, %s", gsm, cdma);
- panel_set_device_widget_details (device_mobile->priv->builder, "provider", both);
+ panel_set_device_widget_details (device_mobile->builder, "provider", both);
g_free (both);
} else if (gsm != NULL) {
- panel_set_device_widget_details (device_mobile->priv->builder, "provider", gsm);
+ panel_set_device_widget_details (device_mobile->builder, "provider", gsm);
} else if (cdma != NULL) {
- panel_set_device_widget_details (device_mobile->priv->builder, "provider", cdma);
+ panel_set_device_widget_details (device_mobile->builder, "provider", cdma);
} else {
- panel_set_device_widget_details (device_mobile->priv->builder, "provider", NULL);
+ panel_set_device_widget_details (device_mobile->builder, "provider", NULL);
}
}
}
@@ -381,7 +380,6 @@ nm_device_mobile_refresh_ui (NetDeviceMobile *device_mobile)
gboolean is_connected;
GtkListStore *liststore;
GtkWidget *widget;
- NetDeviceMobilePrivate *priv = device_mobile->priv;
NMClient *client;
NMDeviceModemCapabilities caps;
NMDevice *nm_device;
@@ -389,20 +387,20 @@ nm_device_mobile_refresh_ui (NetDeviceMobile *device_mobile)
nm_device = net_device_get_nm_device (NET_DEVICE (device_mobile));
/* set device kind */
- widget = GTK_WIDGET (gtk_builder_get_object (device_mobile->priv->builder, "label_device"));
+ widget = GTK_WIDGET (gtk_builder_get_object (device_mobile->builder, "label_device"));
g_object_bind_property (device_mobile, "title", widget, "label", 0);
/* set up the device on/off switch */
- widget = GTK_WIDGET (gtk_builder_get_object (device_mobile->priv->builder, "device_off_switch"));
+ widget = GTK_WIDGET (gtk_builder_get_object (device_mobile->builder, "device_off_switch"));
gtk_widget_show (widget);
client = net_object_get_client (NET_OBJECT (device_mobile));
mobilebb_enabled_toggled (client, NULL, device_mobile);
/* set device state, with status */
- panel_set_device_status (device_mobile->priv->builder, "label_status", nm_device, NULL);
+ panel_set_device_status (device_mobile->builder, "label_status", nm_device, NULL);
/* sensitive for other connection types if the device is currently connected */
- widget = GTK_WIDGET (gtk_builder_get_object (device_mobile->priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (device_mobile->builder,
"button_options"));
is_connected = net_device_get_find_connection (NET_DEVICE (device_mobile)) != NULL;
gtk_widget_set_sensitive (widget, is_connected);
@@ -416,16 +414,16 @@ nm_device_mobile_refresh_ui (NetDeviceMobile *device_mobile)
}
/* add possible connections to device */
- liststore = GTK_LIST_STORE (gtk_builder_get_object (priv->builder,
+ liststore = GTK_LIST_STORE (gtk_builder_get_object (device_mobile->builder,
"liststore_mobile_connections"));
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "combobox_network"));
+ widget = GTK_WIDGET (gtk_builder_get_object (device_mobile->builder, "combobox_network"));
device_add_device_connections (device_mobile,
nm_device,
liststore,
GTK_COMBO_BOX (widget));
/* set IP entries */
- panel_set_device_widgets (priv->builder, nm_device);
+ panel_set_device_widgets (device_mobile->builder, nm_device);
}
static void
@@ -447,7 +445,7 @@ device_off_toggled (GtkSwitch *sw,
NMConnection *connection;
NMClient *client;
- if (device_mobile->priv->updating_device)
+ if (device_mobile->updating_device)
return;
active = gtk_switch_get_active (sw);
@@ -625,8 +623,8 @@ device_mobile_device_got_modem_manager_gsm_cb (GObject *source_object,
GError *error = NULL;
NetDeviceMobile *device_mobile = (NetDeviceMobile *)user_data;
- device_mobile->priv->gsm_proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
- if (device_mobile->priv->gsm_proxy == NULL) {
+ device_mobile->gsm_proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
+ if (device_mobile->gsm_proxy == NULL) {
g_warning ("Error creating ModemManager GSM proxy: %s\n",
error->message);
g_error_free (error);
@@ -634,13 +632,13 @@ device_mobile_device_got_modem_manager_gsm_cb (GObject *source_object,
}
/* Setup value updates */
- g_signal_connect (device_mobile->priv->gsm_proxy,
+ g_signal_connect (device_mobile->gsm_proxy,
"g-signal",
G_CALLBACK (device_mobile_gsm_signal_cb),
device_mobile);
/* Load initial value */
- g_dbus_proxy_call (device_mobile->priv->gsm_proxy,
+ g_dbus_proxy_call (device_mobile->gsm_proxy,
"GetRegistrationInfo",
NULL,
G_DBUS_CALL_FLAGS_NONE,
@@ -697,8 +695,8 @@ device_mobile_device_got_modem_manager_cdma_cb (GObject *source_object,
GError *error = NULL;
NetDeviceMobile *device_mobile = (NetDeviceMobile *)user_data;
- device_mobile->priv->cdma_proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
- if (device_mobile->priv->cdma_proxy == NULL) {
+ device_mobile->cdma_proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
+ if (device_mobile->cdma_proxy == NULL) {
g_warning ("Error creating ModemManager CDMA proxy: %s\n",
error->message);
g_error_free (error);
@@ -706,7 +704,7 @@ device_mobile_device_got_modem_manager_cdma_cb (GObject *source_object,
}
/* Load initial value */
- g_dbus_proxy_call (device_mobile->priv->cdma_proxy,
+ g_dbus_proxy_call (device_mobile->cdma_proxy,
"GetServingSystem",
NULL,
G_DBUS_CALL_FLAGS_NONE,
@@ -793,17 +791,17 @@ net_device_mobile_setup_modem_object (NetDeviceMobile *self)
{
MMModem3gpp *modem_3gpp;
- if (self->priv->mm_object == NULL)
+ if (self->mm_object == NULL)
return;
/* Load equipment ID initially */
device_mobile_refresh_equipment_id (self);
/* Follow changes in operator name and load initial values */
- modem_3gpp = mm_object_peek_modem_3gpp (self->priv->mm_object);
+ modem_3gpp = mm_object_peek_modem_3gpp (self->mm_object);
if (modem_3gpp != NULL) {
- g_assert (self->priv->operator_name_updated == 0);
- self->priv->operator_name_updated = g_signal_connect (modem_3gpp,
+ g_assert (self->operator_name_updated == 0);
+ self->operator_name_updated = g_signal_connect (modem_3gpp,
"notify::operator-name",
G_CALLBACK (operator_name_updated),
self);
@@ -822,7 +820,7 @@ net_device_mobile_get_property (GObject *device_,
switch (prop_id) {
case PROP_MODEM_OBJECT:
- g_value_set_object (value, self->priv->mm_object);
+ g_value_set_object (value, self->mm_object);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (self, prop_id, pspec);
@@ -840,7 +838,7 @@ net_device_mobile_set_property (GObject *device_,
switch (prop_id) {
case PROP_MODEM_OBJECT:
- self->priv->mm_object = g_value_dup_object (value);
+ self->mm_object = g_value_dup_object (value);
net_device_mobile_setup_modem_object (self);
break;
default:
@@ -853,19 +851,18 @@ static void
net_device_mobile_dispose (GObject *object)
{
NetDeviceMobile *device_mobile = NET_DEVICE_MOBILE (object);
- NetDeviceMobilePrivate *priv = device_mobile->priv;
- g_clear_object (&priv->builder);
- g_clear_object (&priv->gsm_proxy);
- g_clear_object (&priv->cdma_proxy);
+ g_clear_object (&device_mobile->builder);
+ g_clear_object (&device_mobile->gsm_proxy);
+ g_clear_object (&device_mobile->cdma_proxy);
- if (priv->operator_name_updated) {
- g_assert (priv->mm_object != NULL);
- g_signal_handler_disconnect (mm_object_peek_modem_3gpp (priv->mm_object),
priv->operator_name_updated);
- priv->operator_name_updated = 0;
+ if (device_mobile->operator_name_updated) {
+ g_assert (device_mobile->mm_object != NULL);
+ g_signal_handler_disconnect (mm_object_peek_modem_3gpp (device_mobile->mm_object),
device_mobile->operator_name_updated);
+ device_mobile->operator_name_updated = 0;
}
- g_clear_object (&priv->mm_object);
- g_clear_object (&priv->mpd);
+ g_clear_object (&device_mobile->mm_object);
+ g_clear_object (&device_mobile->mpd);
G_OBJECT_CLASS (net_device_mobile_parent_class)->dispose (object);
}
@@ -883,8 +880,6 @@ net_device_mobile_class_init (NetDeviceMobileClass *klass)
parent_class->add_to_stack = device_mobile_proxy_add_to_stack;
parent_class->refresh = device_mobile_refresh;
- g_type_class_add_private (klass, sizeof (NetDeviceMobilePrivate));
-
g_object_class_install_property (object_class,
PROP_MODEM_OBJECT,
g_param_spec_object ("mm-object",
@@ -902,10 +897,8 @@ net_device_mobile_init (NetDeviceMobile *device_mobile)
GtkCellRenderer *renderer;
GtkComboBox *combobox;
- device_mobile->priv = NET_DEVICE_MOBILE_GET_PRIVATE (device_mobile);
-
- device_mobile->priv->builder = gtk_builder_new ();
- gtk_builder_add_from_resource (device_mobile->priv->builder,
+ device_mobile->builder = gtk_builder_new ();
+ gtk_builder_add_from_resource (device_mobile->builder,
"/org/gnome/control-center/network/network-mobile.ui",
&error);
if (error != NULL) {
@@ -915,7 +908,7 @@ net_device_mobile_init (NetDeviceMobile *device_mobile)
}
/* setup mobile combobox model */
- combobox = GTK_COMBO_BOX (gtk_builder_get_object (device_mobile->priv->builder,
+ combobox = GTK_COMBO_BOX (gtk_builder_get_object (device_mobile->builder,
"combobox_network"));
g_signal_connect (combobox, "changed",
G_CALLBACK (mobile_connection_changed_cb),
@@ -928,12 +921,12 @@ net_device_mobile_init (NetDeviceMobile *device_mobile)
"text", COLUMN_TITLE,
NULL);
- widget = GTK_WIDGET (gtk_builder_get_object (device_mobile->priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (device_mobile->builder,
"device_off_switch"));
g_signal_connect (widget, "notify::active",
G_CALLBACK (device_off_toggled), device_mobile);
- widget = GTK_WIDGET (gtk_builder_get_object (device_mobile->priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (device_mobile->builder,
"button_options"));
g_signal_connect (widget, "clicked",
G_CALLBACK (edit_connection), device_mobile);
diff --git a/panels/network/net-device-mobile.h b/panels/network/net-device-mobile.h
index 4dd2bd8..e26542a 100644
--- a/panels/network/net-device-mobile.h
+++ b/panels/network/net-device-mobile.h
@@ -29,29 +29,9 @@
G_BEGIN_DECLS
-#define NET_TYPE_DEVICE_MOBILE (net_device_mobile_get_type ())
-#define NET_DEVICE_MOBILE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), NET_TYPE_DEVICE_MOBILE,
NetDeviceMobile))
-#define NET_DEVICE_MOBILE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), NET_TYPE_DEVICE_MOBILE,
NetDeviceMobileClass))
-#define NET_IS_DEVICE_MOBILE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), NET_TYPE_DEVICE_MOBILE))
-#define NET_IS_DEVICE_MOBILE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), NET_TYPE_DEVICE_MOBILE))
-#define NET_DEVICE_MOBILE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), NET_TYPE_DEVICE_MOBILE,
NetDeviceMobileClass))
-
-typedef struct _NetDeviceMobilePrivate NetDeviceMobilePrivate;
-typedef struct _NetDeviceMobile NetDeviceMobile;
-typedef struct _NetDeviceMobileClass NetDeviceMobileClass;
-
-struct _NetDeviceMobile
-{
- NetDevice parent;
- NetDeviceMobilePrivate *priv;
-};
-
-struct _NetDeviceMobileClass
-{
- NetDeviceClass parent_class;
-};
-
-GType net_device_mobile_get_type (void);
+#define NET_TYPE_DEVICE_MOBILE net_device_mobile_get_type ()
+
+G_DECLARE_FINAL_TYPE (NetDeviceMobile, net_device_mobile, NET, DEVICE_MOBILE, NetDevice)
G_END_DECLS
diff --git a/panels/network/net-device-simple.c b/panels/network/net-device-simple.c
index e1c06c6..d95e966 100644
--- a/panels/network/net-device-simple.c
+++ b/panels/network/net-device-simple.c
@@ -31,24 +31,23 @@
#include "net-device-simple.h"
-#define NET_DEVICE_SIMPLE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NET_TYPE_DEVICE_SIMPLE,
NetDeviceSimplePrivate))
-
-struct _NetDeviceSimplePrivate
+typedef struct
{
GtkBuilder *builder;
gboolean updating_device;
-};
+} NetDeviceSimplePrivate;
-G_DEFINE_TYPE (NetDeviceSimple, net_device_simple, NET_TYPE_DEVICE)
+G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (NetDeviceSimple, net_device_simple, NET_TYPE_DEVICE)
void
net_device_simple_set_show_separator (NetDeviceSimple *device_simple,
gboolean show_separator)
{
+ NetDeviceSimplePrivate *priv = net_device_simple_get_instance_private (device_simple);
GtkWidget *widget;
/* add widgets to size group */
- widget = GTK_WIDGET (gtk_builder_get_object (device_simple->priv->builder, "separator"));
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "separator"));
gtk_widget_set_visible (widget, show_separator);
}
@@ -59,9 +58,10 @@ device_simple_proxy_add_to_stack (NetObject *object,
{
GtkWidget *widget;
NetDeviceSimple *device_simple = NET_DEVICE_SIMPLE (object);
+ NetDeviceSimplePrivate *priv = net_device_simple_get_instance_private (device_simple);
/* add widgets to size group */
- widget = GTK_WIDGET (gtk_builder_get_object (device_simple->priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
"vbox6"));
gtk_stack_add_named (stack, widget, net_object_get_id (object));
return widget;
@@ -72,7 +72,9 @@ update_off_switch_from_device_state (GtkSwitch *sw,
NMDeviceState state,
NetDeviceSimple *device_simple)
{
- device_simple->priv->updating_device = TRUE;
+ NetDeviceSimplePrivate *priv = net_device_simple_get_instance_private (device_simple);
+
+ priv->updating_device = TRUE;
switch (state) {
case NM_DEVICE_STATE_UNMANAGED:
case NM_DEVICE_STATE_UNAVAILABLE:
@@ -85,13 +87,13 @@ update_off_switch_from_device_state (GtkSwitch *sw,
gtk_switch_set_active (sw, TRUE);
break;
}
- device_simple->priv->updating_device = FALSE;
+ priv->updating_device = FALSE;
}
static void
nm_device_simple_refresh_ui (NetDeviceSimple *device_simple)
{
- NetDeviceSimplePrivate *priv = device_simple->priv;
+ NetDeviceSimplePrivate *priv = net_device_simple_get_instance_private (device_simple);
GtkWidget *widget;
NMDevice *nm_device;
NMDeviceState state;
@@ -127,6 +129,7 @@ device_off_toggled (GtkSwitch *sw,
GParamSpec *pspec,
NetDeviceSimple *device_simple)
{
+ NetDeviceSimplePrivate *priv = net_device_simple_get_instance_private (device_simple);
const GPtrArray *acs;
gboolean active;
gint i;
@@ -134,7 +137,7 @@ device_off_toggled (GtkSwitch *sw,
NMConnection *connection;
NMClient *client;
- if (device_simple->priv->updating_device)
+ if (priv->updating_device)
return;
active = gtk_switch_get_active (sw);
@@ -186,7 +189,7 @@ static void
net_device_simple_finalize (GObject *object)
{
NetDeviceSimple *device_simple = NET_DEVICE_SIMPLE (object);
- NetDeviceSimplePrivate *priv = device_simple->priv;
+ NetDeviceSimplePrivate *priv = net_device_simple_get_instance_private (device_simple);
g_object_unref (priv->builder);
@@ -211,20 +214,17 @@ net_device_simple_class_init (NetDeviceSimpleClass *klass)
parent_class->add_to_stack = device_simple_proxy_add_to_stack;
parent_class->refresh = device_simple_refresh;
simple_class->get_speed = device_simple_get_speed;
-
- g_type_class_add_private (klass, sizeof (NetDeviceSimplePrivate));
}
static void
net_device_simple_init (NetDeviceSimple *device_simple)
{
+ NetDeviceSimplePrivate *priv = net_device_simple_get_instance_private (device_simple);
GError *error = NULL;
GtkWidget *widget;
- device_simple->priv = NET_DEVICE_SIMPLE_GET_PRIVATE (device_simple);
-
- device_simple->priv->builder = gtk_builder_new ();
- gtk_builder_add_from_resource (device_simple->priv->builder,
+ priv->builder = gtk_builder_new ();
+ gtk_builder_add_from_resource (priv->builder,
"/org/gnome/control-center/network/network-simple.ui",
&error);
if (error != NULL) {
@@ -234,12 +234,12 @@ net_device_simple_init (NetDeviceSimple *device_simple)
}
/* setup simple combobox model */
- widget = GTK_WIDGET (gtk_builder_get_object (device_simple->priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
"device_off_switch"));
g_signal_connect (widget, "notify::active",
G_CALLBACK (device_off_toggled), device_simple);
- widget = GTK_WIDGET (gtk_builder_get_object (device_simple->priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
"button_options"));
g_signal_connect (widget, "clicked",
G_CALLBACK (edit_connection), device_simple);
@@ -258,7 +258,7 @@ net_device_simple_add_row (NetDeviceSimple *device_simple,
const char *label_string,
const char *property_name)
{
- NetDeviceSimplePrivate *priv = device_simple->priv;
+ NetDeviceSimplePrivate *priv = net_device_simple_get_instance_private (device_simple);
GtkGrid *grid;
GtkWidget *label, *value;
GtkStyleContext *context;
diff --git a/panels/network/net-device-simple.h b/panels/network/net-device-simple.h
index b2ba642..4c14a7e 100644
--- a/panels/network/net-device-simple.h
+++ b/panels/network/net-device-simple.h
@@ -29,22 +29,9 @@
G_BEGIN_DECLS
-#define NET_TYPE_DEVICE_SIMPLE (net_device_simple_get_type ())
-#define NET_DEVICE_SIMPLE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), NET_TYPE_DEVICE_SIMPLE,
NetDeviceSimple))
-#define NET_DEVICE_SIMPLE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), NET_TYPE_DEVICE_SIMPLE,
NetDeviceSimpleClass))
-#define NET_IS_DEVICE_SIMPLE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), NET_TYPE_DEVICE_SIMPLE))
-#define NET_IS_DEVICE_SIMPLE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), NET_TYPE_DEVICE_SIMPLE))
-#define NET_DEVICE_SIMPLE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), NET_TYPE_DEVICE_SIMPLE,
NetDeviceSimpleClass))
+#define NET_TYPE_DEVICE_SIMPLE net_device_simple_get_type ()
-typedef struct _NetDeviceSimplePrivate NetDeviceSimplePrivate;
-typedef struct _NetDeviceSimple NetDeviceSimple;
-typedef struct _NetDeviceSimpleClass NetDeviceSimpleClass;
-
-struct _NetDeviceSimple
-{
- NetDevice parent;
- NetDeviceSimplePrivate *priv;
-};
+G_DECLARE_DERIVABLE_TYPE (NetDeviceSimple, net_device_simple, NET, DEVICE_SIMPLE, NetDevice)
struct _NetDeviceSimpleClass
{
diff --git a/panels/network/net-device-wifi.c b/panels/network/net-device-wifi.c
index a502d14..ad7c3b3 100644
--- a/panels/network/net-device-wifi.c
+++ b/panels/network/net-device-wifi.c
@@ -37,8 +37,6 @@
#include "connection-editor/net-connection-editor.h"
#include "net-device-wifi.h"
-#define NET_DEVICE_WIFI_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NET_TYPE_DEVICE_WIFI,
NetDeviceWifiPrivate))
-
typedef enum {
NM_AP_SEC_UNKNOWN,
NM_AP_SEC_NONE,
@@ -52,8 +50,10 @@ static void show_wifi_list (NetDeviceWifi *device_wifi);
static void populate_ap_list (NetDeviceWifi *device_wifi);
static void show_hotspot_ui (NetDeviceWifi *device_wifi);
-struct _NetDeviceWifiPrivate
+struct _NetDeviceWifi
{
+ NetDevice parent_instance;
+
GtkBuilder *builder;
GtkWidget *details_dialog;
GtkSwitch *hotspot_switch;
@@ -83,13 +83,13 @@ enum {
GtkWidget *
net_device_wifi_get_header_widget (NetDeviceWifi *device_wifi)
{
- return GTK_WIDGET (gtk_builder_get_object (device_wifi->priv->builder, "header_box"));
+ return GTK_WIDGET (gtk_builder_get_object (device_wifi->builder, "header_box"));
}
GtkWidget *
net_device_wifi_get_title_widget (NetDeviceWifi *device_wifi)
{
- return GTK_WIDGET (gtk_builder_get_object (device_wifi->priv->builder, "center_box"));
+ return GTK_WIDGET (gtk_builder_get_object (device_wifi->builder, "center_box"));
}
static GtkWidget *
@@ -104,11 +104,11 @@ device_wifi_proxy_add_to_stack (NetObject *object,
nmdevice = net_device_get_nm_device (NET_DEVICE (object));
/* add widgets to size group */
- widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->builder,
"heading_ipv4"));
gtk_size_group_add_widget (heading_size_group, widget);
- widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->builder,
"notebook_view"));
gtk_stack_add_titled (stack, widget,
net_object_get_id (object),
@@ -277,12 +277,12 @@ wireless_enabled_toggled (NMClient *client,
return;
enabled = nm_client_wireless_get_enabled (client);
- sw = GTK_SWITCH (gtk_builder_get_object (device_wifi->priv->builder,
+ sw = GTK_SWITCH (gtk_builder_get_object (device_wifi->builder,
"device_off_switch"));
- device_wifi->priv->updating_device = TRUE;
+ device_wifi->updating_device = TRUE;
gtk_switch_set_active (sw, enabled);
- device_wifi->priv->updating_device = FALSE;
+ device_wifi->updating_device = FALSE;
}
static NMConnection *
@@ -454,16 +454,16 @@ nm_device_wifi_refresh_hotspot (NetDeviceWifi *device_wifi)
g_debug ("Refreshing hotspot labels to name: '%s', security key: '%s', security: '%s'",
hotspot_ssid, hotspot_secret, hotspot_security);
- panel_set_device_widget_details (device_wifi->priv->builder,
+ panel_set_device_widget_details (device_wifi->builder,
"hotspot_network_name",
hotspot_ssid);
- panel_set_device_widget_details (device_wifi->priv->builder,
+ panel_set_device_widget_details (device_wifi->builder,
"hotspot_security_key",
hotspot_secret);
- panel_set_device_widget_details (device_wifi->priv->builder,
+ panel_set_device_widget_details (device_wifi->builder,
"hotspot_security",
hotspot_security);
- panel_set_device_widget_details (device_wifi->priv->builder,
+ panel_set_device_widget_details (device_wifi->builder,
"hotspot_connected",
NULL);
@@ -504,7 +504,7 @@ update_last_used (NetDeviceWifi *device_wifi, NMConnection *connection)
else
last_used = g_strdup_printf (ngettext ("%i day ago", "%i days ago", days), days);
out:
- panel_set_device_widget_details (device_wifi->priv->builder,
+ panel_set_device_widget_details (device_wifi->builder,
"last_used",
last_used);
if (now != NULL)
@@ -527,7 +527,6 @@ nm_device_wifi_refresh_ui (NetDeviceWifi *device_wifi)
NMClient *client;
NMAccessPoint *ap;
NMConnection *connection;
- NetDeviceWifiPrivate *priv = device_wifi->priv;
GtkWidget *dialog;
if (device_is_hotspot (device_wifi)) {
@@ -538,7 +537,7 @@ nm_device_wifi_refresh_ui (NetDeviceWifi *device_wifi)
nm_device = net_device_get_nm_device (NET_DEVICE (device_wifi));
- dialog = device_wifi->priv->details_dialog;
+ dialog = device_wifi->details_dialog;
ap = g_object_get_data (G_OBJECT (dialog), "ap");
connection = g_object_get_data (G_OBJECT (dialog), "connection");
@@ -560,13 +559,13 @@ nm_device_wifi_refresh_ui (NetDeviceWifi *device_wifi)
/* Translators: network device speed */
str_tmp = g_strdup_printf (_("%d Mb/s"), speed);
}
- panel_set_device_widget_details (device_wifi->priv->builder,
+ panel_set_device_widget_details (device_wifi->builder,
"speed",
str_tmp);
/* device MAC */
str = nm_device_wifi_get_hw_address (NM_DEVICE_WIFI (nm_device));
- panel_set_device_widget_details (device_wifi->priv->builder,
+ panel_set_device_widget_details (device_wifi->builder,
"mac",
str);
/* security */
@@ -574,7 +573,7 @@ nm_device_wifi_refresh_ui (NetDeviceWifi *device_wifi)
str_tmp = NULL;
else if (active_ap != NULL)
str_tmp = get_ap_security_string (active_ap);
- panel_set_device_widget_details (device_wifi->priv->builder,
+ panel_set_device_widget_details (device_wifi->builder,
"security",
str_tmp);
g_free (str_tmp);
@@ -596,7 +595,7 @@ nm_device_wifi_refresh_ui (NetDeviceWifi *device_wifi)
str = C_("Signal strength", "Good");
else
str = C_("Signal strength", "Excellent");
- panel_set_device_widget_details (device_wifi->priv->builder,
+ panel_set_device_widget_details (device_wifi->builder,
"strength",
str);
@@ -605,20 +604,20 @@ nm_device_wifi_refresh_ui (NetDeviceWifi *device_wifi)
str = NULL;
else
str = nm_device_wifi_get_hw_address (NM_DEVICE_WIFI (nm_device));
- panel_set_device_widget_details (priv->builder, "mac", str);
+ panel_set_device_widget_details (device_wifi->builder, "mac", str);
/* set IP entries */
if (ap != active_ap)
- panel_unset_device_widgets (priv->builder);
+ panel_unset_device_widgets (device_wifi->builder);
else
- panel_set_device_widgets (priv->builder, nm_device);
+ panel_set_device_widgets (device_wifi->builder, nm_device);
if (ap != active_ap && connection)
update_last_used (device_wifi, connection);
else
- panel_set_device_widget_details (priv->builder, "last_used", NULL);
+ panel_set_device_widget_details (device_wifi->builder, "last_used", NULL);
- panel_set_device_status (priv->builder, "heading_status", nm_device, NULL);
+ panel_set_device_status (device_wifi->builder, "heading_status", nm_device, NULL);
/* update list of APs */
show_wifi_list (device_wifi);
@@ -640,7 +639,7 @@ device_off_toggled (GtkSwitch *sw,
NMClient *client;
gboolean active;
- if (device_wifi->priv->updating_device)
+ if (device_wifi->updating_device)
return;
client = net_object_get_client (NET_OBJECT (device_wifi));
@@ -738,7 +737,7 @@ wireless_try_to_connect (NetDeviceWifi *device_wifi,
NMSettingWireless *setting_wireless;
NMClient *client;
- if (device_wifi->priv->updating_device)
+ if (device_wifi->updating_device)
goto out;
if (ap_object_path == NULL || ap_object_path[0] == 0)
@@ -991,13 +990,13 @@ show_hotspot_ui (NetDeviceWifi *device_wifi)
GtkWidget *widget;
/* show hotspot tab */
- widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->priv->builder, "notebook_view"));
+ widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->builder, "notebook_view"));
gtk_notebook_set_current_page (GTK_NOTEBOOK (widget), 1);
/* force switch to on as this succeeded */
- device_wifi->priv->updating_device = TRUE;
- gtk_switch_set_active (device_wifi->priv->hotspot_switch, TRUE);
- device_wifi->priv->updating_device = FALSE;
+ device_wifi->updating_device = TRUE;
+ gtk_switch_set_active (device_wifi->hotspot_switch, TRUE);
+ device_wifi->updating_device = FALSE;
}
static void
@@ -1353,9 +1352,9 @@ stop_shared_connection (NetDeviceWifi *device_wifi)
if (!found) {
g_warning ("Could not stop hotspot connection as no connection attached to the device could
be found.");
- device_wifi->priv->updating_device = TRUE;
- gtk_switch_set_active (device_wifi->priv->hotspot_switch, TRUE);
- device_wifi->priv->updating_device = FALSE;
+ device_wifi->updating_device = TRUE;
+ gtk_switch_set_active (device_wifi->hotspot_switch, TRUE);
+ device_wifi->updating_device = FALSE;
return;
}
@@ -1368,9 +1367,9 @@ stop_hotspot_response_cb (GtkWidget *dialog, gint response, NetDeviceWifi *devic
if (response == GTK_RESPONSE_OK) {
stop_shared_connection (device_wifi);
} else {
- device_wifi->priv->updating_device = TRUE;
- gtk_switch_set_active (device_wifi->priv->hotspot_switch, TRUE);
- device_wifi->priv->updating_device = FALSE;
+ device_wifi->updating_device = TRUE;
+ gtk_switch_set_active (device_wifi->hotspot_switch, TRUE);
+ device_wifi->updating_device = FALSE;
}
gtk_widget_destroy (dialog);
}
@@ -1384,7 +1383,7 @@ switch_hotspot_changed_cb (GtkSwitch *sw,
GtkWidget *window;
CcNetworkPanel *panel;
- if (device_wifi->priv->updating_device)
+ if (device_wifi->updating_device)
return;
panel = net_object_get_panel (NET_OBJECT (device_wifi));
@@ -1407,7 +1406,7 @@ static void
show_wifi_list (NetDeviceWifi *device_wifi)
{
GtkWidget *widget;
- widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->priv->builder, "notebook_view"));
+ widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->builder, "notebook_view"));
gtk_notebook_set_current_page (GTK_NOTEBOOK (widget), 0);
}
@@ -1441,7 +1440,7 @@ client_connection_removed_cb (NMClient *client,
uuid = nm_connection_get_uuid (NM_CONNECTION (connection));
- list = GTK_WIDGET (gtk_builder_get_object (device_wifi->priv->builder, "listbox"));
+ list = GTK_WIDGET (gtk_builder_get_object (device_wifi->builder, "listbox"));
rows = gtk_container_get_children (GTK_CONTAINER (list));
for (l = rows; l != NULL; l = l->next) {
GtkWidget *row = l->data;
@@ -1487,7 +1486,7 @@ net_device_wifi_constructed (GObject *object)
device_wifi, 0);
/* only enable the button if the user can create a hotspot */
- widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->builder,
"start_hotspot_button"));
perm = nm_client_get_permission_result (client, NM_CLIENT_PERMISSION_WIFI_SHARE_OPEN);
caps = nm_device_wifi_get_capabilities (NM_DEVICE_WIFI (nm_device));
@@ -1506,7 +1505,7 @@ net_device_wifi_constructed (GObject *object)
g_signal_connect (client, NM_CLIENT_CONNECTION_REMOVED,
G_CALLBACK (client_connection_removed_cb), device_wifi);
- widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->priv->builder, "heading_list"));
+ widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->builder, "heading_list"));
g_object_bind_property (device_wifi, "title", widget, "label", 0);
nm_device_wifi_refresh_ui (device_wifi);
@@ -1516,13 +1515,12 @@ static void
net_device_wifi_finalize (GObject *object)
{
NetDeviceWifi *device_wifi = NET_DEVICE_WIFI (object);
- NetDeviceWifiPrivate *priv = device_wifi->priv;
- g_clear_pointer (&priv->details_dialog, gtk_widget_destroy);
- g_object_unref (priv->builder);
- g_free (priv->selected_ssid_title);
- g_free (priv->selected_connection_id);
- g_free (priv->selected_ap_id);
+ g_clear_pointer (&device_wifi->details_dialog, gtk_widget_destroy);
+ g_object_unref (device_wifi->builder);
+ g_free (device_wifi->selected_ssid_title);
+ g_free (device_wifi->selected_connection_id);
+ g_free (device_wifi->selected_ap_id);
G_OBJECT_CLASS (net_device_wifi_parent_class)->finalize (object);
}
@@ -1538,7 +1536,7 @@ device_wifi_edit (NetObject *object)
NMRemoteConnection *connection;
client = net_object_get_client (object);
- connection = nm_client_get_connection_by_path (client, device->priv->selected_connection_id);
+ connection = nm_client_get_connection_by_path (client, device->selected_connection_id);
if (connection == NULL) {
g_warning ("failed to get remote connection");
return;
@@ -1564,8 +1562,6 @@ net_device_wifi_class_init (NetDeviceWifiClass *klass)
parent_class->add_to_stack = device_wifi_proxy_add_to_stack;
parent_class->refresh = device_wifi_refresh;
parent_class->edit = device_wifi_edit;
-
- g_type_class_add_private (klass, sizeof (NetDeviceWifiPrivate));
}
static void
@@ -2059,7 +2055,7 @@ populate_ap_list (NetDeviceWifi *device_wifi)
GtkWidget *button;
GList *children, *child;
- list = GTK_WIDGET (gtk_builder_get_object (device_wifi->priv->builder, "listbox"));
+ list = GTK_WIDGET (gtk_builder_get_object (device_wifi->builder, "listbox"));
children = gtk_container_get_children (GTK_CONTAINER (list));
for (child = children; child; child = child->next) {
@@ -2163,10 +2159,8 @@ net_device_wifi_init (NetDeviceWifi *device_wifi)
GtkSizeGroup *rows;
GtkSizeGroup *icons;
- device_wifi->priv = NET_DEVICE_WIFI_GET_PRIVATE (device_wifi);
-
- device_wifi->priv->builder = gtk_builder_new ();
- gtk_builder_add_from_resource (device_wifi->priv->builder,
+ device_wifi->builder = gtk_builder_new ();
+ gtk_builder_add_from_resource (device_wifi->builder,
"/org/gnome/control-center/network/network-wifi.ui",
&error);
if (error != NULL) {
@@ -2175,17 +2169,17 @@ net_device_wifi_init (NetDeviceWifi *device_wifi)
return;
}
- widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->builder,
"details_dialog"));
- device_wifi->priv->details_dialog = widget;
+ device_wifi->details_dialog = widget;
/* setup wifi views */
- widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->builder,
"device_off_switch"));
g_signal_connect (widget, "notify::active",
G_CALLBACK (device_off_toggled), device_wifi);
- list = GTK_WIDGET (gtk_builder_get_object (device_wifi->priv->builder, "listbox"));
+ list = GTK_WIDGET (gtk_builder_get_object (device_wifi->builder, "listbox"));
gtk_list_box_set_header_func (GTK_LIST_BOX (list), cc_list_box_update_header_func, NULL, NULL);
gtk_list_box_set_sort_func (GTK_LIST_BOX (list), (GtkListBoxSortFunc)ap_sort, NULL, NULL);
g_signal_connect (list, "row-activated",
@@ -2197,29 +2191,29 @@ net_device_wifi_init (NetDeviceWifi *device_wifi)
g_object_set_data_full (G_OBJECT (list), "icons", icons, g_object_unref);
/* setup view */
- widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->builder,
"notebook_view"));
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (widget), FALSE);
gtk_notebook_set_current_page (GTK_NOTEBOOK (widget), 0);
- widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->builder,
"start_hotspot_button"));
g_signal_connect (widget, "clicked",
G_CALLBACK (start_hotspot), device_wifi);
- widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->builder,
"connect_hidden_button"));
g_signal_connect_swapped (widget, "clicked",
G_CALLBACK (connect_to_hidden_network), device_wifi);
- widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->builder,
"history_button"));
g_signal_connect_swapped (widget, "clicked",
G_CALLBACK (open_history), device_wifi);
- widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->builder,
"switch_hotspot_off"));
- device_wifi->priv->hotspot_switch = GTK_SWITCH (widget);
+ device_wifi->hotspot_switch = GTK_SWITCH (widget);
g_signal_connect (widget, "notify::active",
G_CALLBACK (switch_hotspot_changed_cb), device_wifi);
}
diff --git a/panels/network/net-device-wifi.h b/panels/network/net-device-wifi.h
index d8baf50..73e0f81 100644
--- a/panels/network/net-device-wifi.h
+++ b/panels/network/net-device-wifi.h
@@ -28,30 +28,12 @@
G_BEGIN_DECLS
-#define NET_TYPE_DEVICE_WIFI (net_device_wifi_get_type ())
-#define NET_DEVICE_WIFI(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), NET_TYPE_DEVICE_WIFI, NetDeviceWifi))
-#define NET_DEVICE_WIFI_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), NET_TYPE_DEVICE_WIFI,
NetDeviceWifiClass))
-#define NET_IS_DEVICE_WIFI(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), NET_TYPE_DEVICE_WIFI))
-#define NET_IS_DEVICE_WIFI_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), NET_TYPE_DEVICE_WIFI))
-#define NET_DEVICE_WIFI_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), NET_TYPE_DEVICE_WIFI,
NetDeviceWifiClass))
-
-typedef struct _NetDeviceWifiPrivate NetDeviceWifiPrivate;
-typedef struct _NetDeviceWifi NetDeviceWifi;
-typedef struct _NetDeviceWifiClass NetDeviceWifiClass;
-
-struct _NetDeviceWifi
-{
- NetDevice parent;
- NetDeviceWifiPrivate *priv;
-};
-
-struct _NetDeviceWifiClass
-{
- NetDeviceClass parent_class;
-};
-
-GType net_device_wifi_get_type (void) G_GNUC_CONST;
+#define NET_TYPE_DEVICE_WIFI net_device_wifi_get_type ()
+
+G_DECLARE_FINAL_TYPE (NetDeviceWifi, net_device_wifi, NET, DEVICE_WIFI, NetDevice)
+
GtkWidget *net_device_wifi_get_header_widget (NetDeviceWifi *device_wifi);
+
GtkWidget *net_device_wifi_get_title_widget (NetDeviceWifi *device_wifi);
G_END_DECLS
diff --git a/panels/network/net-device.c b/panels/network/net-device.c
index 95b556e..8c8bf45 100644
--- a/panels/network/net-device.c
+++ b/panels/network/net-device.c
@@ -30,13 +30,11 @@
#include "net-device.h"
-#define NET_DEVICE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NET_TYPE_DEVICE, NetDevicePrivate))
-
-struct _NetDevicePrivate
+typedef struct
{
NMDevice *nm_device;
guint changed_id;
-};
+} NetDevicePrivate;
enum {
PROP_0,
@@ -124,12 +122,13 @@ compare_mac_device_with_mac_connection (NMDevice *device,
static NMConnection *
net_device_real_get_find_connection (NetDevice *device)
{
+ NetDevicePrivate *priv = net_device_get_instance_private (device);
GSList *list, *iterator;
NMConnection *connection = NULL;
NMActiveConnection *ac;
/* is the device available in a active connection? */
- ac = nm_device_get_active_connection (device->priv->nm_device);
+ ac = nm_device_get_active_connection (priv->nm_device);
if (ac)
return (NMConnection*) nm_active_connection_get_connection (ac);
@@ -145,7 +144,7 @@ net_device_real_get_find_connection (NetDevice *device)
/* is there connection with the MAC address of the device? */
for (iterator = list; iterator; iterator = iterator->next) {
connection = iterator->data;
- if (compare_mac_device_with_mac_connection (device->priv->nm_device,
+ if (compare_mac_device_with_mac_connection (priv->nm_device,
connection)) {
goto out;
}
@@ -179,8 +178,10 @@ state_changed_cb (NMDevice *device,
NMDevice *
net_device_get_nm_device (NetDevice *device)
{
+ NetDevicePrivate *priv;
g_return_val_if_fail (NET_IS_DEVICE (device), NULL);
- return device->priv->nm_device;
+ priv = net_device_get_instance_private (device);
+ return priv->nm_device;
}
static void
@@ -213,7 +214,7 @@ net_device_get_property (GObject *device_,
GParamSpec *pspec)
{
NetDevice *net_device = NET_DEVICE (device_);
- NetDevicePrivate *priv = net_device->priv;
+ NetDevicePrivate *priv = net_device_get_instance_private (net_device);
switch (prop_id) {
case PROP_DEVICE:
@@ -235,7 +236,7 @@ net_device_set_property (GObject *device_,
GParamSpec *pspec)
{
NetDevice *net_device = NET_DEVICE (device_);
- NetDevicePrivate *priv = net_device->priv;
+ NetDevicePrivate *priv = net_device_get_instance_private (net_device);
switch (prop_id) {
case PROP_DEVICE:
@@ -262,7 +263,7 @@ static void
net_device_finalize (GObject *object)
{
NetDevice *device = NET_DEVICE (object);
- NetDevicePrivate *priv = device->priv;
+ NetDevicePrivate *priv = net_device_get_instance_private (device);
if (priv->changed_id != 0) {
g_signal_handler_disconnect (priv->nm_device,
@@ -290,14 +291,11 @@ net_device_class_init (NetDeviceClass *klass)
NM_TYPE_DEVICE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
g_object_class_install_property (object_class, PROP_DEVICE, pspec);
-
- g_type_class_add_private (klass, sizeof (NetDevicePrivate));
}
static void
net_device_init (NetDevice *device)
{
- device->priv = NET_DEVICE_GET_PRIVATE (device);
}
NetDevice *
diff --git a/panels/network/net-device.h b/panels/network/net-device.h
index 1364595..6f8cc43 100644
--- a/panels/network/net-device.h
+++ b/panels/network/net-device.h
@@ -29,22 +29,9 @@
G_BEGIN_DECLS
-#define NET_TYPE_DEVICE (net_device_get_type ())
-#define NET_DEVICE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), NET_TYPE_DEVICE, NetDevice))
-#define NET_DEVICE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), NET_TYPE_DEVICE, NetDeviceClass))
-#define NET_IS_DEVICE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), NET_TYPE_DEVICE))
-#define NET_IS_DEVICE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), NET_TYPE_DEVICE))
-#define NET_DEVICE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), NET_TYPE_DEVICE, NetDeviceClass))
+#define NET_TYPE_DEVICE net_device_get_type ()
-typedef struct _NetDevicePrivate NetDevicePrivate;
-typedef struct _NetDevice NetDevice;
-typedef struct _NetDeviceClass NetDeviceClass;
-
-struct _NetDevice
-{
- NetObject parent;
- NetDevicePrivate *priv;
-};
+G_DECLARE_DERIVABLE_TYPE (NetDevice, net_device, NET, DEVICE, NetObject)
struct _NetDeviceClass
{
@@ -53,7 +40,6 @@ struct _NetDeviceClass
NMConnection * (*get_find_connection) (NetDevice *device);
};
-GType net_device_get_type (void);
NetDevice *net_device_new (void);
NMDevice *net_device_get_nm_device (NetDevice *device);
NMConnection *net_device_get_find_connection (NetDevice *device);
diff --git a/panels/network/net-object.c b/panels/network/net-object.c
index cb96d5c..584bf95 100644
--- a/panels/network/net-object.c
+++ b/panels/network/net-object.c
@@ -26,9 +26,7 @@
#include "net-object.h"
-#define NET_OBJECT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NET_TYPE_OBJECT, NetObjectPrivate))
-
-struct _NetObjectPrivate
+typedef struct
{
gchar *id;
gchar *title;
@@ -36,7 +34,7 @@ struct _NetObjectPrivate
GCancellable *cancellable;
NMClient *client;
CcNetworkPanel *panel;
-};
+} NetObjectPrivate;
enum {
PROP_0,
@@ -61,77 +59,117 @@ G_DEFINE_TYPE (NetObject, net_object, G_TYPE_OBJECT)
void
net_object_emit_changed (NetObject *object)
{
+ NetObjectPrivate *priv;
+
g_return_if_fail (NET_IS_OBJECT (object));
- g_debug ("NetObject: %s emit 'changed'", object->priv->id);
+
+ priv = net_object_get_instance_private (object);
+ g_debug ("NetObject: %s emit 'changed'", priv->id);
g_signal_emit (object, signals[SIGNAL_CHANGED], 0);
}
void
net_object_emit_removed (NetObject *object)
{
+ NetObjectPrivate *priv;
+
g_return_if_fail (NET_IS_OBJECT (object));
- g_debug ("NetObject: %s emit 'removed'", object->priv->id);
+
+ priv = net_object_get_instance_private (object);
+ g_debug ("NetObject: %s emit 'removed'", priv->id);
g_signal_emit (object, signals[SIGNAL_REMOVED], 0);
}
const gchar *
net_object_get_id (NetObject *object)
{
+ NetObjectPrivate *priv;
+
g_return_val_if_fail (NET_IS_OBJECT (object), NULL);
- return object->priv->id;
+
+ priv = net_object_get_instance_private (object);
+ return priv->id;
}
void
net_object_set_id (NetObject *object, const gchar *id)
{
+ NetObjectPrivate *priv;
+
g_return_if_fail (NET_IS_OBJECT (object));
- g_clear_pointer (&object->priv->id, g_free);
- object->priv->id = g_strdup (id);
+
+ priv = net_object_get_instance_private (object);
+ g_clear_pointer (&priv->id, g_free);
+ priv->id = g_strdup (id);
g_object_notify (G_OBJECT (object), "id");
}
gboolean
net_object_get_removable (NetObject *object)
{
+ NetObjectPrivate *priv;
+
g_return_val_if_fail (NET_IS_OBJECT (object), FALSE);
- return object->priv->removable;
+
+ priv = net_object_get_instance_private (object);
+ return priv->removable;
}
const gchar *
net_object_get_title (NetObject *object)
{
+ NetObjectPrivate *priv;
+
g_return_val_if_fail (NET_IS_OBJECT (object), NULL);
- return object->priv->title;
+
+ priv = net_object_get_instance_private (object);
+ return priv->title;
}
void
net_object_set_title (NetObject *object, const gchar *title)
{
+ NetObjectPrivate *priv;
+
g_return_if_fail (NET_IS_OBJECT (object));
- g_clear_pointer (&object->priv->title, g_free);
- object->priv->title = g_strdup (title);
+
+ priv = net_object_get_instance_private (object);
+ g_clear_pointer (&priv->title, g_free);
+ priv->title = g_strdup (title);
g_object_notify (G_OBJECT (object), "title");
}
NMClient *
net_object_get_client (NetObject *object)
{
+ NetObjectPrivate *priv;
+
g_return_val_if_fail (NET_IS_OBJECT (object), NULL);
- return object->priv->client;
+
+ priv = net_object_get_instance_private (object);
+ return priv->client;
}
GCancellable *
net_object_get_cancellable (NetObject *object)
{
+ NetObjectPrivate *priv;
+
g_return_val_if_fail (NET_IS_OBJECT (object), NULL);
- return object->priv->cancellable;
+
+ priv = net_object_get_instance_private (object);
+ return priv->cancellable;
}
CcNetworkPanel *
net_object_get_panel (NetObject *object)
{
+ NetObjectPrivate *priv;
+
g_return_val_if_fail (NET_IS_OBJECT (object), NULL);
- return object->priv->panel;
+
+ priv = net_object_get_instance_private (object);
+ return priv->panel;
}
GtkWidget *
@@ -139,17 +177,19 @@ net_object_add_to_stack (NetObject *object,
GtkStack *stack,
GtkSizeGroup *heading_size_group)
{
+ NetObjectPrivate *priv = net_object_get_instance_private (object);
GtkWidget *widget;
NetObjectClass *klass = NET_OBJECT_GET_CLASS (object);
+
if (klass->add_to_stack != NULL) {
widget = klass->add_to_stack (object, stack, heading_size_group);
g_object_set_data_full (G_OBJECT (widget),
"NetObject::id",
- g_strdup (object->priv->id),
+ g_strdup (priv->id),
g_free);
return widget;
}
- g_debug ("no klass->add_to_stack for %s", object->priv->id);
+ g_debug ("no klass->add_to_stack for %s", priv->id);
return NULL;
}
@@ -187,7 +227,7 @@ net_object_get_property (GObject *object_,
GParamSpec *pspec)
{
NetObject *object = NET_OBJECT (object_);
- NetObjectPrivate *priv = object->priv;
+ NetObjectPrivate *priv = net_object_get_instance_private (object);
switch (prop_id) {
case PROP_ID:
@@ -224,7 +264,7 @@ net_object_set_property (GObject *object_,
GParamSpec *pspec)
{
NetObject *object = NET_OBJECT (object_);
- NetObjectPrivate *priv = object->priv;
+ NetObjectPrivate *priv = net_object_get_instance_private (object);
switch (prop_id) {
case PROP_ID:
@@ -263,7 +303,7 @@ static void
net_object_finalize (GObject *object)
{
NetObject *nm_object = NET_OBJECT (object);
- NetObjectPrivate *priv = nm_object->priv;
+ NetObjectPrivate *priv = net_object_get_instance_private (nm_object);
g_free (priv->id);
g_free (priv->title);
@@ -327,13 +367,10 @@ net_object_class_init (NetObjectClass *klass)
G_STRUCT_OFFSET (NetObjectClass, changed),
NULL, NULL, g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
-
- g_type_class_add_private (klass, sizeof (NetObjectPrivate));
}
static void
net_object_init (NetObject *object)
{
- object->priv = NET_OBJECT_GET_PRIVATE (object);
}
diff --git a/panels/network/net-object.h b/panels/network/net-object.h
index 8d98680..8f936cb 100644
--- a/panels/network/net-object.h
+++ b/panels/network/net-object.h
@@ -30,24 +30,9 @@
G_BEGIN_DECLS
-#define NET_TYPE_OBJECT (net_object_get_type ())
-#define NET_OBJECT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), NET_TYPE_OBJECT, NetObject))
-#define NET_OBJECT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), NET_TYPE_OBJECT, NetObjectClass))
-#define NET_IS_OBJECT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), NET_TYPE_OBJECT))
-#define NET_IS_OBJECT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), NET_TYPE_OBJECT))
-#define NET_OBJECT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), NET_TYPE_OBJECT, NetObjectClass))
+#define NET_TYPE_OBJECT net_object_get_type ()
-typedef struct _NetObjectPrivate NetObjectPrivate;
-typedef struct _NetObject NetObject;
-typedef struct _NetObjectClass NetObjectClass;
-
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (NetObject, g_object_unref)
-
-struct _NetObject
-{
- GObject parent;
- NetObjectPrivate *priv;
-};
+G_DECLARE_DERIVABLE_TYPE (NetObject, net_object, NET, OBJECT, GObject)
struct _NetObjectClass
{
@@ -66,7 +51,6 @@ struct _NetObjectClass
void (* removed) (NetObject *object);
};
-GType net_object_get_type (void);
const gchar *net_object_get_id (NetObject *object);
void net_object_set_id (NetObject *object,
const gchar *id);
diff --git a/panels/network/net-proxy.c b/panels/network/net-proxy.c
index d1b4602..2ebd019 100644
--- a/panels/network/net-proxy.c
+++ b/panels/network/net-proxy.c
@@ -27,8 +27,6 @@
#include "net-proxy.h"
-#define NET_PROXY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NET_TYPE_PROXY, NetProxyPrivate))
-
typedef enum
{
MODE_DISABLED,
@@ -37,8 +35,10 @@ typedef enum
N_MODES
} ProxyMode;
-struct _NetProxyPrivate
+struct _NetProxy
{
+ NetObject parent_instance;
+
GSettings *settings;
GtkBuilder *builder;
GtkToggleButton *mode_radios[3];
@@ -68,7 +68,7 @@ panel_update_status_label (NetProxy *self,
GtkLabel *label;
/* update the label */
- label = GTK_LABEL (gtk_builder_get_object (self->priv->builder, "status_label"));
+ label = GTK_LABEL (gtk_builder_get_object (self->builder, "status_label"));
gtk_label_set_label (label, panel_get_string_for_value (mode));
}
@@ -84,12 +84,12 @@ check_wpad_warning (NetProxy *proxy)
string = g_string_new ("");
/* check we're using 'Automatic' */
- mode = g_settings_get_enum (proxy->priv->settings, "mode");
+ mode = g_settings_get_enum (proxy->settings, "mode");
if (mode != MODE_AUTOMATIC)
goto out;
/* see if the PAC is blank */
- autoconfig_url = g_settings_get_string (proxy->priv->settings,
+ autoconfig_url = g_settings_get_string (proxy->settings,
"autoconfig-url");
ret = autoconfig_url == NULL ||
autoconfig_url[0] == '\0';
@@ -110,7 +110,7 @@ check_wpad_warning (NetProxy *proxy)
g_string_append (string, _("This is not recommended for untrusted public networks."));
g_string_append (string, "</small>");
out:
- widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (proxy->builder,
"label_proxy_warning"));
gtk_label_set_markup (GTK_LABEL (widget), string->str);
gtk_widget_set_visible (widget, (string->len > 0));
@@ -132,7 +132,7 @@ panel_proxy_mode_setup_widgets (NetProxy *proxy, ProxyMode value)
{
GtkStack *stack;
- stack = GTK_STACK (gtk_builder_get_object (proxy->priv->builder, "stack"));
+ stack = GTK_STACK (gtk_builder_get_object (proxy->builder, "stack"));
/* hide or show the PAC text box */
switch (value) {
@@ -163,17 +163,17 @@ panel_proxy_mode_radio_changed_cb (GtkToggleButton *radio,
return;
/* get selected radio */
- if (radio == proxy->priv->mode_radios[MODE_DISABLED])
+ if (radio == proxy->mode_radios[MODE_DISABLED])
value = MODE_DISABLED;
- else if (radio == proxy->priv->mode_radios[MODE_MANUAL])
+ else if (radio == proxy->mode_radios[MODE_MANUAL])
value = MODE_MANUAL;
- else if (radio == proxy->priv->mode_radios[MODE_AUTOMATIC])
+ else if (radio == proxy->mode_radios[MODE_AUTOMATIC])
value = MODE_AUTOMATIC;
else
g_assert_not_reached ();
/* set */
- g_settings_set_enum (proxy->priv->settings, "mode", value);
+ g_settings_set_enum (proxy->settings, "mode", value);
/* hide or show the correct widgets */
panel_proxy_mode_setup_widgets (proxy, value);
@@ -190,7 +190,7 @@ show_dialog_cb (GtkWidget *button,
GtkWindow *dialog;
toplevel = gtk_widget_get_toplevel (button);
- dialog = GTK_WINDOW (gtk_builder_get_object (self->priv->builder, "dialog"));
+ dialog = GTK_WINDOW (gtk_builder_get_object (self->builder, "dialog"));
gtk_window_set_transient_for (dialog, GTK_WINDOW (toplevel));
gtk_window_present (dialog);
@@ -204,7 +204,7 @@ net_proxy_add_to_stack (NetObject *object,
GtkWidget *widget;
NetProxy *proxy = NET_PROXY (object);
- widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (proxy->builder,
"main_widget"));
gtk_size_group_add_widget (heading_size_group, widget);
gtk_stack_add_named (stack, widget, net_object_get_id (object));
@@ -215,10 +215,9 @@ static void
net_proxy_finalize (GObject *object)
{
NetProxy *proxy = NET_PROXY (object);
- NetProxyPrivate *priv = proxy->priv;
- g_clear_object (&priv->settings);
- g_clear_object (&priv->builder);
+ g_clear_object (&proxy->settings);
+ g_clear_object (&proxy->builder);
G_OBJECT_CLASS (net_proxy_parent_class)->finalize (object);
}
@@ -231,7 +230,6 @@ net_proxy_class_init (NetProxyClass *klass)
object_class->finalize = net_proxy_finalize;
parent_class->add_to_stack = net_proxy_add_to_stack;
- g_type_class_add_private (klass, sizeof (NetProxyPrivate));
}
static gboolean
@@ -292,10 +290,8 @@ net_proxy_init (NetProxy *proxy)
GError *error = NULL;
guint i;
- proxy->priv = NET_PROXY_GET_PRIVATE (proxy);
-
- proxy->priv->builder = gtk_builder_new ();
- gtk_builder_add_from_resource (proxy->priv->builder,
+ proxy->builder = gtk_builder_new ();
+ gtk_builder_add_from_resource (proxy->builder,
"/org/gnome/control-center/network/network-proxy.ui",
&error);
if (error != NULL) {
@@ -304,30 +300,30 @@ net_proxy_init (NetProxy *proxy)
return;
}
- proxy->priv->settings = g_settings_new ("org.gnome.system.proxy");
- g_signal_connect (proxy->priv->settings,
+ proxy->settings = g_settings_new ("org.gnome.system.proxy");
+ g_signal_connect (proxy->settings,
"changed",
G_CALLBACK (settings_changed_cb),
proxy);
/* actions */
- value = g_settings_get_enum (proxy->priv->settings, "mode");
+ value = g_settings_get_enum (proxy->settings, "mode");
/* bind the proxy values */
- widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (proxy->builder,
"entry_proxy_url"));
- g_settings_bind (proxy->priv->settings, "autoconfig-url",
+ g_settings_bind (proxy->settings, "autoconfig-url",
widget, "text",
G_SETTINGS_BIND_DEFAULT);
/* bind the HTTP proxy values */
- settings_tmp = g_settings_get_child (proxy->priv->settings, "http");
- widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
+ settings_tmp = g_settings_get_child (proxy->settings, "http");
+ widget = GTK_WIDGET (gtk_builder_get_object (proxy->builder,
"entry_proxy_http"));
g_settings_bind (settings_tmp, "host",
widget, "text",
G_SETTINGS_BIND_DEFAULT);
- adjustment = GTK_ADJUSTMENT (gtk_builder_get_object (proxy->priv->builder,
+ adjustment = GTK_ADJUSTMENT (gtk_builder_get_object (proxy->builder,
"adjustment_proxy_port_http"));
g_settings_bind (settings_tmp, "port",
adjustment, "value",
@@ -335,13 +331,13 @@ net_proxy_init (NetProxy *proxy)
g_object_unref (settings_tmp);
/* bind the HTTPS proxy values */
- settings_tmp = g_settings_get_child (proxy->priv->settings, "https");
- widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
+ settings_tmp = g_settings_get_child (proxy->settings, "https");
+ widget = GTK_WIDGET (gtk_builder_get_object (proxy->builder,
"entry_proxy_https"));
g_settings_bind (settings_tmp, "host",
widget, "text",
G_SETTINGS_BIND_DEFAULT);
- adjustment = GTK_ADJUSTMENT (gtk_builder_get_object (proxy->priv->builder,
+ adjustment = GTK_ADJUSTMENT (gtk_builder_get_object (proxy->builder,
"adjustment_proxy_port_https"));
g_settings_bind (settings_tmp, "port",
adjustment, "value",
@@ -349,13 +345,13 @@ net_proxy_init (NetProxy *proxy)
g_object_unref (settings_tmp);
/* bind the FTP proxy values */
- settings_tmp = g_settings_get_child (proxy->priv->settings, "ftp");
- widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
+ settings_tmp = g_settings_get_child (proxy->settings, "ftp");
+ widget = GTK_WIDGET (gtk_builder_get_object (proxy->builder,
"entry_proxy_ftp"));
g_settings_bind (settings_tmp, "host",
widget, "text",
G_SETTINGS_BIND_DEFAULT);
- adjustment = GTK_ADJUSTMENT (gtk_builder_get_object (proxy->priv->builder,
+ adjustment = GTK_ADJUSTMENT (gtk_builder_get_object (proxy->builder,
"adjustment_proxy_port_ftp"));
g_settings_bind (settings_tmp, "port",
adjustment, "value",
@@ -363,13 +359,13 @@ net_proxy_init (NetProxy *proxy)
g_object_unref (settings_tmp);
/* bind the SOCKS proxy values */
- settings_tmp = g_settings_get_child (proxy->priv->settings, "socks");
- widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
+ settings_tmp = g_settings_get_child (proxy->settings, "socks");
+ widget = GTK_WIDGET (gtk_builder_get_object (proxy->builder,
"entry_proxy_socks"));
g_settings_bind (settings_tmp, "host",
widget, "text",
G_SETTINGS_BIND_DEFAULT);
- adjustment = GTK_ADJUSTMENT (gtk_builder_get_object (proxy->priv->builder,
+ adjustment = GTK_ADJUSTMENT (gtk_builder_get_object (proxy->builder,
"adjustment_proxy_port_socks"));
g_settings_bind (settings_tmp, "port",
adjustment, "value",
@@ -377,35 +373,35 @@ net_proxy_init (NetProxy *proxy)
g_object_unref (settings_tmp);
/* bind the proxy ignore hosts */
- widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (proxy->builder,
"entry_proxy_ignore"));
- g_settings_bind_with_mapping (proxy->priv->settings, "ignore-hosts",
+ g_settings_bind_with_mapping (proxy->settings, "ignore-hosts",
widget, "text",
G_SETTINGS_BIND_DEFAULT, get_ignore_hosts, set_ignore_hosts,
NULL, NULL);
/* radio buttons */
- proxy->priv->mode_radios[MODE_DISABLED] =
- GTK_TOGGLE_BUTTON (gtk_builder_get_object (proxy->priv->builder, "radio_none"));
- proxy->priv->mode_radios[MODE_MANUAL] =
- GTK_TOGGLE_BUTTON (gtk_builder_get_object (proxy->priv->builder, "radio_manual"));
- proxy->priv->mode_radios[MODE_AUTOMATIC] =
- GTK_TOGGLE_BUTTON (gtk_builder_get_object (proxy->priv->builder, "radio_automatic"));
+ proxy->mode_radios[MODE_DISABLED] =
+ GTK_TOGGLE_BUTTON (gtk_builder_get_object (proxy->builder, "radio_none"));
+ proxy->mode_radios[MODE_MANUAL] =
+ GTK_TOGGLE_BUTTON (gtk_builder_get_object (proxy->builder, "radio_manual"));
+ proxy->mode_radios[MODE_AUTOMATIC] =
+ GTK_TOGGLE_BUTTON (gtk_builder_get_object (proxy->builder, "radio_automatic"));
/* setup the radio before connecting to the :toggled signal */
- gtk_toggle_button_set_active (proxy->priv->mode_radios[value], TRUE);
+ gtk_toggle_button_set_active (proxy->mode_radios[value], TRUE);
panel_proxy_mode_setup_widgets (proxy, value);
panel_update_status_label (proxy, value);
for (i = MODE_DISABLED; i < N_MODES; i++) {
- g_signal_connect (proxy->priv->mode_radios[i],
+ g_signal_connect (proxy->mode_radios[i],
"toggled",
G_CALLBACK (panel_proxy_mode_radio_changed_cb),
proxy);
}
/* show dialog button */
- widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder, "dialog_button"));
+ widget = GTK_WIDGET (gtk_builder_get_object (proxy->builder, "dialog_button"));
g_signal_connect (widget,
"clicked",
@@ -413,7 +409,7 @@ net_proxy_init (NetProxy *proxy)
proxy);
/* prevent the dialog from being destroyed */
- widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder, "dialog"));
+ widget = GTK_WIDGET (gtk_builder_get_object (proxy->builder, "dialog"));
g_signal_connect (widget,
"delete-event",
diff --git a/panels/network/net-proxy.h b/panels/network/net-proxy.h
index 5eece5b..14020c3 100644
--- a/panels/network/net-proxy.h
+++ b/panels/network/net-proxy.h
@@ -28,29 +28,10 @@
G_BEGIN_DECLS
-#define NET_TYPE_PROXY (net_proxy_get_type ())
-#define NET_PROXY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), NET_TYPE_PROXY, NetProxy))
-#define NET_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), NET_TYPE_PROXY, NetProxyClass))
-#define NET_IS_PROXY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), NET_TYPE_PROXY))
-#define NET_IS_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), NET_TYPE_PROXY))
-#define NET_PROXY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), NET_TYPE_PROXY, NetProxyClass))
-
-typedef struct _NetProxyPrivate NetProxyPrivate;
-typedef struct _NetProxy NetProxy;
-typedef struct _NetProxyClass NetProxyClass;
-
-struct _NetProxy
-{
- NetObject parent;
- NetProxyPrivate *priv;
-};
-
-struct _NetProxyClass
-{
- NetObjectClass parent_class;
-};
-
-GType net_proxy_get_type (void);
+#define NET_TYPE_PROXY net_proxy_get_type ()
+
+G_DECLARE_FINAL_TYPE (NetProxy, net_proxy, NET, PROXY, NetObject)
+
NetProxy *net_proxy_new (void);
G_END_DECLS
diff --git a/panels/network/net-vpn.c b/panels/network/net-vpn.c
index 47b7391..96473dc 100644
--- a/panels/network/net-vpn.c
+++ b/panels/network/net-vpn.c
@@ -31,10 +31,10 @@
#include "connection-editor/net-connection-editor.h"
-#define NET_VPN_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NET_TYPE_VPN, NetVpnPrivate))
-
-struct _NetVpnPrivate
+struct _NetVpn
{
+ NetObject parent_instance;
+
GtkBuilder *builder;
NMConnection *connection;
NMActiveConnection *active_connection;
@@ -57,7 +57,7 @@ net_vpn_set_show_separator (NetVpn *self,
{
GtkWidget *separator;
- separator = GTK_WIDGET (gtk_builder_get_object (self->priv->builder, "separator"));
+ separator = GTK_WIDGET (gtk_builder_get_object (self->builder, "separator"));
gtk_widget_set_visible (separator, show_separator);
}
@@ -82,9 +82,7 @@ connection_removed_cb (NMClient *client,
NMConnection *connection,
NetVpn *vpn)
{
- NetVpnPrivate *priv = vpn->priv;
-
- if (priv->connection == connection)
+ if (vpn->connection == connection)
net_object_emit_removed (NET_OBJECT (vpn));
}
@@ -102,7 +100,6 @@ net_vpn_connection_to_type (NMConnection *connection)
static void
net_vpn_set_connection (NetVpn *vpn, NMConnection *connection)
{
- NetVpnPrivate *priv = vpn->priv;
NMClient *client;
/*
@@ -115,7 +112,7 @@ net_vpn_set_connection (NetVpn *vpn, NMConnection *connection)
* key=IPSec ID, value=rh-vpn
* key=Xauth username, value=rhughes
*/
- priv->connection = g_object_ref (connection);
+ vpn->connection = g_object_ref (connection);
client = net_object_get_client (NET_OBJECT (vpn));
g_signal_connect (client,
@@ -127,30 +124,29 @@ net_vpn_set_connection (NetVpn *vpn, NMConnection *connection)
G_CALLBACK (connection_changed_cb),
vpn);
- if (NM_IS_VPN_CONNECTION (priv->connection)) {
- g_signal_connect (priv->connection,
+ if (NM_IS_VPN_CONNECTION (vpn->connection)) {
+ g_signal_connect (vpn->connection,
NM_VPN_CONNECTION_VPN_STATE,
G_CALLBACK (connection_vpn_state_changed_cb),
vpn);
}
- priv->service_type = net_vpn_connection_to_type (priv->connection);
+ vpn->service_type = net_vpn_connection_to_type (vpn->connection);
}
static NMVpnConnectionState
net_vpn_get_state (NetVpn *vpn)
{
- NetVpnPrivate *priv = vpn->priv;
- if (!NM_IS_VPN_CONNECTION (priv->connection))
+ if (!NM_IS_VPN_CONNECTION (vpn->connection))
return NM_VPN_CONNECTION_STATE_DISCONNECTED;
- return nm_vpn_connection_get_vpn_state (NM_VPN_CONNECTION (priv->connection));
+ return nm_vpn_connection_get_vpn_state (NM_VPN_CONNECTION (vpn->connection));
}
static void
vpn_proxy_delete (NetObject *object)
{
NetVpn *vpn = NET_VPN (object);
- nm_remote_connection_delete_async (NM_REMOTE_CONNECTION (vpn->priv->connection),
+ nm_remote_connection_delete_async (NM_REMOTE_CONNECTION (vpn->connection),
NULL, NULL, vpn);
}
@@ -163,7 +159,7 @@ vpn_proxy_add_to_stack (NetObject *object,
NetVpn *vpn = NET_VPN (object);
/* add widgets to size group */
- widget = GTK_WIDGET (gtk_builder_get_object (vpn->priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (vpn->builder,
"vbox9"));
gtk_stack_add_named (stack, widget, net_object_get_id (object));
return widget;
@@ -174,7 +170,6 @@ nm_device_refresh_vpn_ui (NetVpn *vpn)
{
GtkWidget *widget;
GtkWidget *sw;
- NetVpnPrivate *priv = vpn->priv;
const GPtrArray *acs;
NMActiveConnection *a;
gint i;
@@ -183,22 +178,22 @@ nm_device_refresh_vpn_ui (NetVpn *vpn)
NMClient *client;
/* update title */
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (vpn->builder,
"label_device"));
/* Translators: this is the title of the connection details
* window for vpn connections, it is also used to display
* vpn connections in the device list.
*/
- title = g_strdup_printf (_("%s VPN"), nm_connection_get_id (vpn->priv->connection));
+ title = g_strdup_printf (_("%s VPN"), nm_connection_get_id (vpn->connection));
net_object_set_title (NET_OBJECT (vpn), title);
gtk_label_set_label (GTK_LABEL (widget), title);
g_free (title);
- if (priv->active_connection) {
- g_signal_handlers_disconnect_by_func (vpn->priv->active_connection,
+ if (vpn->active_connection) {
+ g_signal_handlers_disconnect_by_func (vpn->active_connection,
nm_device_refresh_vpn_ui,
vpn);
- g_clear_object (&priv->active_connection);
+ g_clear_object (&vpn->active_connection);
}
@@ -209,7 +204,7 @@ nm_device_refresh_vpn_ui (NetVpn *vpn)
if (acs != NULL) {
const gchar *uuid;
- uuid = nm_connection_get_uuid (vpn->priv->connection);
+ uuid = nm_connection_get_uuid (vpn->connection);
for (i = 0; i < acs->len; i++) {
const gchar *auuid;
@@ -217,7 +212,7 @@ nm_device_refresh_vpn_ui (NetVpn *vpn)
auuid = nm_active_connection_get_uuid (a);
if (NM_IS_VPN_CONNECTION (a) && strcmp (auuid, uuid) == 0) {
- priv->active_connection = g_object_ref (a);
+ vpn->active_connection = g_object_ref (a);
g_signal_connect_swapped (a, "notify::vpn-state",
G_CALLBACK (nm_device_refresh_vpn_ui),
vpn);
@@ -227,12 +222,12 @@ nm_device_refresh_vpn_ui (NetVpn *vpn)
}
}
- priv->updating_device = TRUE;
- sw = GTK_WIDGET (gtk_builder_get_object (priv->builder, "device_off_switch"));
+ vpn->updating_device = TRUE;
+ sw = GTK_WIDGET (gtk_builder_get_object (vpn->builder, "device_off_switch"));
gtk_switch_set_active (GTK_SWITCH (sw),
state != NM_VPN_CONNECTION_STATE_FAILED &&
state != NM_VPN_CONNECTION_STATE_DISCONNECTED);
- priv->updating_device = FALSE;
+ vpn->updating_device = FALSE;
}
static void
@@ -259,19 +254,19 @@ device_off_toggled (GtkSwitch *sw,
NMActiveConnection *a;
NMClient *client;
- if (vpn->priv->updating_device)
+ if (vpn->updating_device)
return;
active = gtk_switch_get_active (sw);
if (active) {
client = net_object_get_client (NET_OBJECT (vpn));
nm_client_activate_connection_async (client,
- vpn->priv->connection, NULL, NULL,
+ vpn->connection, NULL, NULL,
NULL, NULL, NULL);
} else {
const gchar *uuid;
- uuid = nm_connection_get_uuid (vpn->priv->connection);
+ uuid = nm_connection_get_uuid (vpn->connection);
client = net_object_get_client (NET_OBJECT (vpn));
acs = nm_client_get_active_connections (client);
for (i = 0; acs && i < acs->len; i++) {
@@ -309,16 +304,16 @@ vpn_proxy_edit (NetObject *object)
NMClient *client;
gchar *title;
- button = GTK_WIDGET (gtk_builder_get_object (vpn->priv->builder,
+ button = GTK_WIDGET (gtk_builder_get_object (vpn->builder,
"button_options"));
window = gtk_widget_get_toplevel (button);
client = net_object_get_client (object);
editor = net_connection_editor_new (GTK_WINDOW (window),
- vpn->priv->connection,
+ vpn->connection,
NULL, NULL, client);
- title = g_strdup_printf (_("%s VPN"), nm_connection_get_id (vpn->priv->connection));
+ title = g_strdup_printf (_("%s VPN"), nm_connection_get_id (vpn->connection));
net_connection_editor_set_title (editor, title);
g_free (title);
@@ -336,11 +331,10 @@ net_vpn_get_property (GObject *object,
GParamSpec *pspec)
{
NetVpn *vpn = NET_VPN (object);
- NetVpnPrivate *priv = vpn->priv;
switch (prop_id) {
case PROP_CONNECTION:
- g_value_set_object (value, priv->connection);
+ g_value_set_object (value, vpn->connection);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (vpn, prop_id, pspec);
@@ -390,7 +384,6 @@ static void
net_vpn_finalize (GObject *object)
{
NetVpn *vpn = NET_VPN (object);
- NetVpnPrivate *priv = vpn->priv;
NMClient *client = net_object_get_client (NET_OBJECT (object));
if (client) {
@@ -399,26 +392,26 @@ net_vpn_finalize (GObject *object)
vpn);
}
- if (priv->active_connection) {
- g_signal_handlers_disconnect_by_func (priv->active_connection,
+ if (vpn->active_connection) {
+ g_signal_handlers_disconnect_by_func (vpn->active_connection,
nm_device_refresh_vpn_ui,
vpn);
- g_object_unref (priv->active_connection);
+ g_object_unref (vpn->active_connection);
}
- g_signal_handlers_disconnect_by_func (priv->connection,
+ g_signal_handlers_disconnect_by_func (vpn->connection,
connection_vpn_state_changed_cb,
vpn);
- g_signal_handlers_disconnect_by_func (priv->connection,
+ g_signal_handlers_disconnect_by_func (vpn->connection,
connection_removed_cb,
vpn);
- g_signal_handlers_disconnect_by_func (priv->connection,
+ g_signal_handlers_disconnect_by_func (vpn->connection,
connection_changed_cb,
vpn);
- g_object_unref (priv->connection);
- g_free (priv->service_type);
+ g_object_unref (vpn->connection);
+ g_free (vpn->service_type);
- g_clear_object (&priv->builder);
+ g_clear_object (&vpn->builder);
G_OBJECT_CLASS (net_vpn_parent_class)->finalize (object);
}
@@ -443,8 +436,6 @@ net_vpn_class_init (NetVpnClass *klass)
NM_TYPE_CONNECTION,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
g_object_class_install_property (object_class, PROP_CONNECTION, pspec);
-
- g_type_class_add_private (klass, sizeof (NetVpnPrivate));
}
static void
@@ -453,10 +444,8 @@ net_vpn_init (NetVpn *vpn)
GError *error = NULL;
GtkWidget *widget;
- vpn->priv = NET_VPN_GET_PRIVATE (vpn);
-
- vpn->priv->builder = gtk_builder_new ();
- gtk_builder_add_from_resource (vpn->priv->builder,
+ vpn->builder = gtk_builder_new ();
+ gtk_builder_add_from_resource (vpn->builder,
"/org/gnome/control-center/network/network-vpn.ui",
&error);
if (error != NULL) {
@@ -465,12 +454,12 @@ net_vpn_init (NetVpn *vpn)
return;
}
- widget = GTK_WIDGET (gtk_builder_get_object (vpn->priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (vpn->builder,
"device_off_switch"));
g_signal_connect (widget, "notify::active",
G_CALLBACK (device_off_toggled), vpn);
- widget = GTK_WIDGET (gtk_builder_get_object (vpn->priv->builder,
+ widget = GTK_WIDGET (gtk_builder_get_object (vpn->builder,
"button_options"));
g_signal_connect (widget, "clicked",
G_CALLBACK (edit_connection), vpn);
diff --git a/panels/network/net-vpn.h b/panels/network/net-vpn.h
index adcf8ad..0eae607 100644
--- a/panels/network/net-vpn.h
+++ b/panels/network/net-vpn.h
@@ -29,29 +29,10 @@
G_BEGIN_DECLS
-#define NET_TYPE_VPN (net_vpn_get_type ())
-#define NET_VPN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), NET_TYPE_VPN, NetVpn))
-#define NET_VPN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), NET_TYPE_VPN, NetVpnClass))
-#define NET_IS_VPN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), NET_TYPE_VPN))
-#define NET_IS_VPN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), NET_TYPE_VPN))
-#define NET_VPN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), NET_TYPE_VPN, NetVpnClass))
-
-typedef struct _NetVpnPrivate NetVpnPrivate;
-typedef struct _NetVpn NetVpn;
-typedef struct _NetVpnClass NetVpnClass;
-
-struct _NetVpn
-{
- NetObject parent;
- NetVpnPrivate *priv;
-};
-
-struct _NetVpnClass
-{
- NetObjectClass parent_class;
-};
-
-GType net_vpn_get_type (void);
+#define NET_TYPE_VPN net_vpn_get_type ()
+
+G_DECLARE_FINAL_TYPE (NetVpn, net_vpn, NET, VPN, NetObject)
+
void net_vpn_set_show_separator (NetVpn *self,
gboolean show_separator);
diff --git a/panels/printers/pp-print-device.c b/panels/printers/pp-print-device.c
index ec22e3b..a75cbe3 100644
--- a/panels/printers/pp-print-device.c
+++ b/panels/printers/pp-print-device.c
@@ -20,10 +20,10 @@
#include "pp-print-device.h"
-G_DEFINE_TYPE (PpPrintDevice, pp_print_device, G_TYPE_OBJECT);
-
-struct _PpPrintDevicePrivate
+struct _PpPrintDevice
{
+ GObject parent_instance;
+
gchar *device_name;
gchar *display_name;
gchar *device_original_name;
@@ -40,6 +40,8 @@ struct _PpPrintDevicePrivate
gboolean is_network_device;
};
+G_DEFINE_TYPE (PpPrintDevice, pp_print_device, G_TYPE_OBJECT);
+
enum
{
PROP_0 = 0,
@@ -62,20 +64,18 @@ enum
static void
pp_print_device_finalize (GObject *object)
{
- PpPrintDevicePrivate *priv;
-
- priv = PP_PRINT_DEVICE (object)->priv;
+ PpPrintDevice *self = PP_PRINT_DEVICE (object);
- g_clear_pointer (&priv->device_name, g_free);
- g_clear_pointer (&priv->display_name, g_free);
- g_clear_pointer (&priv->device_original_name, g_free);
- g_clear_pointer (&priv->device_make_and_model, g_free);
- g_clear_pointer (&priv->device_location, g_free);
- g_clear_pointer (&priv->device_info, g_free);
- g_clear_pointer (&priv->device_uri, g_free);
- g_clear_pointer (&priv->device_id, g_free);
- g_clear_pointer (&priv->device_ppd, g_free);
- g_clear_pointer (&priv->host_name, g_free);
+ g_clear_pointer (&self->device_name, g_free);
+ g_clear_pointer (&self->display_name, g_free);
+ g_clear_pointer (&self->device_original_name, g_free);
+ g_clear_pointer (&self->device_make_and_model, g_free);
+ g_clear_pointer (&self->device_location, g_free);
+ g_clear_pointer (&self->device_info, g_free);
+ g_clear_pointer (&self->device_uri, g_free);
+ g_clear_pointer (&self->device_id, g_free);
+ g_clear_pointer (&self->device_ppd, g_free);
+ g_clear_pointer (&self->host_name, g_free);
G_OBJECT_CLASS (pp_print_device_parent_class)->finalize (object);
}
@@ -86,53 +86,51 @@ pp_print_device_get_property (GObject *object,
GValue *value,
GParamSpec *param_spec)
{
- PpPrintDevice *self;
-
- self = PP_PRINT_DEVICE (object);
+ PpPrintDevice *self = PP_PRINT_DEVICE (object);
switch (prop_id)
{
case PROP_DEVICE_NAME:
- g_value_set_string (value, self->priv->device_name);
+ g_value_set_string (value, self->device_name);
break;
case PROP_DISPLAY_NAME:
- g_value_set_string (value, self->priv->display_name);
+ g_value_set_string (value, self->display_name);
break;
case PROP_DEVICE_ORIGINAL_NAME:
- g_value_set_string (value, self->priv->device_original_name);
+ g_value_set_string (value, self->device_original_name);
break;
case PROP_DEVICE_MAKE_AND_MODEL:
- g_value_set_string (value, self->priv->device_make_and_model);
+ g_value_set_string (value, self->device_make_and_model);
break;
case PROP_DEVICE_LOCATION:
- g_value_set_string (value, self->priv->device_location);
+ g_value_set_string (value, self->device_location);
break;
case PROP_DEVICE_INFO:
- g_value_set_string (value, self->priv->device_info);
+ g_value_set_string (value, self->device_info);
break;
case PROP_DEVICE_URI:
- g_value_set_string (value, self->priv->device_uri);
+ g_value_set_string (value, self->device_uri);
break;
case PROP_DEVICE_ID:
- g_value_set_string (value, self->priv->device_id);
+ g_value_set_string (value, self->device_id);
break;
case PROP_DEVICE_PPD:
- g_value_set_string (value, self->priv->device_ppd);
+ g_value_set_string (value, self->device_ppd);
break;
case PROP_HOST_NAME:
- g_value_set_string (value, self->priv->host_name);
+ g_value_set_string (value, self->host_name);
break;
case PROP_HOST_PORT:
- g_value_set_int (value, self->priv->host_port);
+ g_value_set_int (value, self->host_port);
break;
case PROP_IS_AUTHENTICATED_SERVER:
- g_value_set_boolean (value, self->priv->is_authenticated_server);
+ g_value_set_boolean (value, self->is_authenticated_server);
break;
case PROP_ACQUISITION_METHOD:
- g_value_set_int (value, self->priv->acquisition_method);
+ g_value_set_int (value, self->acquisition_method);
break;
case PROP_IS_NETWORK_DEVICE:
- g_value_set_boolean (value, self->priv->is_network_device);
+ g_value_set_boolean (value, self->is_network_device);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object,
@@ -153,56 +151,56 @@ pp_print_device_set_property (GObject *object,
switch (prop_id)
{
case PROP_DEVICE_NAME:
- g_free (self->priv->device_name);
- self->priv->device_name = g_value_dup_string (value);
+ g_free (self->device_name);
+ self->device_name = g_value_dup_string (value);
break;
case PROP_DISPLAY_NAME:
- g_free (self->priv->display_name);
- self->priv->display_name = g_value_dup_string (value);
+ g_free (self->display_name);
+ self->display_name = g_value_dup_string (value);
break;
case PROP_DEVICE_ORIGINAL_NAME:
- g_free (self->priv->device_original_name);
- self->priv->device_original_name = g_value_dup_string (value);
+ g_free (self->device_original_name);
+ self->device_original_name = g_value_dup_string (value);
break;
case PROP_DEVICE_MAKE_AND_MODEL:
- g_free (self->priv->device_make_and_model);
- self->priv->device_make_and_model = g_value_dup_string (value);
+ g_free (self->device_make_and_model);
+ self->device_make_and_model = g_value_dup_string (value);
break;
case PROP_DEVICE_LOCATION:
- g_free (self->priv->device_location);
- self->priv->device_location = g_value_dup_string (value);
+ g_free (self->device_location);
+ self->device_location = g_value_dup_string (value);
break;
case PROP_DEVICE_INFO:
- g_free (self->priv->device_info);
- self->priv->device_info = g_value_dup_string (value);
+ g_free (self->device_info);
+ self->device_info = g_value_dup_string (value);
break;
case PROP_DEVICE_URI:
- g_free (self->priv->device_uri);
- self->priv->device_uri = g_value_dup_string (value);
+ g_free (self->device_uri);
+ self->device_uri = g_value_dup_string (value);
break;
case PROP_DEVICE_ID:
- g_free (self->priv->device_id);
- self->priv->device_id = g_value_dup_string (value);
+ g_free (self->device_id);
+ self->device_id = g_value_dup_string (value);
break;
case PROP_DEVICE_PPD:
- g_free (self->priv->device_ppd);
- self->priv->device_ppd = g_value_dup_string (value);
+ g_free (self->device_ppd);
+ self->device_ppd = g_value_dup_string (value);
break;
case PROP_HOST_NAME:
- g_free (self->priv->host_name);
- self->priv->host_name = g_value_dup_string (value);
+ g_free (self->host_name);
+ self->host_name = g_value_dup_string (value);
break;
case PROP_HOST_PORT:
- self->priv->host_port = g_value_get_int (value);
+ self->host_port = g_value_get_int (value);
break;
case PROP_IS_AUTHENTICATED_SERVER:
- self->priv->is_authenticated_server = g_value_get_boolean (value);
+ self->is_authenticated_server = g_value_get_boolean (value);
break;
case PROP_ACQUISITION_METHOD:
- self->priv->acquisition_method = g_value_get_int (value);
+ self->acquisition_method = g_value_get_int (value);
break;
case PROP_IS_NETWORK_DEVICE:
- self->priv->is_network_device = g_value_get_boolean (value);
+ self->is_network_device = g_value_get_boolean (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object,
@@ -217,8 +215,6 @@ pp_print_device_class_init (PpPrintDeviceClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- g_type_class_add_private (klass, sizeof (PpPrintDevicePrivate));
-
gobject_class->set_property = pp_print_device_set_property;
gobject_class->get_property = pp_print_device_get_property;
@@ -340,9 +336,6 @@ pp_print_device_class_init (PpPrintDeviceClass *klass)
static void
pp_print_device_init (PpPrintDevice *printer)
{
- printer->priv = G_TYPE_INSTANCE_GET_PRIVATE (printer,
- PP_TYPE_PRINT_DEVICE,
- PpPrintDevicePrivate);
}
PpPrintDevice *
@@ -354,85 +347,85 @@ pp_print_device_new ()
gchar *
pp_print_device_get_device_name (PpPrintDevice *device)
{
- return device->priv->device_name;
+ return device->device_name;
}
gchar *
pp_print_device_get_display_name (PpPrintDevice *device)
{
- return device->priv->display_name;
+ return device->display_name;
}
gchar *
pp_print_device_get_device_original_name (PpPrintDevice *device)
{
- return device->priv->device_original_name;
+ return device->device_original_name;
}
gchar *
pp_print_device_get_device_make_and_model (PpPrintDevice *device)
{
- return device->priv->device_make_and_model;
+ return device->device_make_and_model;
}
gchar *
pp_print_device_get_device_location (PpPrintDevice *device)
{
- return device->priv->device_location;
+ return device->device_location;
}
gchar *
pp_print_device_get_device_info (PpPrintDevice *device)
{
- return device->priv->device_info;
+ return device->device_info;
}
gchar *
pp_print_device_get_device_uri (PpPrintDevice *device)
{
- return device->priv->device_uri;
+ return device->device_uri;
}
gchar *
pp_print_device_get_device_id (PpPrintDevice *device)
{
- return device->priv->device_id;
+ return device->device_id;
}
gchar *
pp_print_device_get_device_ppd (PpPrintDevice *device)
{
- return device->priv->device_ppd;
+ return device->device_ppd;
}
gchar *
pp_print_device_get_host_name (PpPrintDevice *device)
{
- return device->priv->host_name;
+ return device->host_name;
}
gint
pp_print_device_get_host_port (PpPrintDevice *device)
{
- return device->priv->host_port;
+ return device->host_port;
}
gboolean
pp_print_device_is_authenticated_server (PpPrintDevice *device)
{
- return device->priv->is_authenticated_server;
+ return device->is_authenticated_server;
}
gint
pp_print_device_get_acquisition_method (PpPrintDevice *device)
{
- return device->priv->acquisition_method;
+ return device->acquisition_method;
}
gboolean
pp_print_device_is_network_device (PpPrintDevice *device)
{
- return device->priv->is_network_device;
+ return device->is_network_device;
}
PpPrintDevice *
diff --git a/panels/printers/pp-print-device.h b/panels/printers/pp-print-device.h
index fde7793..d9abf85 100644
--- a/panels/printers/pp-print-device.h
+++ b/panels/printers/pp-print-device.h
@@ -26,16 +26,9 @@
G_BEGIN_DECLS
-#define PP_TYPE_PRINT_DEVICE (pp_print_device_get_type ())
-G_DECLARE_FINAL_TYPE (PpPrintDevice, pp_print_device, PP, PRINT_DEVICE, GObject)
-
-typedef struct _PpPrintDevicePrivate PpPrintDevicePrivate;
+#define PP_TYPE_PRINT_DEVICE pp_print_device_get_type ()
-struct _PpPrintDevice
-{
- GObject parent_instance;
- PpPrintDevicePrivate *priv;
-};
+G_DECLARE_FINAL_TYPE (PpPrintDevice, pp_print_device, PP, PRINT_DEVICE, GObject)
PpPrintDevice *pp_print_device_new (void);
PpPrintDevice *pp_print_device_copy (PpPrintDevice *device);
diff --git a/panels/user-accounts/cc-crop-area.c b/panels/user-accounts/cc-crop-area.c
index b0e6f21..6cdb1f5 100644
--- a/panels/user-accounts/cc-crop-area.c
+++ b/panels/user-accounts/cc-crop-area.c
@@ -28,7 +28,9 @@
#include "cc-crop-area.h"
-struct _CcCropAreaPrivate {
+struct _CcCropArea {
+ GtkDrawingArea parent_instance;
+
GdkPixbuf *browse_pixbuf;
GdkPixbuf *pixbuf;
GdkPixbuf *color_shifted;
@@ -99,8 +101,8 @@ update_pixbufs (CcCropArea *area)
widget = GTK_WIDGET (area);
gtk_widget_get_allocation (widget, &allocation);
- width = gdk_pixbuf_get_width (area->priv->browse_pixbuf);
- height = gdk_pixbuf_get_height (area->priv->browse_pixbuf);
+ width = gdk_pixbuf_get_width (area->browse_pixbuf);
+ height = gdk_pixbuf_get_height (area->browse_pixbuf);
scale = allocation.height / (gdouble)height;
if (scale * width > allocation.width)
@@ -109,51 +111,51 @@ update_pixbufs (CcCropArea *area)
dest_width = width * scale;
dest_height = height * scale;
- if (area->priv->pixbuf == NULL ||
- gdk_pixbuf_get_width (area->priv->pixbuf) != allocation.width ||
- gdk_pixbuf_get_height (area->priv->pixbuf) != allocation.height) {
- if (area->priv->pixbuf != NULL)
- g_object_unref (area->priv->pixbuf);
- area->priv->pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
- gdk_pixbuf_get_has_alpha (area->priv->browse_pixbuf),
+ if (area->pixbuf == NULL ||
+ gdk_pixbuf_get_width (area->pixbuf) != allocation.width ||
+ gdk_pixbuf_get_height (area->pixbuf) != allocation.height) {
+ if (area->pixbuf != NULL)
+ g_object_unref (area->pixbuf);
+ area->pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
+ gdk_pixbuf_get_has_alpha (area->browse_pixbuf),
8,
dest_width, dest_height);
- gdk_pixbuf_fill (area->priv->pixbuf, 0x0);
+ gdk_pixbuf_fill (area->pixbuf, 0x0);
- gdk_pixbuf_scale (area->priv->browse_pixbuf,
- area->priv->pixbuf,
+ gdk_pixbuf_scale (area->browse_pixbuf,
+ area->pixbuf,
0, 0,
dest_width, dest_height,
0, 0,
scale, scale,
GDK_INTERP_BILINEAR);
- if (area->priv->color_shifted)
- g_object_unref (area->priv->color_shifted);
- area->priv->color_shifted = gdk_pixbuf_copy (area->priv->pixbuf);
- shift_colors (area->priv->color_shifted, -32, -32, -32, 0);
+ if (area->color_shifted)
+ g_object_unref (area->color_shifted);
+ area->color_shifted = gdk_pixbuf_copy (area->pixbuf);
+ shift_colors (area->color_shifted, -32, -32, -32, 0);
- if (area->priv->scale == 0.0) {
+ if (area->scale == 0.0) {
gdouble scale_to_80, scale_to_image, crop_scale;
/* Scale the crop rectangle to 80% of the area, or less to fit the image */
- scale_to_80 = MIN ((gdouble)gdk_pixbuf_get_width (area->priv->pixbuf) * 0.8 /
area->priv->base_width,
- (gdouble)gdk_pixbuf_get_height (area->priv->pixbuf) * 0.8 /
area->priv->base_height);
- scale_to_image = MIN ((gdouble)dest_width / area->priv->base_width,
- (gdouble)dest_height / area->priv->base_height);
+ scale_to_80 = MIN ((gdouble)gdk_pixbuf_get_width (area->pixbuf) * 0.8 /
area->base_width,
+ (gdouble)gdk_pixbuf_get_height (area->pixbuf) * 0.8 /
area->base_height);
+ scale_to_image = MIN ((gdouble)dest_width / area->base_width,
+ (gdouble)dest_height / area->base_height);
crop_scale = MIN (scale_to_80, scale_to_image);
- area->priv->crop.width = crop_scale * area->priv->base_width / scale;
- area->priv->crop.height = crop_scale * area->priv->base_height / scale;
- area->priv->crop.x = (gdk_pixbuf_get_width (area->priv->browse_pixbuf) -
area->priv->crop.width) / 2;
- area->priv->crop.y = (gdk_pixbuf_get_height (area->priv->browse_pixbuf) -
area->priv->crop.height) / 2;
+ area->crop.width = crop_scale * area->base_width / scale;
+ area->crop.height = crop_scale * area->base_height / scale;
+ area->crop.x = (gdk_pixbuf_get_width (area->browse_pixbuf) - area->crop.width) / 2;
+ area->crop.y = (gdk_pixbuf_get_height (area->browse_pixbuf) - area->crop.height) / 2;
}
- area->priv->scale = scale;
- area->priv->image.x = (allocation.width - dest_width) / 2;
- area->priv->image.y = (allocation.height - dest_height) / 2;
- area->priv->image.width = dest_width;
- area->priv->image.height = dest_height;
+ area->scale = scale;
+ area->image.x = (allocation.width - dest_width) / 2;
+ area->image.y = (allocation.height - dest_height) / 2;
+ area->image.width = dest_width;
+ area->image.height = dest_height;
}
}
@@ -161,10 +163,10 @@ static void
crop_to_widget (CcCropArea *area,
GdkRectangle *crop)
{
- crop->x = area->priv->image.x + area->priv->crop.x * area->priv->scale;
- crop->y = area->priv->image.y + area->priv->crop.y * area->priv->scale;
- crop->width = area->priv->crop.width * area->priv->scale;
- crop->height = area->priv->crop.height * area->priv->scale;
+ crop->x = area->image.x + area->crop.x * area->scale;
+ crop->y = area->image.y + area->crop.y * area->scale;
+ crop->width = area->crop.width * area->scale;
+ crop->height = area->crop.height * area->scale;
}
typedef enum {
@@ -188,30 +190,30 @@ cc_crop_area_draw (GtkWidget *widget,
gint width, height, ix, iy;
CcCropArea *uarea = CC_CROP_AREA (widget);
- if (uarea->priv->browse_pixbuf == NULL)
+ if (uarea->browse_pixbuf == NULL)
return FALSE;
update_pixbufs (uarea);
- width = gdk_pixbuf_get_width (uarea->priv->pixbuf);
- height = gdk_pixbuf_get_height (uarea->priv->pixbuf);
+ width = gdk_pixbuf_get_width (uarea->pixbuf);
+ height = gdk_pixbuf_get_height (uarea->pixbuf);
crop_to_widget (uarea, &crop);
- ix = uarea->priv->image.x;
- iy = uarea->priv->image.y;
+ ix = uarea->image.x;
+ iy = uarea->image.y;
- gdk_cairo_set_source_pixbuf (cr, uarea->priv->color_shifted, ix, iy);
+ gdk_cairo_set_source_pixbuf (cr, uarea->color_shifted, ix, iy);
cairo_rectangle (cr, ix, iy, width, crop.y - iy);
cairo_rectangle (cr, ix, crop.y, crop.x - ix, crop.height);
cairo_rectangle (cr, crop.x + crop.width, crop.y, width - crop.width - (crop.x - ix), crop.height);
cairo_rectangle (cr, ix, crop.y + crop.height, width, height - crop.height - (crop.y - iy));
cairo_fill (cr);
- gdk_cairo_set_source_pixbuf (cr, uarea->priv->pixbuf, ix, iy);
+ gdk_cairo_set_source_pixbuf (cr, uarea->pixbuf, ix, iy);
cairo_rectangle (cr, crop.x, crop.y, crop.width, crop.height);
cairo_fill (cr);
- if (uarea->priv->active_region != OUTSIDE) {
+ if (uarea->active_region != OUTSIDE) {
gint x1, x2, y1, y2;
cairo_set_source_rgb (cr, 1, 1, 1);
cairo_set_line_width (cr, 1.0);
@@ -310,7 +312,7 @@ update_cursor (CcCropArea *area,
GdkRectangle crop;
gint region;
- region = area->priv->active_region;
+ region = area->active_region;
if (region == OUTSIDE) {
crop_to_widget (area, &crop);
region = find_location (&crop, x, y);
@@ -351,12 +353,12 @@ update_cursor (CcCropArea *area,
g_assert_not_reached ();
}
- if (cursor_type != area->priv->current_cursor) {
+ if (cursor_type != area->current_cursor) {
GdkCursor *cursor = gdk_cursor_new_for_display (gtk_widget_get_display (GTK_WIDGET (area)),
cursor_type);
gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (area)), cursor);
g_object_unref (cursor);
- area->priv->current_cursor = cursor_type;
+ area->current_cursor = cursor_type;
}
}
@@ -390,7 +392,7 @@ cc_crop_area_motion_notify_event (GtkWidget *widget,
gdouble center_x, center_y;
gint min_width, min_height;
- if (area->priv->browse_pixbuf == NULL)
+ if (area->browse_pixbuf == NULL)
return FALSE;
update_cursor (area, event->x, event->y);
@@ -400,26 +402,26 @@ cc_crop_area_motion_notify_event (GtkWidget *widget,
damage.x - 1, damage.y - 1,
damage.width + 2, damage.height + 2);
- pb_width = gdk_pixbuf_get_width (area->priv->browse_pixbuf);
- pb_height = gdk_pixbuf_get_height (area->priv->browse_pixbuf);
+ pb_width = gdk_pixbuf_get_width (area->browse_pixbuf);
+ pb_height = gdk_pixbuf_get_height (area->browse_pixbuf);
- x = (event->x - area->priv->image.x) / area->priv->scale;
- y = (event->y - area->priv->image.y) / area->priv->scale;
+ x = (event->x - area->image.x) / area->scale;
+ y = (event->y - area->image.y) / area->scale;
- delta_x = x - area->priv->last_press_x;
- delta_y = y - area->priv->last_press_y;
- area->priv->last_press_x = x;
- area->priv->last_press_y = y;
+ delta_x = x - area->last_press_x;
+ delta_y = y - area->last_press_y;
+ area->last_press_x = x;
+ area->last_press_y = y;
- left = area->priv->crop.x;
- right = area->priv->crop.x + area->priv->crop.width - 1;
- top = area->priv->crop.y;
- bottom = area->priv->crop.y + area->priv->crop.height - 1;
+ left = area->crop.x;
+ right = area->crop.x + area->crop.width - 1;
+ top = area->crop.y;
+ bottom = area->crop.y + area->crop.height - 1;
center_x = (left + right) / 2.0;
center_y = (top + bottom) / 2.0;
- switch (area->priv->active_region) {
+ switch (area->active_region) {
case INSIDE:
width = right - left + 1;
height = bottom - top + 1;
@@ -456,101 +458,101 @@ cc_crop_area_motion_notify_event (GtkWidget *widget,
break;
case TOP_LEFT:
- if (area->priv->aspect < 0) {
+ if (area->aspect < 0) {
top = y;
left = x;
}
else if (y < eval_radial_line (center_x, center_y, left, top, x)) {
top = y;
- new_width = (bottom - top) * area->priv->aspect;
+ new_width = (bottom - top) * area->aspect;
left = right - new_width;
}
else {
left = x;
- new_height = (right - left) / area->priv->aspect;
+ new_height = (right - left) / area->aspect;
top = bottom - new_height;
}
break;
case TOP:
top = y;
- if (area->priv->aspect > 0) {
- new_width = (bottom - top) * area->priv->aspect;
+ if (area->aspect > 0) {
+ new_width = (bottom - top) * area->aspect;
right = left + new_width;
}
break;
case TOP_RIGHT:
- if (area->priv->aspect < 0) {
+ if (area->aspect < 0) {
top = y;
right = x;
}
else if (y < eval_radial_line (center_x, center_y, right, top, x)) {
top = y;
- new_width = (bottom - top) * area->priv->aspect;
+ new_width = (bottom - top) * area->aspect;
right = left + new_width;
}
else {
right = x;
- new_height = (right - left) / area->priv->aspect;
+ new_height = (right - left) / area->aspect;
top = bottom - new_height;
}
break;
case LEFT:
left = x;
- if (area->priv->aspect > 0) {
- new_height = (right - left) / area->priv->aspect;
+ if (area->aspect > 0) {
+ new_height = (right - left) / area->aspect;
bottom = top + new_height;
}
break;
case BOTTOM_LEFT:
- if (area->priv->aspect < 0) {
+ if (area->aspect < 0) {
bottom = y;
left = x;
}
else if (y < eval_radial_line (center_x, center_y, left, bottom, x)) {
left = x;
- new_height = (right - left) / area->priv->aspect;
+ new_height = (right - left) / area->aspect;
bottom = top + new_height;
}
else {
bottom = y;
- new_width = (bottom - top) * area->priv->aspect;
+ new_width = (bottom - top) * area->aspect;
left = right - new_width;
}
break;
case RIGHT:
right = x;
- if (area->priv->aspect > 0) {
- new_height = (right - left) / area->priv->aspect;
+ if (area->aspect > 0) {
+ new_height = (right - left) / area->aspect;
bottom = top + new_height;
}
break;
case BOTTOM_RIGHT:
- if (area->priv->aspect < 0) {
+ if (area->aspect < 0) {
bottom = y;
right = x;
}
else if (y < eval_radial_line (center_x, center_y, right, bottom, x)) {
right = x;
- new_height = (right - left) / area->priv->aspect;
+ new_height = (right - left) / area->aspect;
bottom = top + new_height;
}
else {
bottom = y;
- new_width = (bottom - top) * area->priv->aspect;
+ new_width = (bottom - top) * area->aspect;
right = left + new_width;
}
break;
case BOTTOM:
bottom = y;
- if (area->priv->aspect > 0) {
- new_width = (bottom - top) * area->priv->aspect;
+ if (area->aspect > 0) {
+ new_width = (bottom - top) * area->aspect;
right= left + new_width;
}
break;
@@ -559,12 +561,12 @@ cc_crop_area_motion_notify_event (GtkWidget *widget,
return FALSE;
}
- min_width = area->priv->base_width / area->priv->scale;
- min_height = area->priv->base_height / area->priv->scale;
+ min_width = area->base_width / area->scale;
+ min_height = area->base_height / area->scale;
width = right - left + 1;
height = bottom - top + 1;
- if (area->priv->aspect < 0) {
+ if (area->aspect < 0) {
if (left < 0)
left = 0;
if (top < 0)
@@ -577,7 +579,7 @@ cc_crop_area_motion_notify_event (GtkWidget *widget,
width = right - left + 1;
height = bottom - top + 1;
- switch (area->priv->active_region) {
+ switch (area->active_region) {
case LEFT:
case TOP_LEFT:
case BOTTOM_LEFT:
@@ -594,7 +596,7 @@ cc_crop_area_motion_notify_event (GtkWidget *widget,
default: ;
}
- switch (area->priv->active_region) {
+ switch (area->active_region) {
case TOP:
case TOP_LEFT:
case TOP_RIGHT:
@@ -615,17 +617,17 @@ cc_crop_area_motion_notify_event (GtkWidget *widget,
if (left < 0 || top < 0 ||
right > pb_width || bottom > pb_height ||
width < min_width || height < min_height) {
- left = area->priv->crop.x;
- right = area->priv->crop.x + area->priv->crop.width - 1;
- top = area->priv->crop.y;
- bottom = area->priv->crop.y + area->priv->crop.height - 1;
+ left = area->crop.x;
+ right = area->crop.x + area->crop.width - 1;
+ top = area->crop.y;
+ bottom = area->crop.y + area->crop.height - 1;
}
}
- area->priv->crop.x = left;
- area->priv->crop.y = top;
- area->priv->crop.width = right - left + 1;
- area->priv->crop.height = bottom - top + 1;
+ area->crop.x = left;
+ area->crop.y = top;
+ area->crop.width = right - left + 1;
+ area->crop.height = bottom - top + 1;
crop_to_widget (area, &damage);
gtk_widget_queue_draw_area (widget,
@@ -642,14 +644,14 @@ cc_crop_area_button_press_event (GtkWidget *widget,
CcCropArea *area = CC_CROP_AREA (widget);
GdkRectangle crop;
- if (area->priv->browse_pixbuf == NULL)
+ if (area->browse_pixbuf == NULL)
return FALSE;
crop_to_widget (area, &crop);
- area->priv->last_press_x = (event->x - area->priv->image.x) / area->priv->scale;
- area->priv->last_press_y = (event->y - area->priv->image.y) / area->priv->scale;
- area->priv->active_region = find_location (&crop, event->x, event->y);
+ area->last_press_x = (event->x - area->image.x) / area->scale;
+ area->last_press_y = (event->y - area->image.y) / area->scale;
+ area->active_region = find_location (&crop, event->x, event->y);
gtk_widget_queue_draw_area (widget,
crop.x - 1, crop.y - 1,
@@ -665,14 +667,14 @@ cc_crop_area_button_release_event (GtkWidget *widget,
CcCropArea *area = CC_CROP_AREA (widget);
GdkRectangle crop;
- if (area->priv->browse_pixbuf == NULL)
+ if (area->browse_pixbuf == NULL)
return FALSE;
crop_to_widget (area, &crop);
- area->priv->last_press_x = -1;
- area->priv->last_press_y = -1;
- area->priv->active_region = OUTSIDE;
+ area->last_press_x = -1;
+ area->last_press_y = -1;
+ area->active_region = OUTSIDE;
gtk_widget_queue_draw_area (widget,
crop.x - 1, crop.y - 1,
@@ -685,8 +687,8 @@ static void
cc_crop_area_set_size_request (CcCropArea *area)
{
gtk_widget_set_size_request (GTK_WIDGET (area),
- area->priv->base_width,
- area->priv->base_height);
+ area->base_width,
+ area->base_height);
}
static void
@@ -694,17 +696,17 @@ cc_crop_area_finalize (GObject *object)
{
CcCropArea *area = CC_CROP_AREA (object);
- if (area->priv->browse_pixbuf) {
- g_object_unref (area->priv->browse_pixbuf);
- area->priv->browse_pixbuf = NULL;
+ if (area->browse_pixbuf) {
+ g_object_unref (area->browse_pixbuf);
+ area->browse_pixbuf = NULL;
}
- if (area->priv->pixbuf) {
- g_object_unref (area->priv->pixbuf);
- area->priv->pixbuf = NULL;
+ if (area->pixbuf) {
+ g_object_unref (area->pixbuf);
+ area->pixbuf = NULL;
}
- if (area->priv->color_shifted) {
- g_object_unref (area->priv->color_shifted);
- area->priv->color_shifted = NULL;
+ if (area->color_shifted) {
+ g_object_unref (area->color_shifted);
+ area->color_shifted = NULL;
}
}
@@ -719,29 +721,24 @@ cc_crop_area_class_init (CcCropAreaClass *klass)
widget_class->button_press_event = cc_crop_area_button_press_event;
widget_class->button_release_event = cc_crop_area_button_release_event;
widget_class->motion_notify_event = cc_crop_area_motion_notify_event;
-
- g_type_class_add_private (klass, sizeof (CcCropAreaPrivate));
}
static void
cc_crop_area_init (CcCropArea *area)
{
- area->priv = (G_TYPE_INSTANCE_GET_PRIVATE ((area), CC_TYPE_CROP_AREA,
- CcCropAreaPrivate));
-
gtk_widget_add_events (GTK_WIDGET (area), GDK_POINTER_MOTION_MASK |
GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK);
- area->priv->scale = 0.0;
- area->priv->image.x = 0;
- area->priv->image.y = 0;
- area->priv->image.width = 0;
- area->priv->image.height = 0;
- area->priv->active_region = OUTSIDE;
- area->priv->base_width = 48;
- area->priv->base_height = 48;
- area->priv->aspect = 1;
+ area->scale = 0.0;
+ area->image.x = 0;
+ area->image.y = 0;
+ area->image.width = 0;
+ area->image.height = 0;
+ area->active_region = OUTSIDE;
+ area->base_width = 48;
+ area->base_height = 48;
+ area->aspect = 1;
cc_crop_area_set_size_request (area);
}
@@ -757,14 +754,14 @@ cc_crop_area_get_picture (CcCropArea *area)
{
gint width, height;
- width = gdk_pixbuf_get_width (area->priv->browse_pixbuf);
- height = gdk_pixbuf_get_height (area->priv->browse_pixbuf);
- width = MIN (area->priv->crop.width, width - area->priv->crop.x);
- height = MIN (area->priv->crop.height, height - area->priv->crop.y);
+ width = gdk_pixbuf_get_width (area->browse_pixbuf);
+ height = gdk_pixbuf_get_height (area->browse_pixbuf);
+ width = MIN (area->crop.width, width - area->crop.x);
+ height = MIN (area->crop.height, height - area->crop.y);
- return gdk_pixbuf_new_subpixbuf (area->priv->browse_pixbuf,
- area->priv->crop.x,
- area->priv->crop.y,
+ return gdk_pixbuf_new_subpixbuf (area->browse_pixbuf,
+ area->crop.x,
+ area->crop.y,
width, height);
}
@@ -775,12 +772,12 @@ cc_crop_area_set_picture (CcCropArea *area,
int width;
int height;
- if (area->priv->browse_pixbuf) {
- g_object_unref (area->priv->browse_pixbuf);
- area->priv->browse_pixbuf = NULL;
+ if (area->browse_pixbuf) {
+ g_object_unref (area->browse_pixbuf);
+ area->browse_pixbuf = NULL;
}
if (pixbuf) {
- area->priv->browse_pixbuf = g_object_ref (pixbuf);
+ area->browse_pixbuf = g_object_ref (pixbuf);
width = gdk_pixbuf_get_width (pixbuf);
height = gdk_pixbuf_get_height (pixbuf);
} else {
@@ -788,16 +785,16 @@ cc_crop_area_set_picture (CcCropArea *area,
height = 0;
}
- area->priv->crop.width = 2 * area->priv->base_width;
- area->priv->crop.height = 2 * area->priv->base_height;
- area->priv->crop.x = (width - area->priv->crop.width) / 2;
- area->priv->crop.y = (height - area->priv->crop.height) / 2;
+ area->crop.width = 2 * area->base_width;
+ area->crop.height = 2 * area->base_height;
+ area->crop.x = (width - area->crop.width) / 2;
+ area->crop.y = (height - area->crop.height) / 2;
- area->priv->scale = 0.0;
- area->priv->image.x = 0;
- area->priv->image.y = 0;
- area->priv->image.width = 0;
- area->priv->image.height = 0;
+ area->scale = 0.0;
+ area->image.x = 0;
+ area->image.y = 0;
+ area->image.width = 0;
+ area->image.height = 0;
gtk_widget_queue_draw (GTK_WIDGET (area));
}
@@ -807,13 +804,13 @@ cc_crop_area_set_min_size (CcCropArea *area,
gint width,
gint height)
{
- area->priv->base_width = width;
- area->priv->base_height = height;
+ area->base_width = width;
+ area->base_height = height;
cc_crop_area_set_size_request (area);
- if (area->priv->aspect > 0) {
- area->priv->aspect = area->priv->base_width / (gdouble)area->priv->base_height;
+ if (area->aspect > 0) {
+ area->aspect = area->base_width / (gdouble)area->base_height;
}
}
@@ -822,10 +819,10 @@ cc_crop_area_set_constrain_aspect (CcCropArea *area,
gboolean constrain)
{
if (constrain) {
- area->priv->aspect = area->priv->base_width / (gdouble)area->priv->base_height;
+ area->aspect = area->base_width / (gdouble)area->base_height;
}
else {
- area->priv->aspect = -1;
+ area->aspect = -1;
}
}
diff --git a/panels/user-accounts/cc-crop-area.h b/panels/user-accounts/cc-crop-area.h
index 38657c6..511b518 100644
--- a/panels/user-accounts/cc-crop-area.h
+++ b/panels/user-accounts/cc-crop-area.h
@@ -25,30 +25,9 @@
G_BEGIN_DECLS
-#define CC_TYPE_CROP_AREA (cc_crop_area_get_type ())
-#define CC_CROP_AREA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CC_TYPE_CROP_AREA, \
- CcCropArea))
-#define CC_CROP_AREA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CC_TYPE_CROP_AREA, \
- CcCropAreaClass))
-#define CC_IS_CROP_AREA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CC_TYPE_CROP_AREA))
-#define CC_IS_CROP_AREA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CC_TYPE_CROP_AREA))
-#define CC_CROP_AREA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CC_TYPE_CROP_AREA, \
- CcCropAreaClass))
+#define CC_TYPE_CROP_AREA cc_crop_area_get_type ()
-typedef struct _CcCropAreaClass CcCropAreaClass;
-typedef struct _CcCropArea CcCropArea;
-typedef struct _CcCropAreaPrivate CcCropAreaPrivate;
-
-struct _CcCropAreaClass {
- GtkDrawingAreaClass parent_class;
-};
-
-struct _CcCropArea {
- GtkDrawingArea parent_instance;
- CcCropAreaPrivate *priv;
-};
-
-GType cc_crop_area_get_type (void) G_GNUC_CONST;
+G_DECLARE_FINAL_TYPE (CcCropArea, cc_crop_area, CC, CROP_AREA, GtkDrawingArea)
GtkWidget *cc_crop_area_new (void);
GdkPixbuf *cc_crop_area_get_picture (CcCropArea *area);
diff --git a/panels/user-accounts/um-account-dialog.c b/panels/user-accounts/um-account-dialog.c
index 91cba2e..49ab95c 100644
--- a/panels/user-accounts/um-account-dialog.c
+++ b/panels/user-accounts/um-account-dialog.c
@@ -68,7 +68,8 @@ static void um_account_dialog_response (GtkDialog *dialog,
UmAccountDialogClass))
struct _UmAccountDialog {
- GtkDialog parent;
+ GtkDialog parent_instance;
+
GtkWidget *stack;
GSimpleAsyncResult *async;
GCancellable *cancellable;
@@ -118,10 +119,6 @@ struct _UmAccountDialog {
gboolean join_prompted;
};
-struct _UmAccountDialogClass {
- GtkDialogClass parent_class;
-};
-
G_DEFINE_TYPE (UmAccountDialog, um_account_dialog, GTK_TYPE_DIALOG);
static void
diff --git a/panels/user-accounts/um-account-dialog.h b/panels/user-accounts/um-account-dialog.h
index 9e8361d..0e47de9 100644
--- a/panels/user-accounts/um-account-dialog.h
+++ b/panels/user-accounts/um-account-dialog.h
@@ -26,14 +26,10 @@
G_BEGIN_DECLS
-#define UM_TYPE_ACCOUNT_DIALOG (um_account_dialog_get_type ())
-#define UM_ACCOUNT_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UM_TYPE_ACCOUNT_DIALOG,
UmAccountDialog))
-#define UM_IS_ACCOUNT_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UM_TYPE_ACCOUNT_DIALOG))
+#define UM_TYPE_ACCOUNT_DIALOG um_account_dialog_get_type ()
-typedef struct _UmAccountDialog UmAccountDialog;
-typedef struct _UmAccountDialogClass UmAccountDialogClass;
+G_DECLARE_FINAL_TYPE (UmAccountDialog, um_account_dialog, UM, ACCOUNT_DIALOG, GtkDialog)
-GType um_account_dialog_get_type (void) G_GNUC_CONST;
UmAccountDialog *um_account_dialog_new (void);
void um_account_dialog_show (UmAccountDialog *self,
GtkWindow *parent,
diff --git a/panels/user-accounts/um-cell-renderer-user-image.c
b/panels/user-accounts/um-cell-renderer-user-image.c
index bcd6160..b979763 100644
--- a/panels/user-accounts/um-cell-renderer-user-image.c
+++ b/panels/user-accounts/um-cell-renderer-user-image.c
@@ -23,20 +23,20 @@
#include "um-utils.h"
-struct _UmCellRendererUserImagePrivate {
+struct _UmCellRendererUserImage {
+ GtkCellRendererPixbuf parent_instance;
+
GtkWidget *parent;
ActUser *user;
};
-#define UM_CELL_RENDERER_USER_IMAGE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj),
UM_TYPE_CELL_RENDERER_USER_IMAGE, UmCellRendererUserImagePrivate))
-
enum {
PROP_0,
PROP_PARENT,
PROP_USER
};
-G_DEFINE_TYPE_WITH_CODE (UmCellRendererUserImage, um_cell_renderer_user_image,
GTK_TYPE_CELL_RENDERER_PIXBUF, G_ADD_PRIVATE (UmCellRendererUserImage));
+G_DEFINE_TYPE (UmCellRendererUserImage, um_cell_renderer_user_image, GTK_TYPE_CELL_RENDERER_PIXBUF)
static void
render_user_image (UmCellRendererUserImage *cell_renderer)
@@ -44,9 +44,9 @@ render_user_image (UmCellRendererUserImage *cell_renderer)
cairo_surface_t *surface;
gint scale;
- if (cell_renderer->priv->user != NULL) {
- scale = gtk_widget_get_scale_factor (cell_renderer->priv->parent);
- surface = render_user_icon (cell_renderer->priv->user, UM_ICON_STYLE_FRAME |
UM_ICON_STYLE_STATUS, 48, scale);
+ if (cell_renderer->user != NULL) {
+ scale = gtk_widget_get_scale_factor (cell_renderer->parent);
+ surface = render_user_icon (cell_renderer->user, UM_ICON_STYLE_FRAME | UM_ICON_STYLE_STATUS,
48, scale);
g_object_set (GTK_CELL_RENDERER_PIXBUF (cell_renderer), "surface", surface, NULL);
cairo_surface_destroy (surface);
} else {
@@ -74,12 +74,12 @@ um_cell_renderer_user_image_set_property (GObject *object,
switch (prop_id) {
case PROP_PARENT:
- cell_renderer->priv->parent = g_value_dup_object (value);
- g_signal_connect (cell_renderer->priv->parent, "notify::scale-factor", G_CALLBACK
(on_scale_factor_changed), cell_renderer);
+ cell_renderer->parent = g_value_dup_object (value);
+ g_signal_connect (cell_renderer->parent, "notify::scale-factor", G_CALLBACK
(on_scale_factor_changed), cell_renderer);
break;
case PROP_USER:
- g_clear_object (&cell_renderer->priv->user);
- cell_renderer->priv->user = g_value_dup_object (value);
+ g_clear_object (&cell_renderer->user);
+ cell_renderer->user = g_value_dup_object (value);
render_user_image (cell_renderer);
break;
default:
@@ -93,8 +93,8 @@ um_cell_renderer_user_image_finalize (GObject *object)
{
UmCellRendererUserImage *cell_renderer = UM_CELL_RENDERER_USER_IMAGE (object);
- g_clear_object (&cell_renderer->priv->parent);
- g_clear_object (&cell_renderer->priv->user);
+ g_clear_object (&cell_renderer->parent);
+ g_clear_object (&cell_renderer->user);
G_OBJECT_CLASS (um_cell_renderer_user_image_parent_class)->finalize (object);
}
@@ -127,7 +127,6 @@ um_cell_renderer_user_image_class_init (UmCellRendererUserImageClass *class)
static void
um_cell_renderer_user_image_init (UmCellRendererUserImage *cell_renderer)
{
- cell_renderer->priv = UM_CELL_RENDERER_USER_IMAGE_GET_PRIVATE (cell_renderer);
}
GtkCellRenderer *
diff --git a/panels/user-accounts/um-cell-renderer-user-image.h
b/panels/user-accounts/um-cell-renderer-user-image.h
index 6176d2b..e1be7f9 100644
--- a/panels/user-accounts/um-cell-renderer-user-image.h
+++ b/panels/user-accounts/um-cell-renderer-user-image.h
@@ -25,27 +25,8 @@ G_BEGIN_DECLS
#define UM_TYPE_CELL_RENDERER_USER_IMAGE um_cell_renderer_user_image_get_type()
-#define UM_CELL_RENDERER_USER_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj),
UM_TYPE_CELL_RENDERER_USER_IMAGE, UmCellRendererUserImage))
-#define UM_CELL_RENDERER_USER_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass),
UM_TYPE_CELL_RENDERER_USER_IMAGE, UmCellRendererUserImageClass))
-#define UM_IS_CELL_RENDERER_USER_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj),
UM_TYPE_CELL_RENDERER_USER_IMAGE))
-#define UM_IS_CELL_RENDERER_USER_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),
UM_TYPE_CELL_RENDERER_USER_IMAGE))
-#define UM_CELL_RENDERER_USER_IMAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),
UM_TYPE_CELL_RENDERER_USER_IMAGE, UmCellRendererUserImageClass))
+G_DECLARE_FINAL_TYPE (UmCellRendererUserImage, um_cell_renderer_user_image, UM, CELL_RENDERER_USER_IMAGE,
GtkCellRendererPixbuf)
-typedef struct _UmCellRendererUserImage UmCellRendererUserImage;
-typedef struct _UmCellRendererUserImageClass UmCellRendererUserImageClass;
-typedef struct _UmCellRendererUserImagePrivate UmCellRendererUserImagePrivate;
-
-struct _UmCellRendererUserImage {
- GtkCellRendererPixbuf parent;
-
- UmCellRendererUserImagePrivate *priv;
-};
-
-struct _UmCellRendererUserImageClass {
- GtkCellRendererPixbufClass parent_class;
-};
-
-GType um_cell_renderer_user_image_get_type (void) G_GNUC_CONST;
GtkCellRenderer *um_cell_renderer_user_image_new (GtkWidget *parent);
G_END_DECLS
diff --git a/panels/user-accounts/um-realm-manager.c b/panels/user-accounts/um-realm-manager.c
index 2639148..1a97536 100644
--- a/panels/user-accounts/um-realm-manager.c
+++ b/panels/user-accounts/um-realm-manager.c
@@ -35,15 +35,12 @@
struct _UmRealmManager {
- UmRealmObjectManagerClient parent;
+ UmRealmObjectManagerClient parent_instance;
+
UmRealmProvider *provider;
guint diagnostics_sig;
};
-typedef struct {
- UmRealmProviderProxyClass parent_class;
-} UmRealmManagerClass;
-
enum {
REALM_ADDED,
NUM_SIGNALS,
diff --git a/panels/user-accounts/um-realm-manager.h b/panels/user-accounts/um-realm-manager.h
index 2bf61e6..6989dd9 100644
--- a/panels/user-accounts/um-realm-manager.h
+++ b/panels/user-accounts/um-realm-manager.h
@@ -36,13 +36,9 @@ typedef enum {
GQuark um_realm_error_get_quark (void) G_GNUC_CONST;
-#define UM_TYPE_REALM_MANAGER (um_realm_manager_get_type ())
-#define UM_REALM_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UM_TYPE_REALM_MANAGER,
UmRealmManager))
-#define UM_IS_REALM_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UM_TYPE_REALM_MANAGER))
+#define UM_TYPE_REALM_MANAGER um_realm_manager_get_type ()
-typedef struct _UmRealmManager UmRealmManager;
-
-GType um_realm_manager_get_type (void) G_GNUC_CONST;
+G_DECLARE_FINAL_TYPE (UmRealmManager, um_realm_manager, UM, REALM_MANAGER, UmRealmObjectManagerClient)
void um_realm_manager_new (GCancellable *cancellable,
GAsyncReadyCallback callback,
diff --git a/panels/user-accounts/um-user-image.c b/panels/user-accounts/um-user-image.c
index 5f30bac..f930039 100644
--- a/panels/user-accounts/um-user-image.c
+++ b/panels/user-accounts/um-user-image.c
@@ -23,13 +23,13 @@
#include "um-utils.h"
-struct _UmUserImagePrivate {
+struct _UmUserImage {
+ GtkImage parent_instance;
+
ActUser *user;
};
-#define UM_USER_IMAGE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), UM_TYPE_USER_IMAGE,
UmUserImagePrivate))
-
-G_DEFINE_TYPE_WITH_CODE (UmUserImage, um_user_image, GTK_TYPE_IMAGE, G_ADD_PRIVATE (UmUserImage));
+G_DEFINE_TYPE (UmUserImage, um_user_image, GTK_TYPE_IMAGE)
static void
render_image (UmUserImage *image)
@@ -37,12 +37,12 @@ render_image (UmUserImage *image)
cairo_surface_t *surface;
gint scale, pixel_size;
- if (image->priv->user == NULL)
+ if (image->user == NULL)
return;
pixel_size = gtk_image_get_pixel_size (GTK_IMAGE (image));
scale = gtk_widget_get_scale_factor (GTK_WIDGET (image));
- surface = render_user_icon (image->priv->user,
+ surface = render_user_icon (image->user,
UM_ICON_STYLE_NONE,
pixel_size > 0 ? pixel_size : 48,
scale);
@@ -54,8 +54,8 @@ void
um_user_image_set_user (UmUserImage *image,
ActUser *user)
{
- g_clear_object (&image->priv->user);
- image->priv->user = g_object_ref (user);
+ g_clear_object (&image->user);
+ image->user = g_object_ref (user);
render_image (image);
}
@@ -65,7 +65,7 @@ um_user_image_finalize (GObject *object)
{
UmUserImage *image = UM_USER_IMAGE (object);
- g_clear_object (&image->priv->user);
+ g_clear_object (&image->user);
G_OBJECT_CLASS (um_user_image_parent_class)->finalize (object);
}
@@ -81,8 +81,6 @@ um_user_image_class_init (UmUserImageClass *class)
static void
um_user_image_init (UmUserImage *image)
{
- image->priv = UM_USER_IMAGE_GET_PRIVATE (image);
-
g_signal_connect_swapped (image, "notify::scale-factor", G_CALLBACK (render_image), image);
g_signal_connect_swapped (image, "notify::pixel-size", G_CALLBACK (render_image), image);
}
diff --git a/panels/user-accounts/um-user-image.h b/panels/user-accounts/um-user-image.h
index 371b404..cbce01b 100644
--- a/panels/user-accounts/um-user-image.h
+++ b/panels/user-accounts/um-user-image.h
@@ -26,28 +26,10 @@ G_BEGIN_DECLS
#define UM_TYPE_USER_IMAGE um_user_image_get_type()
-#define UM_USER_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UM_TYPE_USER_IMAGE, UmUserImage))
-#define UM_USER_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UM_TYPE_USER_IMAGE, UmUserImageClass))
-#define UM_IS_USER_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UM_TYPE_USER_IMAGE))
-#define UM_IS_USER_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UM_TYPE_USER_IMAGE))
-#define UM_USER_IMAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UM_TYPE_USER_IMAGE,
UmUserImageClass))
+G_DECLARE_FINAL_TYPE (UmUserImage, um_user_image, UM, USER_IMAGE, GtkImage)
-typedef struct _UmUserImage UmUserImage;
-typedef struct _UmUserImageClass UmUserImageClass;
-typedef struct _UmUserImagePrivate UmUserImagePrivate;
-
-struct _UmUserImage {
- GtkImage parent;
-
- UmUserImagePrivate *priv;
-};
-
-struct _UmUserImageClass {
- GtkImageClass parent_class;
-};
-
-GType um_user_image_get_type (void) G_GNUC_CONST;
GtkWidget *um_user_image_new (void);
+
void um_user_image_set_user (UmUserImage *image, ActUser *user);
G_END_DECLS
diff --git a/panels/user-accounts/um-user-panel.c b/panels/user-accounts/um-user-panel.c
index c1875cb..40702f2 100644
--- a/panels/user-accounts/um-user-panel.c
+++ b/panels/user-accounts/um-user-panel.c
@@ -58,12 +58,9 @@
#define USER_ACCOUNTS_PERMISSION "org.gnome.controlcenter.user-accounts.administration"
-CC_PANEL_REGISTER (CcUserPanel, cc_user_panel)
-
-#define UM_USER_PANEL_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), UM_TYPE_USER_PANEL, CcUserPanelPrivate))
+struct _CcUserPanel {
+ CcPanel parent_instance;
-struct _CcUserPanelPrivate {
ActUserManager *um;
GCancellable *cancellable;
GtkBuilder *builder;
@@ -86,16 +83,18 @@ struct _CcUserPanelPrivate {
UmAccountDialog *account_dialog;
};
+CC_PANEL_REGISTER (CcUserPanel, cc_user_panel)
+
static GtkWidget *
-get_widget (CcUserPanelPrivate *d, const char *name)
+get_widget (CcUserPanel *self, const char *name)
{
- return (GtkWidget *)gtk_builder_get_object (d->builder, name);
+ return (GtkWidget *)gtk_builder_get_object (self->builder, name);
}
#define PAGE_LOCK "_lock"
#define PAGE_ADDUSER "_adduser"
-static void show_restart_notification (CcUserPanelPrivate *d, const gchar *locale);
+static void show_restart_notification (CcUserPanel *self, const gchar *locale);
static gint user_compare (gconstpointer i, gconstpointer u);
typedef struct {
@@ -114,13 +113,13 @@ async_delete_data_free (AsyncDeleteData *data)
}
static void
-show_error_dialog (CcUserPanelPrivate *d,
+show_error_dialog (CcUserPanel *self,
const gchar *message,
GError *error)
{
GtkWidget *dialog;
- dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (d->main_box)),
+ dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (self->main_box)),
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT |
GTK_DIALOG_USE_HEADER_BAR,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
@@ -137,9 +136,9 @@ show_error_dialog (CcUserPanelPrivate *d,
}
static ActUser *
-get_selected_user (CcUserPanelPrivate *d)
+get_selected_user (CcUserPanel *self)
{
- return d->selected_user;
+ return self->selected_user;
}
static const gchar *
@@ -154,25 +153,25 @@ get_real_or_user_name (ActUser *user)
return name;
}
-static void show_user (ActUser *user, CcUserPanelPrivate *d);
+static void show_user (ActUser *user, CcUserPanel *self);
static void
-set_selected_user (UmCarousel *carousel, UmCarouselItem *item, CcUserPanelPrivate *d)
+set_selected_user (UmCarousel *carousel, UmCarouselItem *item, CcUserPanel *self)
{
uid_t uid;
- g_clear_object (&d->selected_user);
+ g_clear_object (&self->selected_user);
uid = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (item), "uid"));
- d->selected_user = act_user_manager_get_user_by_id (d->um, uid);
+ self->selected_user = act_user_manager_get_user_by_id (self->um, uid);
- if (d->selected_user != NULL) {
- show_user (d->selected_user, d);
+ if (self->selected_user != NULL) {
+ show_user (self->selected_user, self);
}
}
static GtkWidget *
-create_carousel_entry (CcUserPanelPrivate *d, ActUser *user)
+create_carousel_entry (CcUserPanel *self, ActUser *user)
{
GtkWidget *box, *widget;
gchar *label;
@@ -208,7 +207,7 @@ create_carousel_entry (CcUserPanelPrivate *d, ActUser *user)
}
static void
-user_added (ActUserManager *um, ActUser *user, CcUserPanelPrivate *d)
+user_added (ActUserManager *um, ActUser *user, CcUserPanel *self)
{
GtkWidget *item, *widget;
gboolean show_carousel;
@@ -219,20 +218,20 @@ user_added (ActUserManager *um, ActUser *user, CcUserPanelPrivate *d)
g_debug ("user added: %d %s\n", act_user_get_uid (user), get_real_or_user_name (user));
- widget = create_carousel_entry (d, user);
+ widget = create_carousel_entry (self, user);
item = um_carousel_item_new ();
gtk_container_add (GTK_CONTAINER (item), widget);
g_object_set_data (G_OBJECT (item), "uid", GINT_TO_POINTER (act_user_get_uid (user)));
- gtk_container_add (GTK_CONTAINER (d->carousel), item);
+ gtk_container_add (GTK_CONTAINER (self->carousel), item);
if (act_user_get_uid (user) != getuid ()) {
- d->other_accounts++;
+ self->other_accounts++;
}
/* Show heading for other accounts if new one have been added. */
- show_carousel = (d->other_accounts > 0);
- gtk_revealer_set_reveal_child (GTK_REVEALER (d->carousel), show_carousel);
+ show_carousel = (self->other_accounts > 0);
+ gtk_revealer_set_reveal_child (GTK_REVEALER (self->carousel), show_carousel);
}
static gint
@@ -266,7 +265,7 @@ sort_users (gconstpointer a, gconstpointer b)
}
static void
-reload_users (CcUserPanelPrivate *d, ActUser *selected_user)
+reload_users (CcUserPanel *self, ActUser *selected_user)
{
ActUser *user;
GSList *list, *l;
@@ -279,44 +278,44 @@ reload_users (CcUserPanelPrivate *d, ActUser *selected_user)
g_object_get (settings, "gtk-enable-animations", &animations, NULL);
g_object_set (settings, "gtk-enable-animations", FALSE, NULL);
- um_carousel_purge_items (d->carousel);
+ um_carousel_purge_items (self->carousel);
- d->other_accounts = 0;
+ self->other_accounts = 0;
- list = act_user_manager_list_users (d->um);
+ list = act_user_manager_list_users (self->um);
g_debug ("Got %d users\n", g_slist_length (list));
list = g_slist_sort (list, (GCompareFunc) sort_users);
for (l = list; l; l = l->next) {
user = l->data;
g_debug ("adding user %s\n", get_real_or_user_name (user));
- user_added (d->um, user, d);
+ user_added (self->um, user, self);
}
g_slist_free (list);
if (selected_user) {
- item = um_carousel_find_item (d->carousel, selected_user, user_compare);
- um_carousel_select_item (d->carousel, item);
+ item = um_carousel_find_item (self->carousel, selected_user, user_compare);
+ um_carousel_select_item (self->carousel, item);
}
g_object_set (settings, "gtk-enable-animations", animations, NULL);
}
static void
-user_removed (ActUserManager *um, ActUser *user, CcUserPanelPrivate *d)
+user_removed (ActUserManager *um, ActUser *user, CcUserPanel *self)
{
gboolean show_carousel;
- d->other_accounts--;
- show_carousel = (d->other_accounts > 0);
- gtk_revealer_set_reveal_child (GTK_REVEALER (d->carousel),
+ self->other_accounts--;
+ show_carousel = (self->other_accounts > 0);
+ gtk_revealer_set_reveal_child (GTK_REVEALER (self->carousel),
show_carousel);
- reload_users (d, NULL);
+ reload_users (self, NULL);
/* Show the current user */
- user = act_user_manager_get_user_by_id (d->um, getuid ());
- show_user (user, d);
+ user = act_user_manager_get_user_by_id (self->um, getuid ());
+ show_user (user, self);
}
static gint
@@ -340,12 +339,12 @@ user_compare (gconstpointer i,
}
static void
-user_changed (ActUserManager *um, ActUser *user, CcUserPanelPrivate *d)
+user_changed (ActUserManager *um, ActUser *user, CcUserPanel *self)
{
- if (act_user_get_uid (user) != act_user_get_uid (d->selected_user))
+ if (act_user_get_uid (user) != act_user_get_uid (self->selected_user))
return;
- reload_users (d, user);
+ reload_users (self, user);
}
static void
@@ -353,33 +352,33 @@ select_created_user (GObject *object,
GAsyncResult *result,
gpointer user_data)
{
- CcUserPanelPrivate *d = user_data;
+ CcUserPanel *self = user_data;
UmAccountDialog *dialog;
ActUser *user;
dialog = UM_ACCOUNT_DIALOG (object);
user = um_account_dialog_finish (dialog, result);
gtk_widget_destroy (GTK_WIDGET (dialog));
- d->account_dialog = NULL;
+ self->account_dialog = NULL;
if (user == NULL)
return;
- reload_users (d, user);
+ reload_users (self, user);
}
static void
-add_user (GtkButton *button, CcUserPanelPrivate *d)
+add_user (GtkButton *button, CcUserPanel *self)
{
- d->account_dialog = um_account_dialog_new ();
- um_account_dialog_show (d->account_dialog, GTK_WINDOW (gtk_widget_get_toplevel (d->main_box)),
- d->permission, select_created_user, d);
+ self->account_dialog = um_account_dialog_new ();
+ um_account_dialog_show (self->account_dialog, GTK_WINDOW (gtk_widget_get_toplevel (self->main_box)),
+ self->permission, select_created_user, self);
}
static void
delete_user_done (ActUserManager *manager,
GAsyncResult *res,
- CcUserPanelPrivate *d)
+ CcUserPanel *self)
{
GError *error;
@@ -387,7 +386,7 @@ delete_user_done (ActUserManager *manager,
if (!act_user_manager_delete_user_finish (manager, res, &error)) {
if (!g_error_matches (error, ACT_USER_MANAGER_ERROR,
ACT_USER_MANAGER_ERROR_PERMISSION_DENIED))
- show_error_dialog (d, _("Failed to delete user"), error);
+ show_error_dialog (self, _("Failed to delete user"), error);
g_error_free (error);
}
@@ -396,7 +395,7 @@ delete_user_done (ActUserManager *manager,
static void
delete_user_response (GtkWidget *dialog,
gint response_id,
- CcUserPanelPrivate *d)
+ CcUserPanel *self)
{
ActUser *user;
gboolean remove_files;
@@ -413,19 +412,19 @@ delete_user_response (GtkWidget *dialog,
remove_files = FALSE;
}
- user = get_selected_user (d);
+ user = get_selected_user (self);
/* remove autologin */
if (act_user_get_automatic_login (user)) {
act_user_set_automatic_login (user, FALSE);
}
- act_user_manager_delete_user_async (d->um,
+ act_user_manager_delete_user_async (self->um,
user,
remove_files,
NULL,
(GAsyncReadyCallback)delete_user_done,
- d);
+ self);
}
static void
@@ -434,7 +433,7 @@ enterprise_user_revoked (GObject *source,
gpointer user_data)
{
AsyncDeleteData *data = user_data;
- CcUserPanelPrivate *d = data->self->priv;
+ CcUserPanel *self = data->self;
UmRealmCommon *common = UM_REALM_COMMON (source);
GError *error = NULL;
@@ -445,7 +444,7 @@ enterprise_user_revoked (GObject *source,
um_realm_common_call_change_login_policy_finish (common, result, &error);
if (error != NULL) {
- show_error_dialog (d, _("Failed to revoke remotely managed user"), error);
+ show_error_dialog (self, _("Failed to revoke remotely managed user"), error);
g_error_free (error);
}
@@ -489,7 +488,7 @@ realm_manager_found (GObject *source,
gpointer user_data)
{
AsyncDeleteData *data = user_data;
- CcUserPanelPrivate *d = data->self->priv;
+ CcUserPanel *self = data->self;
UmRealmCommon *common;
UmRealmManager *realm_manager;
const gchar *add[1];
@@ -504,7 +503,7 @@ realm_manager_found (GObject *source,
realm_manager = um_realm_manager_new_finish (result, &error);
if (error != NULL) {
- show_error_dialog (d, _("Failed to revoke remotely managed user"), error);
+ show_error_dialog (self, _("Failed to revoke remotely managed user"), error);
g_error_free (error);
async_delete_data_free (data);
return;
@@ -541,7 +540,7 @@ enterprise_user_uncached (GObject *source,
gpointer user_data)
{
AsyncDeleteData *data = user_data;
- CcUserPanelPrivate *d = data->self->priv;
+ CcUserPanel *self = data->self;
ActUserManager *manager = ACT_USER_MANAGER (source);
GError *error = NULL;
@@ -553,10 +552,10 @@ enterprise_user_uncached (GObject *source,
act_user_manager_uncache_user_finish (manager, res, &error);
if (error == NULL) {
/* Find realm manager */
- um_realm_manager_new (d->cancellable, realm_manager_found, data);
+ um_realm_manager_new (self->cancellable, realm_manager_found, data);
}
else {
- show_error_dialog (d, _("Failed to revoke remotely managed user"), error);
+ show_error_dialog (self, _("Failed to revoke remotely managed user"), error);
g_error_free (error);
async_delete_data_free (data);
}
@@ -568,7 +567,6 @@ delete_enterprise_user_response (GtkWidget *dialog,
gpointer user_data)
{
CcUserPanel *self = UM_USER_PANEL (user_data);
- CcUserPanelPrivate *d = self->priv;
AsyncDeleteData *data;
ActUser *user;
@@ -578,17 +576,17 @@ delete_enterprise_user_response (GtkWidget *dialog,
return;
}
- user = get_selected_user (self->priv);
+ user = get_selected_user (self);
data = g_slice_new (AsyncDeleteData);
data->self = g_object_ref (self);
- data->cancellable = g_object_ref (d->cancellable);
+ data->cancellable = g_object_ref (self->cancellable);
data->login = g_strdup (act_user_get_user_name (user));
/* Uncache the user account from the accountsservice */
g_debug ("Uncaching remote user: %s", data->login);
- act_user_manager_uncache_user_async (d->um, data->login,
+ act_user_manager_uncache_user_async (self->um, data->login,
data->cancellable,
enterprise_user_uncached,
data);
@@ -597,16 +595,15 @@ delete_enterprise_user_response (GtkWidget *dialog,
static void
delete_user (GtkButton *button, CcUserPanel *self)
{
- CcUserPanelPrivate *d = self->priv;
ActUser *user;
GtkWidget *dialog;
- user = get_selected_user (d);
+ user = get_selected_user (self);
if (user == NULL) {
return;
}
else if (act_user_get_uid (user) == getuid ()) {
- dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (d->main_box)),
+ dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (self->main_box)),
0,
GTK_MESSAGE_INFO,
GTK_BUTTONS_CLOSE,
@@ -615,7 +612,7 @@ delete_user (GtkButton *button, CcUserPanel *self)
G_CALLBACK (gtk_widget_destroy), NULL);
}
else if (act_user_is_logged_in_anywhere (user)) {
- dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (d->main_box)),
+ dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (self->main_box)),
0,
GTK_MESSAGE_INFO,
GTK_BUTTONS_CLOSE,
@@ -628,7 +625,7 @@ delete_user (GtkButton *button, CcUserPanel *self)
G_CALLBACK (gtk_widget_destroy), NULL);
}
else if (act_user_is_local_account (user)) {
- dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (d->main_box)),
+ dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (self->main_box)),
0,
GTK_MESSAGE_QUESTION,
GTK_BUTTONS_NONE,
@@ -647,10 +644,10 @@ delete_user (GtkButton *button, CcUserPanel *self)
gtk_window_set_icon_name (GTK_WINDOW (dialog), "system-users");
g_signal_connect (dialog, "response",
- G_CALLBACK (delete_user_response), d);
+ G_CALLBACK (delete_user_response), self);
}
else {
- dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (d->main_box)),
+ dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (self->main_box)),
0,
GTK_MESSAGE_QUESTION,
GTK_BUTTONS_NONE,
@@ -732,20 +729,20 @@ get_password_mode_text (ActUser *user)
static void
autologin_changed (GObject *object,
GParamSpec *pspec,
- CcUserPanelPrivate *d)
+ CcUserPanel *self)
{
gboolean active;
ActUser *user;
active = gtk_switch_get_active (GTK_SWITCH (object));
- user = get_selected_user (d);
+ user = get_selected_user (self);
if (active != act_user_get_automatic_login (user)) {
act_user_set_automatic_login (user, active);
if (act_user_get_automatic_login (user)) {
GSList *list;
GSList *l;
- list = act_user_manager_list_users (d->um);
+ list = act_user_manager_list_users (self->um);
for (l = list; l != NULL; l = l->next) {
ActUser *u = l->data;
if (act_user_get_uid (u) != act_user_get_uid (user)) {
@@ -805,7 +802,7 @@ get_autologin_possible (ActUser *user)
static void on_permission_changed (GPermission *permission, GParamSpec *pspec, gpointer data);
static void
-show_user (ActUser *user, CcUserPanelPrivate *d)
+show_user (ActUser *user, CcUserPanel *self)
{
GtkWidget *image;
GtkWidget *label;
@@ -814,39 +811,39 @@ show_user (ActUser *user, CcUserPanelPrivate *d)
gboolean show, enable;
ActUser *current;
- d->selected_user = user;
+ self->selected_user = user;
- image = get_widget (d, "user-icon-image");
+ image = get_widget (self, "user-icon-image");
um_user_image_set_user (UM_USER_IMAGE (image), user);
- image = get_widget (d, "user-icon-image2");
+ image = get_widget (self, "user-icon-image2");
um_user_image_set_user (UM_USER_IMAGE (image), user);
- um_photo_dialog_set_user (d->photo_dialog, user);
+ um_photo_dialog_set_user (self->photo_dialog, user);
- widget = get_widget (d, "full-name-entry");
+ widget = get_widget (self, "full-name-entry");
gtk_entry_set_text (GTK_ENTRY (widget), act_user_get_real_name (user));
gtk_widget_set_tooltip_text (widget, act_user_get_user_name (user));
- widget = get_widget (d, act_user_get_account_type (user) ? "account-type-admin" :
"account-type-standard");
+ widget = get_widget (self, act_user_get_account_type (user) ? "account-type-admin" :
"account-type-standard");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
/* Do not show the "Account Type" option when there's a single user account. */
- show = (d->other_accounts != 0);
- gtk_widget_set_visible (get_widget (d, "account-type-label"), show);
- gtk_widget_set_visible (get_widget (d, "account-type-box"), show);
+ show = (self->other_accounts != 0);
+ gtk_widget_set_visible (get_widget (self, "account-type-label"), show);
+ gtk_widget_set_visible (get_widget (self, "account-type-box"), show);
- widget = get_widget (d, "account-password-button-label");
+ widget = get_widget (self, "account-password-button-label");
gtk_label_set_label (GTK_LABEL (widget), get_password_mode_text (user));
enable = act_user_is_local_account (user);
gtk_widget_set_sensitive (widget, enable);
- widget = get_widget (d, "autologin-switch");
- g_signal_handlers_block_by_func (widget, autologin_changed, d);
+ widget = get_widget (self, "autologin-switch");
+ g_signal_handlers_block_by_func (widget, autologin_changed, self);
gtk_switch_set_active (GTK_SWITCH (widget), act_user_get_automatic_login (user));
- g_signal_handlers_unblock_by_func (widget, autologin_changed, d);
+ g_signal_handlers_unblock_by_func (widget, autologin_changed, self);
gtk_widget_set_sensitive (widget, get_autologin_possible (user));
- widget = get_widget (d, "account-language-button-label");
+ widget = get_widget (self, "account-language-button-label");
name = NULL;
lang = g_strdup (act_user_get_language (user));
@@ -866,35 +863,35 @@ show_user (ActUser *user, CcUserPanelPrivate *d)
g_free (name);
/* Fingerprint: show when self, local, enabled, and possible */
- widget = get_widget (d, "account-fingerprint-button");
- label = get_widget (d, "account-fingerprint-label");
+ widget = get_widget (self, "account-fingerprint-button");
+ label = get_widget (self, "account-fingerprint-label");
show = (act_user_get_uid (user) == getuid() &&
act_user_is_local_account (user) &&
- (d->login_screen_settings &&
- g_settings_get_boolean (d->login_screen_settings, "enable-fingerprint-authentication")) &&
+ (self->login_screen_settings &&
+ g_settings_get_boolean (self->login_screen_settings, "enable-fingerprint-authentication"))
&&
set_fingerprint_label (widget));
gtk_widget_set_visible (label, show);
gtk_widget_set_visible (widget, show);
/* Autologin: show when local account */
- widget = get_widget (d, "autologin-box");
- label = get_widget (d, "autologin-label");
+ widget = get_widget (self, "autologin-box");
+ label = get_widget (self, "autologin-label");
show = act_user_is_local_account (user);
gtk_widget_set_visible (widget, show);
gtk_widget_set_visible (label, show);
/* Language: do not show for current user */
- widget = get_widget (d, "account-language-button");
- label = get_widget (d, "language-label");
+ widget = get_widget (self, "account-language-button");
+ label = get_widget (self, "language-label");
show = act_user_get_uid (user) != getuid();
gtk_widget_set_visible (widget, show);
gtk_widget_set_visible (label, show);
/* Last login: show when administrator or current user */
- widget = get_widget (d, "last-login-button");
- label = get_widget (d, "last-login-button-label");
+ widget = get_widget (self, "last-login-button");
+ label = get_widget (self, "last-login-button-label");
- current = act_user_manager_get_user_by_id (d->um, getuid ());
+ current = act_user_manager_get_user_by_id (self->um, getuid ());
show = act_user_get_uid (user) == getuid () ||
act_user_get_account_type (current) == ACT_USER_ACCOUNT_TYPE_ADMINISTRATOR;
if (show) {
@@ -902,25 +899,25 @@ show_user (ActUser *user, CcUserPanelPrivate *d)
gtk_label_set_label (GTK_LABEL (label), text);
g_free (text);
}
- label = get_widget (d, "last-login-label");
+ label = get_widget (self, "last-login-label");
gtk_widget_set_visible (widget, show);
gtk_widget_set_visible (label, show);
enable = act_user_get_login_history (user) != NULL;
gtk_widget_set_sensitive (widget, enable);
- if (d->permission != NULL)
- on_permission_changed (d->permission, NULL, d);
+ if (self->permission != NULL)
+ on_permission_changed (self->permission, NULL, self);
}
static void
change_name_done (GtkWidget *entry,
- CcUserPanelPrivate *d)
+ CcUserPanel *self)
{
const gchar *text;
ActUser *user;
- user = get_selected_user (d);
+ user = get_selected_user (self);
text = gtk_entry_get_text (GTK_ENTRY (entry));
if (g_strcmp0 (text, act_user_get_real_name (user)) != 0 &&
@@ -932,20 +929,20 @@ change_name_done (GtkWidget *entry,
static void
change_name_focus_out (GtkWidget *entry,
GdkEvent *event,
- CcUserPanelPrivate *d)
+ CcUserPanel *self)
{
- change_name_done (entry, d);
+ change_name_done (entry, self);
}
static void
account_type_changed (GtkToggleButton *button,
- CcUserPanelPrivate *d)
+ CcUserPanel *self)
{
ActUser *user;
gint account_type;
gboolean self_selected;
- user = get_selected_user (d);
+ user = get_selected_user (self);
self_selected = act_user_get_uid (user) == geteuid ();
account_type = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)) ?
ACT_USER_ACCOUNT_TYPE_STANDARD : ACT_USER_ACCOUNT_TYPE_ADMINISTRATOR;
@@ -954,22 +951,22 @@ account_type_changed (GtkToggleButton *button,
act_user_set_account_type (user, account_type);
if (self_selected)
- show_restart_notification (d, NULL);
+ show_restart_notification (self, NULL);
}
}
static void
-dismiss_notification (CcUserPanelPrivate *d)
+dismiss_notification (CcUserPanel *self)
{
- gtk_revealer_set_reveal_child (GTK_REVEALER (d->notification), FALSE);
+ gtk_revealer_set_reveal_child (GTK_REVEALER (self->notification), FALSE);
}
static void
-restart_now (CcUserPanelPrivate *d)
+restart_now (CcUserPanel *self)
{
GDBusConnection *bus;
- gtk_revealer_set_reveal_child (GTK_REVEALER (d->notification), FALSE);
+ gtk_revealer_set_reveal_child (GTK_REVEALER (self->notification), FALSE);
bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
g_dbus_connection_call (bus,
@@ -984,7 +981,7 @@ restart_now (CcUserPanelPrivate *d)
}
static void
-show_restart_notification (CcUserPanelPrivate *d, const gchar *locale)
+show_restart_notification (CcUserPanel *self, const gchar *locale)
{
gchar *current_locale;
@@ -993,7 +990,7 @@ show_restart_notification (CcUserPanelPrivate *d, const gchar *locale)
setlocale (LC_MESSAGES, locale);
}
- gtk_revealer_set_reveal_child (GTK_REVEALER (d->notification), TRUE);
+ gtk_revealer_set_reveal_child (GTK_REVEALER (self->notification), TRUE);
if (locale) {
setlocale (LC_MESSAGES, current_locale);
@@ -1004,7 +1001,7 @@ show_restart_notification (CcUserPanelPrivate *d, const gchar *locale)
static void
language_response (GtkDialog *dialog,
gint response_id,
- CcUserPanelPrivate *d)
+ CcUserPanel *self)
{
GtkWidget *button;
ActUser *user;
@@ -1016,7 +1013,7 @@ language_response (GtkDialog *dialog,
return;
}
- user = get_selected_user (d);
+ user = get_selected_user (self);
account_language = act_user_get_language (user);
lang = cc_language_chooser_get_language (GTK_WIDGET (dialog));
@@ -1025,7 +1022,7 @@ language_response (GtkDialog *dialog,
act_user_set_language (user, lang);
}
- button = get_widget (d, "account-language-button-label");
+ button = get_widget (self, "account-language-button-label");
name = gnome_get_language_from_locale (lang, NULL);
gtk_label_set_label (GTK_LABEL (button), name);
g_free (name);
@@ -1036,81 +1033,81 @@ language_response (GtkDialog *dialog,
static void
change_language (GtkButton *button,
- CcUserPanelPrivate *d)
+ CcUserPanel *self)
{
const gchar *current_language;
ActUser *user;
- user = get_selected_user (d);
+ user = get_selected_user (self);
current_language = act_user_get_language (user);
- if (d->language_chooser) {
- cc_language_chooser_clear_filter (d->language_chooser);
- cc_language_chooser_set_language (d->language_chooser, NULL);
+ if (self->language_chooser) {
+ cc_language_chooser_clear_filter (self->language_chooser);
+ cc_language_chooser_set_language (self->language_chooser, NULL);
}
else {
- d->language_chooser = cc_language_chooser_new (gtk_widget_get_toplevel (d->main_box));
+ self->language_chooser = cc_language_chooser_new (gtk_widget_get_toplevel (self->main_box));
- g_signal_connect (d->language_chooser, "response",
- G_CALLBACK (language_response), d);
- g_signal_connect (d->language_chooser, "delete-event",
+ g_signal_connect (self->language_chooser, "response",
+ G_CALLBACK (language_response), self);
+ g_signal_connect (self->language_chooser, "delete-event",
G_CALLBACK (gtk_widget_hide_on_delete), NULL);
- gdk_window_set_cursor (gtk_widget_get_window (gtk_widget_get_toplevel (d->main_box)), NULL);
+ gdk_window_set_cursor (gtk_widget_get_window (gtk_widget_get_toplevel (self->main_box)),
NULL);
}
if (current_language && *current_language != '\0')
- cc_language_chooser_set_language (d->language_chooser, current_language);
- gtk_window_present (GTK_WINDOW (d->language_chooser));
+ cc_language_chooser_set_language (self->language_chooser, current_language);
+ gtk_window_present (GTK_WINDOW (self->language_chooser));
}
static void
-change_password (GtkButton *button, CcUserPanelPrivate *d)
+change_password (GtkButton *button, CcUserPanel *self)
{
ActUser *user;
- user = get_selected_user (d);
+ user = get_selected_user (self);
- um_password_dialog_set_user (d->password_dialog, user);
- um_password_dialog_show (d->password_dialog,
- GTK_WINDOW (gtk_widget_get_toplevel (d->main_box)));
+ um_password_dialog_set_user (self->password_dialog, user);
+ um_password_dialog_show (self->password_dialog,
+ GTK_WINDOW (gtk_widget_get_toplevel (self->main_box)));
}
static void
-change_fingerprint (GtkButton *button, CcUserPanelPrivate *d)
+change_fingerprint (GtkButton *button, CcUserPanel *self)
{
GtkWidget *widget;
ActUser *user;
- user = get_selected_user (d);
+ user = get_selected_user (self);
g_assert (g_strcmp0 (g_get_user_name (), act_user_get_user_name (user)) == 0);
- widget = get_widget (d, "account-fingerprint-button");
- fingerprint_button_clicked (GTK_WINDOW (gtk_widget_get_toplevel (d->main_box)), widget, user);
+ widget = get_widget (self, "account-fingerprint-button");
+ fingerprint_button_clicked (GTK_WINDOW (gtk_widget_get_toplevel (self->main_box)), widget, user);
}
static void
-show_history (GtkButton *button, CcUserPanelPrivate *d)
+show_history (GtkButton *button, CcUserPanel *self)
{
ActUser *user;
- user = get_selected_user (d);
+ user = get_selected_user (self);
- um_history_dialog_set_user (d->history_dialog, user);
- um_history_dialog_show (d->history_dialog, GTK_WINDOW (gtk_widget_get_toplevel (d->main_box)));
+ um_history_dialog_set_user (self->history_dialog, user);
+ um_history_dialog_show (self->history_dialog, GTK_WINDOW (gtk_widget_get_toplevel (self->main_box)));
}
static void
users_loaded (ActUserManager *manager,
GParamSpec *pspec,
- CcUserPanelPrivate *d)
+ CcUserPanel *self)
{
ActUser *user;
GtkWidget *dialog;
- if (act_user_manager_no_service (d->um)) {
- dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (d->main_box)),
+ if (act_user_manager_no_service (self->um)) {
+ dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (self->main_box)),
GTK_DIALOG_MODAL,
GTK_MESSAGE_OTHER,
GTK_BUTTONS_CLOSE,
@@ -1122,19 +1119,19 @@ users_loaded (ActUserManager *manager,
dialog);
gtk_widget_show (dialog);
- gtk_widget_set_sensitive (d->main_box, FALSE);
+ gtk_widget_set_sensitive (self->main_box, FALSE);
}
- g_signal_connect (d->um, "user-changed", G_CALLBACK (user_changed), d);
- g_signal_connect (d->um, "user-is-logged-in-changed", G_CALLBACK (user_changed), d);
- g_signal_connect (d->um, "user-added", G_CALLBACK (user_added), d);
- g_signal_connect (d->um, "user-removed", G_CALLBACK (user_removed), d);
+ g_signal_connect (self->um, "user-changed", G_CALLBACK (user_changed), self);
+ g_signal_connect (self->um, "user-is-logged-in-changed", G_CALLBACK (user_changed), self);
+ g_signal_connect (self->um, "user-added", G_CALLBACK (user_added), self);
+ g_signal_connect (self->um, "user-removed", G_CALLBACK (user_removed), self);
- reload_users (d, NULL);
+ reload_users (self, NULL);
/* Show the current user firstly. */
- user = act_user_manager_get_user_by_id (d->um, getuid ());
- show_user (user, d);
+ user = act_user_manager_get_user_by_id (self->um, getuid ());
+ show_user (user, self);
}
static void
@@ -1173,23 +1170,23 @@ on_permission_changed (GPermission *permission,
GParamSpec *pspec,
gpointer data)
{
- CcUserPanelPrivate *d = data;
+ CcUserPanel *self = data;
gboolean is_authorized;
gboolean self_selected;
ActUser *user;
GtkWidget *widget;
- user = get_selected_user (d);
+ user = get_selected_user (self);
if (!user) {
return;
}
- is_authorized = g_permission_get_allowed (G_PERMISSION (d->permission));
+ is_authorized = g_permission_get_allowed (G_PERMISSION (self->permission));
self_selected = act_user_get_uid (user) == geteuid ();
- gtk_stack_set_visible_child_name (GTK_STACK (d->headerbar_buttons), is_authorized ? PAGE_ADDUSER :
PAGE_LOCK);
+ gtk_stack_set_visible_child_name (GTK_STACK (self->headerbar_buttons), is_authorized ? PAGE_ADDUSER
: PAGE_LOCK);
- widget = get_widget (d, "add-user-toolbutton");
+ widget = get_widget (self, "add-user-toolbutton");
gtk_widget_set_sensitive (widget, is_authorized);
if (is_authorized) {
setup_tooltip_with_embedded_icon (widget, _("Create a user account"), NULL, NULL);
@@ -1209,7 +1206,7 @@ on_permission_changed (GPermission *permission,
g_object_unref (icon);
}
- widget = get_widget (d, "remove-user-toolbutton");
+ widget = get_widget (self, "remove-user-toolbutton");
gtk_widget_set_sensitive (widget, is_authorized && !self_selected
&& !would_demote_only_admin (user));
if (is_authorized) {
@@ -1232,35 +1229,35 @@ on_permission_changed (GPermission *permission,
}
if (!act_user_is_local_account (user)) {
- gtk_widget_set_sensitive (get_widget (d, "account-type-box"), FALSE);
- remove_unlock_tooltip (get_widget (d, "account-type-box"));
- gtk_widget_set_sensitive (GTK_WIDGET (get_widget (d, "autologin-switch")), FALSE);
- remove_unlock_tooltip (get_widget (d, "autologin-switch"));
+ gtk_widget_set_sensitive (get_widget (self, "account-type-box"), FALSE);
+ remove_unlock_tooltip (get_widget (self, "account-type-box"));
+ gtk_widget_set_sensitive (GTK_WIDGET (get_widget (self, "autologin-switch")), FALSE);
+ remove_unlock_tooltip (get_widget (self, "autologin-switch"));
} else if (is_authorized && act_user_is_local_account (user)) {
if (would_demote_only_admin (user)) {
- gtk_widget_set_sensitive (get_widget (d, "account-type-box"), FALSE);
+ gtk_widget_set_sensitive (get_widget (self, "account-type-box"), FALSE);
} else {
- gtk_widget_set_sensitive (get_widget (d, "account-type-box"), TRUE);
+ gtk_widget_set_sensitive (get_widget (self, "account-type-box"), TRUE);
}
- remove_unlock_tooltip (get_widget (d, "account-type-box"));
+ remove_unlock_tooltip (get_widget (self, "account-type-box"));
- gtk_widget_set_sensitive (GTK_WIDGET (get_widget (d, "autologin-switch")),
get_autologin_possible (user));
- remove_unlock_tooltip (get_widget (d, "autologin-switch"));
+ gtk_widget_set_sensitive (GTK_WIDGET (get_widget (self, "autologin-switch")),
get_autologin_possible (user));
+ remove_unlock_tooltip (get_widget (self, "autologin-switch"));
}
else {
- gtk_widget_set_sensitive (get_widget (d, "account-type-box"), FALSE);
+ gtk_widget_set_sensitive (get_widget (self, "account-type-box"), FALSE);
if (would_demote_only_admin (user)) {
- remove_unlock_tooltip (get_widget (d, "account-type-box"));
+ remove_unlock_tooltip (get_widget (self, "account-type-box"));
} else {
- add_unlock_tooltip (get_widget (d, "account-type-box"));
+ add_unlock_tooltip (get_widget (self, "account-type-box"));
}
- gtk_widget_set_sensitive (GTK_WIDGET (get_widget (d, "autologin-switch")), FALSE);
- add_unlock_tooltip (get_widget (d, "autologin-switch"));
+ gtk_widget_set_sensitive (GTK_WIDGET (get_widget (self, "autologin-switch")), FALSE);
+ add_unlock_tooltip (get_widget (self, "autologin-switch"));
}
/* The full name entry: insensitive if remote or not authorized and not self */
- widget = get_widget (d, "full-name-entry");
+ widget = get_widget (self, "full-name-entry");
if (!act_user_is_local_account (user)) {
gtk_widget_set_sensitive (widget, FALSE);
remove_unlock_tooltip (widget);
@@ -1275,108 +1272,107 @@ on_permission_changed (GPermission *permission,
}
if (is_authorized || self_selected) {
- gtk_stack_set_visible_child (GTK_STACK (get_widget (d, "user-icon")),
- get_widget (d, "user-icon-button"));
+ gtk_stack_set_visible_child (GTK_STACK (get_widget (self, "user-icon")),
+ get_widget (self, "user-icon-button"));
- gtk_widget_set_sensitive (get_widget (d, "account-language-button"), TRUE);
- remove_unlock_tooltip (get_widget (d, "account-language-button"));
+ gtk_widget_set_sensitive (get_widget (self, "account-language-button"), TRUE);
+ remove_unlock_tooltip (get_widget (self, "account-language-button"));
- gtk_widget_set_sensitive (get_widget (d, "account-password-button"), TRUE);
- remove_unlock_tooltip (get_widget (d, "account-password-button"));
+ gtk_widget_set_sensitive (get_widget (self, "account-password-button"), TRUE);
+ remove_unlock_tooltip (get_widget (self, "account-password-button"));
- gtk_widget_set_sensitive (get_widget (d, "account-fingerprint-button"), TRUE);
- remove_unlock_tooltip (get_widget (d, "account-fingerprint-button"));
+ gtk_widget_set_sensitive (get_widget (self, "account-fingerprint-button"), TRUE);
+ remove_unlock_tooltip (get_widget (self, "account-fingerprint-button"));
- gtk_widget_set_sensitive (get_widget (d, "last-login-button"), TRUE);
- remove_unlock_tooltip (get_widget (d, "last-login-button"));
+ gtk_widget_set_sensitive (get_widget (self, "last-login-button"), TRUE);
+ remove_unlock_tooltip (get_widget (self, "last-login-button"));
}
else {
- gtk_stack_set_visible_child (GTK_STACK (get_widget (d, "user-icon")),
- get_widget (d, "user-icon-image"));
+ gtk_stack_set_visible_child (GTK_STACK (get_widget (self, "user-icon")),
+ get_widget (self, "user-icon-image"));
- gtk_widget_set_sensitive (get_widget (d, "account-language-button"), FALSE);
- add_unlock_tooltip (get_widget (d, "account-language-button"));
+ gtk_widget_set_sensitive (get_widget (self, "account-language-button"), FALSE);
+ add_unlock_tooltip (get_widget (self, "account-language-button"));
- gtk_widget_set_sensitive (get_widget (d, "account-password-button"), FALSE);
- add_unlock_tooltip (get_widget (d, "account-password-button"));
+ gtk_widget_set_sensitive (get_widget (self, "account-password-button"), FALSE);
+ add_unlock_tooltip (get_widget (self, "account-password-button"));
- gtk_widget_set_sensitive (get_widget (d, "account-fingerprint-button"), FALSE);
- add_unlock_tooltip (get_widget (d, "account-fingerprint-button"));
+ gtk_widget_set_sensitive (get_widget (self, "account-fingerprint-button"), FALSE);
+ add_unlock_tooltip (get_widget (self, "account-fingerprint-button"));
- gtk_widget_set_sensitive (get_widget (d, "last-login-button"), FALSE);
- add_unlock_tooltip (get_widget (d, "last-login-button"));
+ gtk_widget_set_sensitive (get_widget (self, "last-login-button"), FALSE);
+ add_unlock_tooltip (get_widget (self, "last-login-button"));
}
- um_password_dialog_set_user (d->password_dialog, user);
+ um_password_dialog_set_user (self->password_dialog, user);
}
static void
setup_main_window (CcUserPanel *self)
{
- CcUserPanelPrivate *d = self->priv;
GtkWidget *button;
GIcon *icon;
GError *error = NULL;
gchar *names[3];
gboolean loaded;
- d->notification = get_widget (d, "notification");
+ self->notification = get_widget (self, "notification");
- button = get_widget (d, "restart-button");
- g_signal_connect_swapped (button, "clicked", G_CALLBACK (restart_now), d);
+ button = get_widget (self, "restart-button");
+ g_signal_connect_swapped (button, "clicked", G_CALLBACK (restart_now), self);
- button = get_widget (d, "dismiss-button");
- g_signal_connect_swapped (button, "clicked", G_CALLBACK (dismiss_notification), d);
+ button = get_widget (self, "dismiss-button");
+ g_signal_connect_swapped (button, "clicked", G_CALLBACK (dismiss_notification), self);
- d->other_accounts = 0;
+ self->other_accounts = 0;
- d->carousel = UM_CAROUSEL (get_widget (d, "carousel"));
- g_signal_connect (d->carousel, "item-activated", G_CALLBACK (set_selected_user), d);
+ self->carousel = UM_CAROUSEL (get_widget (self, "carousel"));
+ g_signal_connect (self->carousel, "item-activated", G_CALLBACK (set_selected_user), self);
- button = get_widget (d, "add-user-toolbutton");
- g_signal_connect (button, "clicked", G_CALLBACK (add_user), d);
+ button = get_widget (self, "add-user-toolbutton");
+ g_signal_connect (button, "clicked", G_CALLBACK (add_user), self);
- button = get_widget (d, "remove-user-toolbutton");
+ button = get_widget (self, "remove-user-toolbutton");
g_signal_connect (button, "clicked", G_CALLBACK (delete_user), self);
- button = get_widget (d, "user-icon-image");
+ button = get_widget (self, "user-icon-image");
add_unlock_tooltip (button);
- button = get_widget (d, "full-name-entry");
- g_signal_connect (button, "activate", G_CALLBACK (change_name_done), d);
- g_signal_connect (button, "focus-out-event", G_CALLBACK (change_name_focus_out), d);
+ button = get_widget (self, "full-name-entry");
+ g_signal_connect (button, "activate", G_CALLBACK (change_name_done), self);
+ g_signal_connect (button, "focus-out-event", G_CALLBACK (change_name_focus_out), self);
- button = get_widget (d, "account-type-standard");
- g_signal_connect (button, "toggled", G_CALLBACK (account_type_changed), d);
+ button = get_widget (self, "account-type-standard");
+ g_signal_connect (button, "toggled", G_CALLBACK (account_type_changed), self);
- button = get_widget (d, "account-password-button");
- g_signal_connect (button, "clicked", G_CALLBACK (change_password), d);
+ button = get_widget (self, "account-password-button");
+ g_signal_connect (button, "clicked", G_CALLBACK (change_password), self);
- button = get_widget (d, "account-language-button");
- g_signal_connect (button, "clicked", G_CALLBACK (change_language), d);
+ button = get_widget (self, "account-language-button");
+ g_signal_connect (button, "clicked", G_CALLBACK (change_language), self);
- button = get_widget (d, "autologin-switch");
- g_signal_connect (button, "notify::active", G_CALLBACK (autologin_changed), d);
+ button = get_widget (self, "autologin-switch");
+ g_signal_connect (button, "notify::active", G_CALLBACK (autologin_changed), self);
- button = get_widget (d, "account-fingerprint-button");
+ button = get_widget (self, "account-fingerprint-button");
g_signal_connect (button, "clicked",
- G_CALLBACK (change_fingerprint), d);
+ G_CALLBACK (change_fingerprint), self);
- button = get_widget (d, "last-login-button");
+ button = get_widget (self, "last-login-button");
g_signal_connect (button, "clicked",
- G_CALLBACK (show_history), d);
+ G_CALLBACK (show_history), self);
- d->permission = (GPermission *)polkit_permission_new_sync (USER_ACCOUNTS_PERMISSION, NULL, NULL,
&error);
- if (d->permission != NULL) {
- g_signal_connect (d->permission, "notify",
- G_CALLBACK (on_permission_changed), d);
- on_permission_changed (d->permission, NULL, d);
+ self->permission = (GPermission *)polkit_permission_new_sync (USER_ACCOUNTS_PERMISSION, NULL, NULL,
&error);
+ if (self->permission != NULL) {
+ g_signal_connect (self->permission, "notify",
+ G_CALLBACK (on_permission_changed), self);
+ on_permission_changed (self->permission, NULL, self);
} else {
g_warning ("Cannot create '%s' permission: %s", USER_ACCOUNTS_PERMISSION, error->message);
g_error_free (error);
}
- button = get_widget (d, "add-user-toolbutton");
+ button = get_widget (self, "add-user-toolbutton");
names[0] = "changes-allow-symbolic";
names[1] = "changes-allow";
names[2] = NULL;
@@ -1385,18 +1381,18 @@ setup_main_window (CcUserPanel *self)
_("To create a user account,\nclick the * icon first"),
"*",
icon);
- button = get_widget (d, "remove-user-toolbutton");
+ button = get_widget (self, "remove-user-toolbutton");
setup_tooltip_with_embedded_icon (button,
_("To delete the selected user account,\nclick the * icon first"),
"*",
icon);
g_object_unref (icon);
- g_object_get (d->um, "is-loaded", &loaded, NULL);
+ g_object_get (self->um, "is-loaded", &loaded, NULL);
if (loaded)
- users_loaded (d->um, NULL, d);
+ users_loaded (self->um, NULL, self);
else
- g_signal_connect (d->um, "notify::is-loaded", G_CALLBACK (users_loaded), d);
+ g_signal_connect (self->um, "notify::is-loaded", G_CALLBACK (users_loaded), self);
}
static GSettings *
@@ -1425,31 +1421,27 @@ settings_or_null (const gchar *schema)
static void
cc_user_panel_constructed (GObject *object)
{
- CcUserPanelPrivate *d;
CcUserPanel *self = UM_USER_PANEL (object);
GtkWidget *button;
CcShell *shell;
G_OBJECT_CLASS (cc_user_panel_parent_class)->constructed (object);
- d = self->priv;
shell = cc_panel_get_shell (CC_PANEL (self));
- cc_shell_embed_widget_in_header (shell, d->headerbar_buttons);
+ cc_shell_embed_widget_in_header (shell, self->headerbar_buttons);
- button = get_widget (d, "lock-button");
- gtk_lock_button_set_permission (GTK_LOCK_BUTTON (button), d->permission);
+ button = get_widget (self, "lock-button");
+ gtk_lock_button_set_permission (GTK_LOCK_BUTTON (button), self->permission);
}
static void
cc_user_panel_init (CcUserPanel *self)
{
- CcUserPanelPrivate *d;
GError *error;
volatile GType type G_GNUC_UNUSED;
GtkWidget *button;
GtkCssProvider *provider;
- d = self->priv = UM_USER_PANEL_PRIVATE (self);
g_resources_register (um_get_resource ());
/* register types that the builder might need */
@@ -1457,12 +1449,12 @@ cc_user_panel_init (CcUserPanel *self)
type = um_cell_renderer_user_image_get_type ();
type = um_carousel_get_type ();
- d->builder = gtk_builder_new ();
- d->um = act_user_manager_get_default ();
- d->cancellable = g_cancellable_new ();
+ self->builder = gtk_builder_new ();
+ self->um = act_user_manager_get_default ();
+ self->cancellable = g_cancellable_new ();
error = NULL;
- if (!gtk_builder_add_from_resource (d->builder,
+ if (!gtk_builder_add_from_resource (self->builder,
"/org/gnome/control-center/user-accounts/user-accounts-dialog.ui",
&error)) {
g_error ("%s", error->message);
@@ -1477,59 +1469,59 @@ cc_user_panel_init (CcUserPanel *self)
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
g_object_unref (provider);
- d->headerbar_buttons = get_widget (d, "headerbar-buttons");
- d->login_screen_settings = settings_or_null ("org.gnome.login-screen");
+ self->headerbar_buttons = get_widget (self, "headerbar-buttons");
+ self->login_screen_settings = settings_or_null ("org.gnome.login-screen");
- d->password_dialog = um_password_dialog_new ();
- button = get_widget (d, "user-icon-button");
- d->photo_dialog = um_photo_dialog_new (button);
- d->main_box = get_widget (d, "accounts-vbox");
- gtk_container_add (GTK_CONTAINER (self), get_widget (d, "overlay"));
- d->history_dialog = um_history_dialog_new ();
+ self->password_dialog = um_password_dialog_new ();
+ button = get_widget (self, "user-icon-button");
+ self->photo_dialog = um_photo_dialog_new (button);
+ self->main_box = get_widget (self, "accounts-vbox");
+ gtk_container_add (GTK_CONTAINER (self), get_widget (self, "overlay"));
+ self->history_dialog = um_history_dialog_new ();
setup_main_window (self);
}
static void
cc_user_panel_dispose (GObject *object)
{
- CcUserPanelPrivate *priv = UM_USER_PANEL (object)->priv;
+ CcUserPanel *self = UM_USER_PANEL (object);
- g_cancellable_cancel (priv->cancellable);
- g_clear_object (&priv->cancellable);
+ g_cancellable_cancel (self->cancellable);
+ g_clear_object (&self->cancellable);
- g_clear_object (&priv->login_screen_settings);
+ g_clear_object (&self->login_screen_settings);
- if (priv->um) {
- g_signal_handlers_disconnect_by_data (priv->um, priv);
- priv->um = NULL;
+ if (self->um) {
+ g_signal_handlers_disconnect_by_data (self->um, self);
+ self->um = NULL;
}
- if (priv->builder) {
- g_object_unref (priv->builder);
- priv->builder = NULL;
+ if (self->builder) {
+ g_object_unref (self->builder);
+ self->builder = NULL;
}
- if (priv->password_dialog) {
- um_password_dialog_free (priv->password_dialog);
- priv->password_dialog = NULL;
+ if (self->password_dialog) {
+ um_password_dialog_free (self->password_dialog);
+ self->password_dialog = NULL;
}
- if (priv->photo_dialog) {
- um_photo_dialog_free (priv->photo_dialog);
- priv->photo_dialog = NULL;
+ if (self->photo_dialog) {
+ um_photo_dialog_free (self->photo_dialog);
+ self->photo_dialog = NULL;
}
- if (priv->history_dialog) {
- um_history_dialog_free (priv->history_dialog);
- priv->history_dialog = NULL;
+ if (self->history_dialog) {
+ um_history_dialog_free (self->history_dialog);
+ self->history_dialog = NULL;
}
- if (priv->account_dialog) {
- gtk_dialog_response (GTK_DIALOG (priv->account_dialog), GTK_RESPONSE_DELETE_EVENT);
- priv->account_dialog = NULL;
+ if (self->account_dialog) {
+ gtk_dialog_response (GTK_DIALOG (self->account_dialog), GTK_RESPONSE_DELETE_EVENT);
+ self->account_dialog = NULL;
}
- if (priv->language_chooser) {
- gtk_widget_destroy (priv->language_chooser);
- priv->language_chooser = NULL;
+ if (self->language_chooser) {
+ gtk_widget_destroy (self->language_chooser);
+ self->language_chooser = NULL;
}
- if (priv->permission) {
- g_object_unref (priv->permission);
- priv->permission = NULL;
+ if (self->permission) {
+ g_object_unref (self->permission);
+ self->permission = NULL;
}
G_OBJECT_CLASS (cc_user_panel_parent_class)->dispose (object);
}
@@ -1550,6 +1542,4 @@ cc_user_panel_class_init (CcUserPanelClass *klass)
object_class->constructed = cc_user_panel_constructed;
panel_class->get_help_uri = cc_user_panel_get_help_uri;
-
- g_type_class_add_private (klass, sizeof (CcUserPanelPrivate));
}
diff --git a/panels/user-accounts/um-user-panel.h b/panels/user-accounts/um-user-panel.h
index 8e49650..459c6bf 100644
--- a/panels/user-accounts/um-user-panel.h
+++ b/panels/user-accounts/um-user-panel.h
@@ -27,29 +27,7 @@ G_BEGIN_DECLS
#define UM_TYPE_USER_PANEL cc_user_panel_get_type()
-#define UM_USER_PANEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UM_TYPE_USER_PANEL, CcUserPanel))
-#define UM_USER_PANEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UM_TYPE_USER_PANEL, CcUserPanelClass))
-#define UM_IS_USER_PANEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UM_TYPE_USER_PANEL))
-#define UM_IS_USER_PANEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UM_TYPE_USER_PANEL))
-#define UM_USER_PANEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UM_TYPE_USER_PANEL,
CcUserPanelClass))
-
-typedef struct _CcUserPanel CcUserPanel;
-typedef struct _CcUserPanelClass CcUserPanelClass;
-typedef struct _CcUserPanelPrivate CcUserPanelPrivate;
-
-struct _CcUserPanel
-{
- CcPanel parent;
-
- CcUserPanelPrivate *priv;
-};
-
-struct _CcUserPanelClass
-{
- CcPanelClass parent_class;
-};
-
-GType cc_user_panel_get_type (void) G_GNUC_CONST;
+G_DECLARE_FINAL_TYPE (CcUserPanel, cc_user_panel, UM, USER_PANEL, CcPanel)
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]