[gnome-initial-setup/gbsneto/accounts-crash-bug: 2/3] account: Modernize with G_DECLARE_FINAL_TYPE
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-initial-setup/gbsneto/accounts-crash-bug: 2/3] account: Modernize with G_DECLARE_FINAL_TYPE
- Date: Wed, 27 Jul 2022 18:06:07 +0000 (UTC)
commit 131b2f5a3c4eb6087a0c0f5e6aaa844ebe04d102
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Tue Jul 26 18:01:35 2022 -0300
account: Modernize with G_DECLARE_FINAL_TYPE
Allows removing quite a bunch of boilerplate code from the headers,
and generally looks cleaner.
.../pages/account/gis-account-page-enterprise.c | 260 ++++++++++-----------
.../pages/account/gis-account-page-enterprise.h | 23 +-
.../pages/account/gis-account-page-local.c | 213 ++++++++---------
.../pages/account/gis-account-page-local.h | 23 +-
.../pages/account/gis-account-page.c | 85 +++----
.../pages/account/gis-account-page.h | 23 +-
6 files changed, 262 insertions(+), 365 deletions(-)
---
diff --git a/gnome-initial-setup/pages/account/gis-account-page-enterprise.c
b/gnome-initial-setup/pages/account/gis-account-page-enterprise.c
index e21fd5d4..7b119950 100644
--- a/gnome-initial-setup/pages/account/gis-account-page-enterprise.c
+++ b/gnome-initial-setup/pages/account/gis-account-page-enterprise.c
@@ -45,8 +45,10 @@ static void on_realm_joined (GObject *source,
GAsyncResult *result,
gpointer user_data);
-struct _GisAccountPageEnterprisePrivate
+struct _GisAccountPageEnterprise
{
+ AdwBin parent;
+
GtkWidget *header;
GtkWidget *login;
GtkWidget *password;
@@ -75,9 +77,8 @@ struct _GisAccountPageEnterprisePrivate
GisPageApplyCallback apply_complete_callback;
gpointer apply_complete_data;
};
-typedef struct _GisAccountPageEnterprisePrivate GisAccountPageEnterprisePrivate;
-G_DEFINE_TYPE_WITH_PRIVATE (GisAccountPageEnterprise, gis_account_page_enterprise, ADW_TYPE_BIN);
+G_DEFINE_TYPE (GisAccountPageEnterprise, gis_account_page_enterprise, ADW_TYPE_BIN);
enum {
VALIDATION_CHANGED,
@@ -97,8 +98,7 @@ static void
apply_complete (GisAccountPageEnterprise *page,
gboolean valid)
{
- GisAccountPageEnterprisePrivate *priv = gis_account_page_enterprise_get_instance_private (page);
- priv->apply_complete_callback (NULL, valid, priv->apply_complete_data);
+ page->apply_complete_callback (NULL, valid, page->apply_complete_data);
}
static void
@@ -133,16 +133,15 @@ gis_account_page_enterprise_validate (GisAccountPageEnterprise *page)
gboolean valid_name;
gboolean valid_domain;
GtkTreeIter iter;
- GisAccountPageEnterprisePrivate *priv = gis_account_page_enterprise_get_instance_private (page);
- name = gtk_editable_get_text (GTK_EDITABLE (priv->login));
+ name = gtk_editable_get_text (GTK_EDITABLE (page->login));
valid_name = is_valid_name (name);
- if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (priv->domain), &iter)) {
- gtk_tree_model_get (gtk_combo_box_get_model (GTK_COMBO_BOX (priv->domain)),
+ if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (page->domain), &iter)) {
+ gtk_tree_model_get (gtk_combo_box_get_model (GTK_COMBO_BOX (page->domain)),
&iter, 0, &name, -1);
} else {
- name = gtk_editable_get_text (GTK_EDITABLE (priv->domain_entry));
+ name = gtk_editable_get_text (GTK_EDITABLE (page->domain_entry));
}
valid_domain = is_valid_name (name);
@@ -155,7 +154,6 @@ on_permit_user_login (GObject *source,
gpointer user_data)
{
GisAccountPageEnterprise *page = user_data;
- GisAccountPageEnterprisePrivate *priv = gis_account_page_enterprise_get_instance_private (page);
UmRealmCommon *common;
GError *error = NULL;
gchar *login;
@@ -169,14 +167,14 @@ on_permit_user_login (GObject *source,
* should also lookup information about this via the realm and make
* sure all that is functional.
*/
- login = um_realm_calculate_login (common, gtk_editable_get_text (GTK_EDITABLE (priv->login)));
+ login = um_realm_calculate_login (common, gtk_editable_get_text (GTK_EDITABLE (page->login)));
g_return_if_fail (login != NULL);
g_debug ("Caching remote user: %s", login);
- priv->act_user = act_user_manager_cache_user (priv->act_client, login, NULL);
- act_user_set_account_type (priv->act_user, ACT_USER_ACCOUNT_TYPE_ADMINISTRATOR);
- g_signal_emit (page, signals[USER_CACHED], 0, priv->act_user, gtk_editable_get_text (GTK_EDITABLE
(priv->password)));
+ page->act_user = act_user_manager_cache_user (page->act_client, login, NULL);
+ act_user_set_account_type (page->act_user, ACT_USER_ACCOUNT_TYPE_ADMINISTRATOR);
+ g_signal_emit (page, signals[USER_CACHED], 0, page->act_user, gtk_editable_get_text (GTK_EDITABLE
(page->password)));
apply_complete (page, TRUE);
g_free (login);
@@ -191,7 +189,6 @@ on_permit_user_login (GObject *source,
static void
enterprise_permit_user_login (GisAccountPageEnterprise *page, UmRealmObject *realm)
{
- GisAccountPageEnterprisePrivate *priv = gis_account_page_enterprise_get_instance_private (page);
UmRealmCommon *common;
gchar *login;
const gchar *add[2];
@@ -200,7 +197,7 @@ enterprise_permit_user_login (GisAccountPageEnterprise *page, UmRealmObject *rea
common = um_realm_object_get_common (realm);
- login = um_realm_calculate_login (common, gtk_editable_get_text (GTK_EDITABLE (priv->login)));
+ login = um_realm_calculate_login (common, gtk_editable_get_text (GTK_EDITABLE (page->login)));
g_return_if_fail (login != NULL);
add[0] = login;
@@ -212,7 +209,7 @@ enterprise_permit_user_login (GisAccountPageEnterprise *page, UmRealmObject *rea
um_realm_common_call_change_login_policy (common, "",
add, remove, options,
- priv->cancellable,
+ page->cancellable,
on_permit_user_login,
page);
@@ -226,7 +223,6 @@ on_set_static_hostname (GObject *source,
gpointer user_data)
{
GisAccountPageEnterprise *page = user_data;
- GisAccountPageEnterprisePrivate *priv = gis_account_page_enterprise_get_instance_private (page);
GError *error = NULL;
GVariant *retval;
@@ -240,10 +236,10 @@ on_set_static_hostname (GObject *source,
g_variant_unref (retval);
/* Prompted for some admin credentials, try to use them to log in */
- um_realm_login (priv->realm,
- gtk_editable_get_text (GTK_EDITABLE (priv->join_name)),
- gtk_editable_get_text (GTK_EDITABLE (priv->join_password)),
- priv->cancellable, on_join_login, page);
+ um_realm_login (page->realm,
+ gtk_editable_get_text (GTK_EDITABLE (page->join_name)),
+ gtk_editable_get_text (GTK_EDITABLE (page->join_password)),
+ page->cancellable, on_join_login, page);
}
static void
@@ -252,7 +248,6 @@ on_join_response (GtkDialog *dialog,
gpointer user_data)
{
GisAccountPageEnterprise *page = user_data;
- GisAccountPageEnterprisePrivate *priv = gis_account_page_enterprise_get_instance_private (page);
GDBusConnection *connection;
GError *error = NULL;
gchar hostname[128];
@@ -264,12 +259,12 @@ on_join_response (GtkDialog *dialog,
return;
}
- name = gtk_editable_get_text (GTK_EDITABLE (priv->join_computer));
+ name = gtk_editable_get_text (GTK_EDITABLE (page->join_computer));
if (gethostname (hostname, sizeof (hostname)) == 0 &&
!g_str_equal (name, hostname)) {
g_debug ("Setting StaticHostname to '%s'", name);
- connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, priv->cancellable, &error);
+ connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, page->cancellable, &error);
if (error != NULL) {
apply_complete (page, FALSE);
g_warning ("Could not get DBus connection: %s", error->message);
@@ -286,12 +281,12 @@ on_join_response (GtkDialog *dialog,
G_MAXINT, NULL, on_set_static_hostname, page);
} else {
- name = gtk_editable_get_text (GTK_EDITABLE (priv->join_name));
+ name = gtk_editable_get_text (GTK_EDITABLE (page->join_name));
g_debug ("Logging in as admin user: %s", name);
/* Prompted for some admin credentials, try to use them to log in */
- um_realm_login (priv->realm, name,
- gtk_editable_get_text (GTK_EDITABLE (priv->join_password)),
+ um_realm_login (page->realm, name,
+ gtk_editable_get_text (GTK_EDITABLE (page->join_password)),
NULL, on_join_login, page);
}
}
@@ -300,57 +295,56 @@ static void
join_show_prompt (GisAccountPageEnterprise *page,
GError *error)
{
- GisAccountPageEnterprisePrivate *priv = gis_account_page_enterprise_get_instance_private (page);
UmRealmKerberosMembership *membership;
UmRealmKerberos *kerberos;
gchar hostname[128];
const gchar *name;
- gtk_editable_set_text (GTK_EDITABLE (priv->join_password), "");
- gtk_widget_grab_focus (GTK_WIDGET (priv->join_password));
+ gtk_editable_set_text (GTK_EDITABLE (page->join_password), "");
+ gtk_widget_grab_focus (GTK_WIDGET (page->join_password));
- kerberos = um_realm_object_get_kerberos (priv->realm);
- membership = um_realm_object_get_kerberos_membership (priv->realm);
+ kerberos = um_realm_object_get_kerberos (page->realm);
+ membership = um_realm_object_get_kerberos_membership (page->realm);
- gtk_label_set_text (GTK_LABEL (priv->join_domain),
+ gtk_label_set_text (GTK_LABEL (page->join_domain),
um_realm_kerberos_get_domain_name (kerberos));
if (gethostname (hostname, sizeof (hostname)) == 0)
- gtk_editable_set_text (GTK_EDITABLE (priv->join_computer), hostname);
+ gtk_editable_set_text (GTK_EDITABLE (page->join_computer), hostname);
- clear_entry_validation_error (GTK_ENTRY (priv->join_name));
- clear_entry_validation_error (GTK_ENTRY (priv->join_password));
+ clear_entry_validation_error (GTK_ENTRY (page->join_name));
+ clear_entry_validation_error (GTK_ENTRY (page->join_password));
- if (!priv->join_prompted) {
+ if (!page->join_prompted) {
name = um_realm_kerberos_membership_get_suggested_administrator (membership);
if (name && !g_str_equal (name, "")) {
g_debug ("Suggesting admin user: %s", name);
- gtk_editable_set_text (GTK_EDITABLE (priv->join_name), name);
+ gtk_editable_set_text (GTK_EDITABLE (page->join_name), name);
} else {
- gtk_widget_grab_focus (GTK_WIDGET (priv->join_name));
+ gtk_widget_grab_focus (GTK_WIDGET (page->join_name));
}
} else if (g_error_matches (error, UM_REALM_ERROR, UM_REALM_ERROR_BAD_HOSTNAME)) {
g_debug ("Bad host name: %s", error->message);
- set_entry_validation_error (GTK_ENTRY (priv->join_computer), error->message);
+ set_entry_validation_error (GTK_ENTRY (page->join_computer), error->message);
} else if (g_error_matches (error, UM_REALM_ERROR, UM_REALM_ERROR_BAD_PASSWORD)) {
g_debug ("Bad admin password: %s", error->message);
- set_entry_validation_error (GTK_ENTRY (priv->join_password), error->message);
+ set_entry_validation_error (GTK_ENTRY (page->join_password), error->message);
} else {
g_debug ("Admin login failure: %s", error->message);
g_dbus_error_strip_remote_error (error);
- set_entry_validation_error (GTK_ENTRY (priv->join_name), error->message);
+ set_entry_validation_error (GTK_ENTRY (page->join_name), error->message);
}
g_debug ("Showing admin password dialog");
- gtk_window_set_transient_for (GTK_WINDOW (priv->join_dialog),
+ gtk_window_set_transient_for (GTK_WINDOW (page->join_dialog),
GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (page))));
- gtk_window_set_modal (GTK_WINDOW (priv->join_dialog), TRUE);
- gtk_window_present (GTK_WINDOW (priv->join_dialog));
+ gtk_window_set_modal (GTK_WINDOW (page->join_dialog), TRUE);
+ gtk_window_present (GTK_WINDOW (page->join_dialog));
- priv->join_prompted = TRUE;
+ page->join_prompted = TRUE;
g_object_unref (kerberos);
g_object_unref (membership);
@@ -363,17 +357,16 @@ on_join_login (GObject *source,
gpointer user_data)
{
GisAccountPageEnterprise *page = user_data;
- GisAccountPageEnterprisePrivate *priv = gis_account_page_enterprise_get_instance_private (page);
GError *error = NULL;
GBytes *creds;
- um_realm_login_finish (priv->realm, result, &creds, &error);
+ um_realm_login_finish (page->realm, result, &creds, &error);
/* Logged in as admin successfully, use creds to join domain */
if (error == NULL) {
- if (!um_realm_join_as_admin (priv->realm,
- gtk_editable_get_text (GTK_EDITABLE (priv->join_name)),
- gtk_editable_get_text (GTK_EDITABLE (priv->join_password)),
+ if (!um_realm_join_as_admin (page->realm,
+ gtk_editable_get_text (GTK_EDITABLE (page->join_name)),
+ gtk_editable_get_text (GTK_EDITABLE (page->join_password)),
creds, NULL, on_realm_joined, page)) {
show_error_dialog (page, _("No supported way to authenticate with this domain"), NULL);
g_message ("Authenticating as admin is not supported by the realm");
@@ -395,15 +388,14 @@ on_realm_joined (GObject *source,
gpointer user_data)
{
GisAccountPageEnterprise *page = user_data;
- GisAccountPageEnterprisePrivate *priv = gis_account_page_enterprise_get_instance_private (page);
GError *error = NULL;
- um_realm_join_finish (priv->realm, result, &error);
+ um_realm_join_finish (page->realm, result, &error);
/* Yay, joined the domain, register the user locally */
if (error == NULL) {
g_debug ("Joining realm completed successfully");
- enterprise_permit_user_login (page, priv->realm);
+ enterprise_permit_user_login (page, page->realm);
/* Credential failure while joining domain, prompt for admin creds */
} else if (g_error_matches (error, UM_REALM_ERROR, UM_REALM_ERROR_BAD_LOGIN) ||
@@ -429,11 +421,10 @@ on_realm_login (GObject *source,
gpointer user_data)
{
GisAccountPageEnterprise *page = user_data;
- GisAccountPageEnterprisePrivate *priv = gis_account_page_enterprise_get_instance_private (page);
GError *error = NULL;
GBytes *creds = NULL;
- um_realm_login_finish (priv->realm, result, &creds, &error);
+ um_realm_login_finish (page->realm, result, &creds, &error);
/*
* User login is valid, but cannot authenticate right now (eg: user needs
@@ -447,16 +438,16 @@ on_realm_login (GObject *source,
if (error == NULL) {
/* Already joined to the domain, just register this user */
- if (um_realm_is_configured (priv->realm)) {
+ if (um_realm_is_configured (page->realm)) {
g_debug ("Already joined to this realm");
- enterprise_permit_user_login (page, priv->realm);
+ enterprise_permit_user_login (page, page->realm);
/* Join the domain, try using the user's creds */
} else if (creds == NULL ||
- !um_realm_join_as_user (priv->realm,
- gtk_editable_get_text (GTK_EDITABLE (priv->login)),
- gtk_editable_get_text (GTK_EDITABLE (priv->password)),
- creds, priv->cancellable,
+ !um_realm_join_as_user (page->realm,
+ gtk_editable_get_text (GTK_EDITABLE (page->login)),
+ gtk_editable_get_text (GTK_EDITABLE (page->password)),
+ creds, page->cancellable,
on_realm_joined,
page)) {
@@ -471,14 +462,14 @@ on_realm_login (GObject *source,
/* A problem with the user's login name or password */
} else if (g_error_matches (error, UM_REALM_ERROR, UM_REALM_ERROR_BAD_LOGIN)) {
g_debug ("Problem with the user's login: %s", error->message);
- set_entry_validation_error (GTK_ENTRY (priv->login), error->message);
- gtk_widget_grab_focus (priv->login);
+ set_entry_validation_error (GTK_ENTRY (page->login), error->message);
+ gtk_widget_grab_focus (page->login);
apply_complete (page, FALSE);
} else if (g_error_matches (error, UM_REALM_ERROR, UM_REALM_ERROR_BAD_PASSWORD)) {
g_debug ("Problem with the user's password: %s", error->message);
- set_entry_validation_error (GTK_ENTRY (priv->password), error->message);
- gtk_widget_grab_focus (priv->password);
+ set_entry_validation_error (GTK_ENTRY (page->password), error->message);
+ gtk_widget_grab_focus (page->password);
apply_complete (page, FALSE);
/* Other login failure */
@@ -494,14 +485,13 @@ on_realm_login (GObject *source,
static void
enterprise_check_login (GisAccountPageEnterprise *page)
{
- GisAccountPageEnterprisePrivate *priv = gis_account_page_enterprise_get_instance_private (page);
- g_assert (priv->realm);
+ g_assert (page->realm);
- um_realm_login (priv->realm,
- gtk_editable_get_text (GTK_EDITABLE (priv->login)),
- gtk_editable_get_text (GTK_EDITABLE (priv->password)),
- priv->cancellable,
+ um_realm_login (page->realm,
+ gtk_editable_get_text (GTK_EDITABLE (page->login)),
+ gtk_editable_get_text (GTK_EDITABLE (page->password)),
+ page->cancellable,
on_realm_login,
page);
}
@@ -512,17 +502,16 @@ on_realm_discover_input (GObject *source,
gpointer user_data)
{
GisAccountPageEnterprise *page = user_data;
- GisAccountPageEnterprisePrivate *priv = gis_account_page_enterprise_get_instance_private (page);
GError *error = NULL;
GList *realms;
- realms = um_realm_manager_discover_finish (priv->realm_manager,
+ realms = um_realm_manager_discover_finish (page->realm_manager,
result, &error);
/* Found a realm, log user into domain */
if (error == NULL) {
g_assert (realms != NULL);
- priv->realm = g_object_ref (realms->data);
+ page->realm = g_object_ref (realms->data);
enterprise_check_login (page);
g_list_free_full (realms, g_object_unref);
@@ -530,8 +519,8 @@ on_realm_discover_input (GObject *source,
/* The domain is likely invalid */
g_dbus_error_strip_remote_error (error);
g_message ("Couldn't discover domain: %s", error->message);
- gtk_widget_grab_focus (priv->domain_entry);
- set_entry_validation_error (GTK_ENTRY (priv->domain_entry), error->message);
+ gtk_widget_grab_focus (page->domain_entry);
+ set_entry_validation_error (GTK_ENTRY (page->domain_entry), error->message);
apply_complete (page, FALSE);
g_error_free (error);
}
@@ -540,23 +529,22 @@ on_realm_discover_input (GObject *source,
static void
enterprise_add_user (GisAccountPageEnterprise *page)
{
- GisAccountPageEnterprisePrivate *priv = gis_account_page_enterprise_get_instance_private (page);
GtkTreeIter iter;
- priv->join_prompted = FALSE;
- g_clear_object (&priv->realm);
+ page->join_prompted = FALSE;
+ g_clear_object (&page->realm);
/* Already know about this realm, try to login as user */
- if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (priv->domain), &iter)) {
- gtk_tree_model_get (gtk_combo_box_get_model (GTK_COMBO_BOX (priv->domain)),
- &iter, 1, &priv->realm, -1);
+ if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (page->domain), &iter)) {
+ gtk_tree_model_get (gtk_combo_box_get_model (GTK_COMBO_BOX (page->domain)),
+ &iter, 1, &page->realm, -1);
enterprise_check_login (page);
/* Something the user typed, we need to discover realm */
} else {
- um_realm_manager_discover (priv->realm_manager,
- gtk_editable_get_text (GTK_EDITABLE (priv->domain_entry)),
- priv->cancellable,
+ um_realm_manager_discover (page->realm_manager,
+ gtk_editable_get_text (GTK_EDITABLE (page->domain_entry)),
+ page->cancellable,
on_realm_discover_input,
page);
}
@@ -569,16 +557,15 @@ gis_account_page_enterprise_apply (GisAccountPageEnterprise *page,
gpointer data)
{
GisPage *account_page = GIS_PAGE (data);
- GisAccountPageEnterprisePrivate *priv = gis_account_page_enterprise_get_instance_private (page);
/* Parental controls are not enterprise ready. It’s possible for them to have
* been enabled if the user enabled them, applied the account-local page, and
* then went back and decided to go all enterprise instead. */
gis_driver_set_parental_controls_enabled (account_page->driver, FALSE);
- priv->apply_complete_callback = callback;
- priv->apply_complete_data = data;
- priv->cancellable = g_object_ref (cancellable);
+ page->apply_complete_callback = callback;
+ page->apply_complete_data = data;
+ page->cancellable = g_object_ref (cancellable);
enterprise_add_user (page);
return TRUE;
}
@@ -626,7 +613,6 @@ static void
enterprise_add_realm (GisAccountPageEnterprise *page,
UmRealmObject *realm)
{
- GisAccountPageEnterprisePrivate *priv = gis_account_page_enterprise_get_instance_private (page);
GtkTreeIter iter;
gchar *name;
@@ -639,15 +625,15 @@ enterprise_add_realm (GisAccountPageEnterprise *page,
* returns is the one it prefers.
*/
- if (!model_contains_realm (GTK_TREE_MODEL (priv->realms_model), name)) {
- gtk_list_store_append (GTK_LIST_STORE (priv->realms_model), &iter);
- gtk_list_store_set (GTK_LIST_STORE (priv->realms_model), &iter,
+ if (!model_contains_realm (GTK_TREE_MODEL (page->realms_model), name)) {
+ gtk_list_store_append (GTK_LIST_STORE (page->realms_model), &iter);
+ gtk_list_store_set (GTK_LIST_STORE (page->realms_model), &iter,
0, name,
1, realm,
-1);
- if (!priv->domain_chosen && um_realm_is_configured (realm))
- gtk_combo_box_set_active_iter (GTK_COMBO_BOX (priv->domain), &iter);
+ if (!page->domain_chosen && um_realm_is_configured (realm))
+ gtk_combo_box_set_active_iter (GTK_COMBO_BOX (page->domain), &iter);
g_debug ("added realm to drop down: %s %s", name,
g_dbus_object_get_object_path (G_DBUS_OBJECT (realm)));
@@ -671,12 +657,11 @@ on_realm_manager_created (GObject *source,
gpointer user_data)
{
GisAccountPageEnterprise *page = user_data;
- GisAccountPageEnterprisePrivate *priv = gis_account_page_enterprise_get_instance_private (page);
GError *error = NULL;
GList *realms, *l;
- g_clear_object (&priv->realm_manager);
- priv->realm_manager = um_realm_manager_new_finish (result, &error);
+ g_clear_object (&page->realm_manager);
+ page->realm_manager = um_realm_manager_new_finish (result, &error);
if (error != NULL) {
g_warning ("Couldn't contact realmd service: %s", error->message);
@@ -685,16 +670,16 @@ on_realm_manager_created (GObject *source,
}
/* Lookup all the realm objects */
- realms = um_realm_manager_get_realms (priv->realm_manager);
+ realms = um_realm_manager_get_realms (page->realm_manager);
for (l = realms; l != NULL; l = g_list_next (l))
enterprise_add_realm (page, l->data);
g_list_free (realms);
- g_signal_connect (priv->realm_manager, "realm-added",
+ g_signal_connect (page->realm_manager, "realm-added",
G_CALLBACK (on_manager_realm_added), page);
/* When no realms try to discover a sensible default, triggers realm-added signal */
- um_realm_manager_discover (priv->realm_manager, "", NULL, NULL, NULL);
+ um_realm_manager_discover (page->realm_manager, "", NULL, NULL, NULL);
gtk_widget_set_visible (GTK_WIDGET (page), TRUE);
}
@@ -714,13 +699,12 @@ on_realmd_disappeared (GDBusConnection *unused1,
gpointer user_data)
{
GisAccountPageEnterprise *page = user_data;
- GisAccountPageEnterprisePrivate *priv = gis_account_page_enterprise_get_instance_private (page);
- if (priv->realm_manager != NULL) {
- g_signal_handlers_disconnect_by_func (priv->realm_manager,
+ if (page->realm_manager != NULL) {
+ g_signal_handlers_disconnect_by_func (page->realm_manager,
on_manager_realm_added,
page);
- g_clear_object (&priv->realm_manager);
+ g_clear_object (&page->realm_manager);
}
gtk_widget_set_visible (GTK_WIDGET (page), FALSE);
@@ -731,9 +715,8 @@ on_domain_changed (GtkComboBox *widget,
gpointer user_data)
{
GisAccountPageEnterprise *page = user_data;
- GisAccountPageEnterprisePrivate *priv = gis_account_page_enterprise_get_instance_private (page);
- priv->domain_chosen = TRUE;
+ page->domain_chosen = TRUE;
validation_changed (page);
clear_entry_validation_error (GTK_ENTRY (adw_bin_get_child (ADW_BIN (widget))));
}
@@ -751,12 +734,11 @@ static void
gis_account_page_enterprise_realize (GtkWidget *widget)
{
GisAccountPageEnterprise *page = GIS_ACCOUNT_PAGE_ENTERPRISE (widget);
- GisAccountPageEnterprisePrivate *priv = gis_account_page_enterprise_get_instance_private (page);
GtkWidget *gis_page;
gis_page = gtk_widget_get_ancestor (widget, GIS_TYPE_PAGE);
g_object_bind_property (gis_page, "small-screen",
- priv->header, "show-icon",
+ page->header, "show-icon",
G_BINDING_SYNC_CREATE | G_BINDING_INVERT_BOOLEAN);
GTK_WIDGET_CLASS (gis_account_page_enterprise_parent_class)->realize (widget);
@@ -766,22 +748,21 @@ static void
gis_account_page_enterprise_constructed (GObject *object)
{
GisAccountPageEnterprise *page = GIS_ACCOUNT_PAGE_ENTERPRISE (object);
- GisAccountPageEnterprisePrivate *priv = gis_account_page_enterprise_get_instance_private (page);
G_OBJECT_CLASS (gis_account_page_enterprise_parent_class)->constructed (object);
- priv->act_client = act_user_manager_get_default ();
+ page->act_client = act_user_manager_get_default ();
- priv->realmd_watch = g_bus_watch_name (G_BUS_TYPE_SYSTEM, "org.freedesktop.realmd",
+ page->realmd_watch = g_bus_watch_name (G_BUS_TYPE_SYSTEM, "org.freedesktop.realmd",
G_BUS_NAME_WATCHER_FLAGS_AUTO_START,
on_realmd_appeared, on_realmd_disappeared,
page, NULL);
- g_signal_connect (priv->join_dialog, "response",
+ g_signal_connect (page->join_dialog, "response",
G_CALLBACK (on_join_response), page);
- g_signal_connect (priv->domain, "changed",
+ g_signal_connect (page->domain, "changed",
G_CALLBACK (on_domain_changed), page);
- g_signal_connect (priv->login, "changed",
+ g_signal_connect (page->login, "changed",
G_CALLBACK (on_entry_changed), page);
}
@@ -789,18 +770,17 @@ static void
gis_account_page_enterprise_dispose (GObject *object)
{
GisAccountPageEnterprise *page = GIS_ACCOUNT_PAGE_ENTERPRISE (object);
- GisAccountPageEnterprisePrivate *priv = gis_account_page_enterprise_get_instance_private (page);
- if (priv->realmd_watch)
- g_bus_unwatch_name (priv->realmd_watch);
+ if (page->realmd_watch)
+ g_bus_unwatch_name (page->realmd_watch);
- priv->realmd_watch = 0;
+ page->realmd_watch = 0;
- g_cancellable_cancel (priv->cancellable);
+ g_cancellable_cancel (page->cancellable);
- g_clear_object (&priv->realm_manager);
- g_clear_object (&priv->realm);
- g_clear_object (&priv->cancellable);
+ g_clear_object (&page->realm_manager);
+ g_clear_object (&page->realm);
+ g_clear_object (&page->cancellable);
G_OBJECT_CLASS (gis_account_page_enterprise_parent_class)->dispose (object);
}
@@ -818,17 +798,17 @@ gis_account_page_enterprise_class_init (GisAccountPageEnterpriseClass *klass)
gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass),
"/org/gnome/initial-setup/gis-account-page-enterprise.ui");
- gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GisAccountPageEnterprise, login);
- gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GisAccountPageEnterprise,
password);
- gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GisAccountPageEnterprise, domain);
- gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GisAccountPageEnterprise,
realms_model);
- gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GisAccountPageEnterprise, header);
+ gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (klass), GisAccountPageEnterprise, login);
+ gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (klass), GisAccountPageEnterprise, password);
+ gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (klass), GisAccountPageEnterprise, domain);
+ gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (klass), GisAccountPageEnterprise, realms_model);
+ gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (klass), GisAccountPageEnterprise, header);
- gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GisAccountPageEnterprise,
join_dialog);
- gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GisAccountPageEnterprise,
join_name);
- gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GisAccountPageEnterprise,
join_password);
- gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GisAccountPageEnterprise,
join_domain);
- gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GisAccountPageEnterprise,
join_computer);
+ gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (klass), GisAccountPageEnterprise, join_dialog);
+ gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (klass), GisAccountPageEnterprise, join_name);
+ gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (klass), GisAccountPageEnterprise, join_password);
+ gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (klass), GisAccountPageEnterprise, join_domain);
+ gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (klass), GisAccountPageEnterprise, join_computer);
signals[VALIDATION_CHANGED] = g_signal_new ("validation-changed", GIS_TYPE_ACCOUNT_PAGE_ENTERPRISE,
G_SIGNAL_RUN_LAST, 0, NULL, NULL, NULL,
@@ -841,18 +821,14 @@ gis_account_page_enterprise_class_init (GisAccountPageEnterpriseClass *klass)
static void
gis_account_page_enterprise_init (GisAccountPageEnterprise *page)
{
- GisAccountPageEnterprisePrivate *priv = gis_account_page_enterprise_get_instance_private (page);
-
g_type_ensure (GIS_TYPE_PAGE_HEADER);
gtk_widget_init_template (GTK_WIDGET (page));
- priv->domain_entry = gtk_combo_box_get_child (GTK_COMBO_BOX (priv->domain));
+ page->domain_entry = gtk_combo_box_get_child (GTK_COMBO_BOX (page->domain));
}
void
gis_account_page_enterprise_shown (GisAccountPageEnterprise *page)
{
- GisAccountPageEnterprisePrivate *priv = gis_account_page_enterprise_get_instance_private (page);
-
- gtk_widget_grab_focus (priv->domain_entry);
+ gtk_widget_grab_focus (page->domain_entry);
}
diff --git a/gnome-initial-setup/pages/account/gis-account-page-enterprise.h
b/gnome-initial-setup/pages/account/gis-account-page-enterprise.h
index 01a6962f..c156f44c 100644
--- a/gnome-initial-setup/pages/account/gis-account-page-enterprise.h
+++ b/gnome-initial-setup/pages/account/gis-account-page-enterprise.h
@@ -28,27 +28,8 @@
G_BEGIN_DECLS
-#define GIS_TYPE_ACCOUNT_PAGE_ENTERPRISE (gis_account_page_enterprise_get_type ())
-#define GIS_ACCOUNT_PAGE_ENTERPRISE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj),
GIS_TYPE_ACCOUNT_PAGE_ENTERPRISE, GisAccountPageEnterprise))
-#define GIS_ACCOUNT_PAGE_ENTERPRISE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass),
GIS_TYPE_ACCOUNT_PAGE_ENTERPRISE, GisAccountPageEnterpriseClass))
-#define GIS_IS_ACCOUNT_PAGE_ENTERPRISE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj),
GIS_TYPE_ACCOUNT_PAGE_ENTERPRISE))
-#define GIS_IS_ACCOUNT_PAGE_ENTERPRISE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),
GIS_TYPE_ACCOUNT_PAGE_ENTERPRISE))
-#define GIS_ACCOUNT_PAGE_ENTERPRISE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),
GIS_TYPE_ACCOUNT_PAGE_ENTERPRISE, GisAccountPageEnterpriseClass))
-
-typedef struct _GisAccountPageEnterprise GisAccountPageEnterprise;
-typedef struct _GisAccountPageEnterpriseClass GisAccountPageEnterpriseClass;
-
-struct _GisAccountPageEnterprise
-{
- AdwBin parent;
-};
-
-struct _GisAccountPageEnterpriseClass
-{
- AdwBinClass parent_class;
-};
-
-GType gis_account_page_enterprise_get_type (void);
+#define GIS_TYPE_ACCOUNT_PAGE_ENTERPRISE (gis_account_page_enterprise_get_type ())
+G_DECLARE_FINAL_TYPE (GisAccountPageEnterprise, gis_account_page_enterprise, GIS, ACCOUNT_PAGE_ENTERPRISE,
AdwBin)
gboolean gis_account_page_enterprise_validate (GisAccountPageEnterprise *enterprise);
gboolean gis_account_page_enterprise_apply (GisAccountPageEnterprise *enterprise,
diff --git a/gnome-initial-setup/pages/account/gis-account-page-local.c
b/gnome-initial-setup/pages/account/gis-account-page-local.c
index 82d4bd1b..21bb597b 100644
--- a/gnome-initial-setup/pages/account/gis-account-page-local.c
+++ b/gnome-initial-setup/pages/account/gis-account-page-local.c
@@ -43,8 +43,10 @@
#define VALIDATION_TIMEOUT 600
-struct _GisAccountPageLocalPrivate
+struct _GisAccountPageLocal
{
+ AdwBin parent;
+
GtkWidget *avatar_button;
GtkWidget *avatar_image;
GtkWidget *header;
@@ -69,9 +71,8 @@ struct _GisAccountPageLocalPrivate
gboolean valid_username;
ActUserAccountType account_type;
};
-typedef struct _GisAccountPageLocalPrivate GisAccountPageLocalPrivate;
-G_DEFINE_TYPE_WITH_PRIVATE (GisAccountPageLocal, gis_account_page_local, ADW_TYPE_BIN);
+G_DEFINE_TYPE (GisAccountPageLocal, gis_account_page_local, ADW_TYPE_BIN);
enum {
VALIDATION_CHANGED,
@@ -170,14 +171,13 @@ get_profile_sync (const gchar *access_token,
static void
prepopulate_account_page (GisAccountPageLocal *page)
{
- GisAccountPageLocalPrivate *priv = gis_account_page_local_get_instance_private (page);
gchar *name = NULL;
gchar *picture = NULL;
GdkPixbuf *pixbuf = NULL;
- if (priv->goa_client) {
+ if (page->goa_client) {
GList *accounts, *l;
- accounts = goa_client_get_accounts (priv->goa_client);
+ accounts = goa_client_get_accounts (page->goa_client);
for (l = accounts; l != NULL; l = l->next) {
GoaOAuth2Based *oa2;
oa2 = goa_object_get_oauth2_based (GOA_OBJECT (l->data));
@@ -204,8 +204,8 @@ prepopulate_account_page (GisAccountPageLocal *page)
}
if (name) {
- g_object_set (priv->header, "subtitle", _("Please check the name and username. You can choose a picture
too."), NULL);
- gtk_editable_set_text (GTK_EDITABLE (priv->fullname_entry), name);
+ g_object_set (page->header, "subtitle", _("Please check the name and username. You can choose a picture
too."), NULL);
+ gtk_editable_set_text (GTK_EDITABLE (page->fullname_entry), name);
}
if (picture) {
@@ -230,9 +230,9 @@ prepopulate_account_page (GisAccountPageLocal *page)
if (pixbuf) {
GdkPixbuf *rounded = round_image (pixbuf);
- gtk_image_set_from_pixbuf (GTK_IMAGE (priv->avatar_image), rounded);
+ gtk_image_set_from_pixbuf (GTK_IMAGE (page->avatar_image), rounded);
g_object_unref (rounded);
- priv->avatar_pixbuf = pixbuf;
+ page->avatar_pixbuf = pixbuf;
}
g_free (name);
@@ -250,36 +250,35 @@ accounts_changed (GoaClient *client, GoaObject *object, gpointer data)
static gboolean
validate (GisAccountPageLocal *page)
{
- GisAccountPageLocalPrivate *priv = gis_account_page_local_get_instance_private (page);
GtkWidget *entry;
const gchar *name, *username;
gboolean parental_controls_enabled;
gchar *tip;
- g_clear_handle_id (&priv->timeout_id, g_source_remove);
+ g_clear_handle_id (&page->timeout_id, g_source_remove);
- entry = gtk_combo_box_get_child (GTK_COMBO_BOX (priv->username_combo));
+ entry = gtk_combo_box_get_child (GTK_COMBO_BOX (page->username_combo));
- name = gtk_editable_get_text (GTK_EDITABLE (priv->fullname_entry));
- username = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (priv->username_combo));
+ name = gtk_editable_get_text (GTK_EDITABLE (page->fullname_entry));
+ username = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (page->username_combo));
#ifdef HAVE_PARENTAL_CONTROLS
- parental_controls_enabled = gtk_check_button_get_active (GTK_CHECK_BUTTON
(priv->enable_parental_controls_check_button));
+ parental_controls_enabled = gtk_check_button_get_active (GTK_CHECK_BUTTON
(page->enable_parental_controls_check_button));
#else
parental_controls_enabled = FALSE;
#endif
- priv->valid_name = is_valid_name (name);
- if (priv->valid_name)
- set_entry_validation_checkmark (GTK_ENTRY (priv->fullname_entry));
+ page->valid_name = is_valid_name (name);
+ if (page->valid_name)
+ set_entry_validation_checkmark (GTK_ENTRY (page->fullname_entry));
- priv->valid_username = is_valid_username (username, parental_controls_enabled, &tip);
- if (priv->valid_username)
+ page->valid_username = is_valid_username (username, parental_controls_enabled, &tip);
+ if (page->valid_username)
set_entry_validation_checkmark (GTK_ENTRY (entry));
- gtk_label_set_text (GTK_LABEL (priv->username_explanation), tip);
+ gtk_label_set_text (GTK_LABEL (page->username_explanation), tip);
g_free (tip);
- um_photo_dialog_generate_avatar (priv->photo_dialog, name);
+ um_photo_dialog_generate_avatar (page->photo_dialog, name);
validation_changed (page);
@@ -299,30 +298,29 @@ fullname_changed (GtkWidget *w,
GParamSpec *pspec,
GisAccountPageLocal *page)
{
- GisAccountPageLocalPrivate *priv = gis_account_page_local_get_instance_private (page);
GtkWidget *entry;
GtkTreeModel *model;
const char *name;
name = gtk_editable_get_text (GTK_EDITABLE (w));
- entry = gtk_combo_box_get_child (GTK_COMBO_BOX (priv->username_combo));
- model = gtk_combo_box_get_model (GTK_COMBO_BOX (priv->username_combo));
+ entry = gtk_combo_box_get_child (GTK_COMBO_BOX (page->username_combo));
+ model = gtk_combo_box_get_model (GTK_COMBO_BOX (page->username_combo));
gtk_list_store_clear (GTK_LIST_STORE (model));
- if ((name == NULL || strlen (name) == 0) && !priv->has_custom_username) {
+ if ((name == NULL || strlen (name) == 0) && !page->has_custom_username) {
gtk_editable_set_text (GTK_EDITABLE (entry), "");
}
else if (name != NULL && strlen (name) != 0) {
generate_username_choices (name, GTK_LIST_STORE (model));
- if (!priv->has_custom_username)
- gtk_combo_box_set_active (GTK_COMBO_BOX (priv->username_combo), 0);
+ if (!page->has_custom_username)
+ gtk_combo_box_set_active (GTK_COMBO_BOX (page->username_combo), 0);
}
clear_entry_validation_error (GTK_ENTRY (w));
- priv->valid_name = FALSE;
+ page->valid_name = FALSE;
/* username_changed() is called consequently due to changes */
}
@@ -331,26 +329,25 @@ static void
username_changed (GtkComboBoxText *combo,
GisAccountPageLocal *page)
{
- GisAccountPageLocalPrivate *priv = gis_account_page_local_get_instance_private (page);
GtkWidget *entry;
const gchar *username;
entry = gtk_combo_box_get_child (GTK_COMBO_BOX (combo));
username = gtk_editable_get_text (GTK_EDITABLE (entry));
if (*username == '\0')
- priv->has_custom_username = FALSE;
+ page->has_custom_username = FALSE;
else if (gtk_widget_has_focus (entry) ||
- gtk_combo_box_get_active (GTK_COMBO_BOX (priv->username_combo)) > 0)
- priv->has_custom_username = TRUE;
+ gtk_combo_box_get_active (GTK_COMBO_BOX (page->username_combo)) > 0)
+ page->has_custom_username = TRUE;
clear_entry_validation_error (GTK_ENTRY (entry));
- priv->valid_username = FALSE;
+ page->valid_username = FALSE;
validation_changed (page);
- if (priv->timeout_id != 0)
- g_source_remove (priv->timeout_id);
- priv->timeout_id = g_timeout_add (VALIDATION_TIMEOUT, (GSourceFunc)validate, page);
+ if (page->timeout_id != 0)
+ g_source_remove (page->timeout_id);
+ page->timeout_id = g_timeout_add (VALIDATION_TIMEOUT, (GSourceFunc)validate, page);
}
static void
@@ -359,19 +356,18 @@ avatar_callback (GdkPixbuf *pixbuf,
gpointer user_data)
{
GisAccountPageLocal *page = user_data;
- GisAccountPageLocalPrivate *priv = gis_account_page_local_get_instance_private (page);
g_autoptr(GdkPixbuf) tmp = NULL;
g_autoptr(GdkPixbuf) rounded = NULL;
- g_clear_object (&priv->avatar_pixbuf);
- g_clear_pointer (&priv->avatar_filename, g_free);
+ g_clear_object (&page->avatar_pixbuf);
+ g_clear_pointer (&page->avatar_filename, g_free);
if (pixbuf) {
- priv->avatar_pixbuf = g_object_ref (pixbuf);
+ page->avatar_pixbuf = g_object_ref (pixbuf);
rounded = round_image (pixbuf);
}
else if (filename) {
- priv->avatar_filename = g_strdup (filename);
+ page->avatar_filename = g_strdup (filename);
tmp = gdk_pixbuf_new_from_file_at_size (filename, 96, 96, NULL);
if (tmp != NULL)
@@ -379,12 +375,12 @@ avatar_callback (GdkPixbuf *pixbuf,
}
if (rounded != NULL) {
- gtk_image_set_from_pixbuf (GTK_IMAGE (priv->avatar_image), rounded);
+ gtk_image_set_from_pixbuf (GTK_IMAGE (page->avatar_image), rounded);
}
else {
/* Fallback. */
- gtk_image_set_pixel_size (GTK_IMAGE (priv->avatar_image), 96);
- gtk_image_set_from_icon_name (GTK_IMAGE (priv->avatar_image), "avatar-default-symbolic");
+ gtk_image_set_pixel_size (GTK_IMAGE (page->avatar_image), 96);
+ gtk_image_set_from_icon_name (GTK_IMAGE (page->avatar_image), "avatar-default-symbolic");
}
}
@@ -400,13 +396,12 @@ enable_parental_controls_check_button_toggled_cb (GtkCheckButton *check_button,
gpointer user_data)
{
GisAccountPageLocal *page = GIS_ACCOUNT_PAGE_LOCAL (user_data);
- GisAccountPageLocalPrivate *priv = gis_account_page_local_get_instance_private (page);
- gboolean parental_controls_enabled = gtk_check_button_get_active (GTK_CHECK_BUTTON
(priv->enable_parental_controls_check_button));
+ gboolean parental_controls_enabled = gtk_check_button_get_active (GTK_CHECK_BUTTON
(page->enable_parental_controls_check_button));
/* This sets the account type of the main user. When we save_data(), we create
* two users if parental controls are enabled: the first user is always an
* admin, and the second user is the main user using this @account_type. */
- priv->account_type = parental_controls_enabled ? ACT_USER_ACCOUNT_TYPE_STANDARD :
ACT_USER_ACCOUNT_TYPE_ADMINISTRATOR;
+ page->account_type = parental_controls_enabled ? ACT_USER_ACCOUNT_TYPE_STANDARD :
ACT_USER_ACCOUNT_TYPE_ADMINISTRATOR;
validate (page);
}
@@ -428,61 +423,60 @@ static void
gis_account_page_local_constructed (GObject *object)
{
GisAccountPageLocal *page = GIS_ACCOUNT_PAGE_LOCAL (object);
- GisAccountPageLocalPrivate *priv = gis_account_page_local_get_instance_private (page);
G_OBJECT_CLASS (gis_account_page_local_parent_class)->constructed (object);
- priv->act_client = act_user_manager_get_default ();
+ page->act_client = act_user_manager_get_default ();
- g_signal_connect (priv->fullname_entry, "notify::text",
+ g_signal_connect (page->fullname_entry, "notify::text",
G_CALLBACK (fullname_changed), page);
- track_focus_out (page, priv->fullname_entry);
+ track_focus_out (page, page->fullname_entry);
- g_signal_connect_swapped (priv->fullname_entry, "activate",
+ g_signal_connect_swapped (page->fullname_entry, "activate",
G_CALLBACK (validate), page);
- g_signal_connect (priv->username_combo, "changed",
+ g_signal_connect (page->username_combo, "changed",
G_CALLBACK (username_changed), page);
- track_focus_out (page, priv->username_combo);
+ track_focus_out (page, page->username_combo);
- g_signal_connect_swapped (gtk_combo_box_get_child (GTK_COMBO_BOX (priv->username_combo)),
+ g_signal_connect_swapped (gtk_combo_box_get_child (GTK_COMBO_BOX (page->username_combo)),
"activate", G_CALLBACK (confirm), page);
- g_signal_connect_swapped (priv->fullname_entry, "activate",
+ g_signal_connect_swapped (page->fullname_entry, "activate",
G_CALLBACK (confirm), page);
- g_signal_connect (priv->enable_parental_controls_check_button, "toggled",
+ g_signal_connect (page->enable_parental_controls_check_button, "toggled",
G_CALLBACK (enable_parental_controls_check_button_toggled_cb), page);
/* Disable parental controls if support is not compiled in. */
#ifndef HAVE_PARENTAL_CONTROLS
- gtk_widget_hide (priv->enable_parental_controls_box);
+ gtk_widget_hide (page->enable_parental_controls_box);
#endif
- priv->valid_name = FALSE;
- priv->valid_username = FALSE;
+ page->valid_name = FALSE;
+ page->valid_username = FALSE;
/* FIXME: change this for a large deployment scenario; maybe through a GSetting? */
- priv->account_type = ACT_USER_ACCOUNT_TYPE_ADMINISTRATOR;
+ page->account_type = ACT_USER_ACCOUNT_TYPE_ADMINISTRATOR;
- g_object_set (priv->header, "subtitle", _("We need a few details to complete setup."), NULL);
- gtk_editable_set_text (GTK_EDITABLE (priv->fullname_entry), "");
- gtk_list_store_clear (GTK_LIST_STORE (gtk_combo_box_get_model (GTK_COMBO_BOX (priv->username_combo))));
- priv->has_custom_username = FALSE;
+ g_object_set (page->header, "subtitle", _("We need a few details to complete setup."), NULL);
+ gtk_editable_set_text (GTK_EDITABLE (page->fullname_entry), "");
+ gtk_list_store_clear (GTK_LIST_STORE (gtk_combo_box_get_model (GTK_COMBO_BOX (page->username_combo))));
+ page->has_custom_username = FALSE;
- gtk_image_set_pixel_size (GTK_IMAGE (priv->avatar_image), 96);
- gtk_image_set_from_icon_name (GTK_IMAGE (priv->avatar_image), "avatar-default-symbolic");
+ gtk_image_set_pixel_size (GTK_IMAGE (page->avatar_image), 96);
+ gtk_image_set_from_icon_name (GTK_IMAGE (page->avatar_image), "avatar-default-symbolic");
- priv->goa_client = goa_client_new_sync (NULL, NULL);
- if (priv->goa_client) {
- g_signal_connect (priv->goa_client, "account-added",
+ page->goa_client = goa_client_new_sync (NULL, NULL);
+ if (page->goa_client) {
+ g_signal_connect (page->goa_client, "account-added",
G_CALLBACK (accounts_changed), page);
- g_signal_connect (priv->goa_client, "account-removed",
+ g_signal_connect (page->goa_client, "account-removed",
G_CALLBACK (accounts_changed), page);
prepopulate_account_page (page);
}
- priv->photo_dialog = um_photo_dialog_new (avatar_callback, page);
- um_photo_dialog_generate_avatar (priv->photo_dialog, "");
- gtk_menu_button_set_popover (GTK_MENU_BUTTON (priv->avatar_button),
- GTK_WIDGET (priv->photo_dialog));
+ page->photo_dialog = um_photo_dialog_new (avatar_callback, page);
+ um_photo_dialog_generate_avatar (page->photo_dialog, "");
+ gtk_menu_button_set_popover (GTK_MENU_BUTTON (page->avatar_button),
+ GTK_WIDGET (page->photo_dialog));
validate (page);
}
@@ -491,12 +485,11 @@ static void
gis_account_page_local_dispose (GObject *object)
{
GisAccountPageLocal *page = GIS_ACCOUNT_PAGE_LOCAL (object);
- GisAccountPageLocalPrivate *priv = gis_account_page_local_get_instance_private (page);
- g_clear_object (&priv->goa_client);
- g_clear_object (&priv->avatar_pixbuf);
- g_clear_pointer (&priv->avatar_filename, g_free);
- g_clear_handle_id (&priv->timeout_id, g_source_remove);
+ g_clear_object (&page->goa_client);
+ g_clear_object (&page->avatar_pixbuf);
+ g_clear_pointer (&page->avatar_filename, g_free);
+ g_clear_handle_id (&page->timeout_id, g_source_remove);
G_OBJECT_CLASS (gis_account_page_local_parent_class)->dispose (object);
}
@@ -505,18 +498,17 @@ static void
set_user_avatar (GisAccountPageLocal *page,
ActUser *user)
{
- GisAccountPageLocalPrivate *priv = gis_account_page_local_get_instance_private (page);
GFile *file = NULL;
GFileIOStream *io_stream = NULL;
GOutputStream *stream = NULL;
GError *error = NULL;
- if (priv->avatar_filename != NULL) {
- act_user_set_icon_file (user, priv->avatar_filename);
+ if (page->avatar_filename != NULL) {
+ act_user_set_icon_file (user, page->avatar_filename);
return;
}
- if (priv->avatar_pixbuf == NULL) {
+ if (page->avatar_pixbuf == NULL) {
return;
}
@@ -525,7 +517,7 @@ set_user_avatar (GisAccountPageLocal *page,
goto out;
stream = g_io_stream_get_output_stream (G_IO_STREAM (io_stream));
- if (!gdk_pixbuf_save_to_stream (priv->avatar_pixbuf, stream, "png", NULL, &error, NULL))
+ if (!gdk_pixbuf_save_to_stream (page->avatar_pixbuf, stream, "png", NULL, &error, NULL))
goto out;
act_user_set_icon_file (user, g_file_get_path (file));
@@ -544,15 +536,14 @@ local_create_user (GisAccountPageLocal *local,
GisPage *page,
GError **error)
{
- GisAccountPageLocalPrivate *priv = gis_account_page_local_get_instance_private (local);
const gchar *username;
const gchar *fullname;
gboolean parental_controls_enabled;
g_autoptr(ActUser) main_user = NULL;
g_autoptr(ActUser) parent_user = NULL;
- username = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (priv->username_combo));
- fullname = gtk_editable_get_text (GTK_EDITABLE (priv->fullname_entry));
+ username = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (local->username_combo));
+ fullname = gtk_editable_get_text (GTK_EDITABLE (local->fullname_entry));
parental_controls_enabled = gis_driver_get_parental_controls_enabled (page->driver);
/* Always create the admin user first, in case of failure part-way through
@@ -563,7 +554,7 @@ local_create_user (GisAccountPageLocal *local,
const gchar *parent_username = "administrator";
const gchar *parent_fullname = _("Administrator");
- parent_user = act_user_manager_create_user (priv->act_client, parent_username, parent_fullname,
ACT_USER_ACCOUNT_TYPE_ADMINISTRATOR, error);
+ parent_user = act_user_manager_create_user (local->act_client, parent_username, parent_fullname,
ACT_USER_ACCOUNT_TYPE_ADMINISTRATOR, error);
if (parent_user == NULL)
{
g_prefix_error (error,
@@ -606,7 +597,7 @@ local_create_user (GisAccountPageLocal *local,
}
/* Now create the main user. */
- main_user = act_user_manager_create_user (priv->act_client, username, fullname, priv->account_type, error);
+ main_user = act_user_manager_create_user (local->act_client, username, fullname, local->account_type,
error);
if (main_user == NULL)
{
g_prefix_error (error,
@@ -631,14 +622,14 @@ gis_account_page_local_class_init (GisAccountPageLocalClass *klass)
gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass),
"/org/gnome/initial-setup/gis-account-page-local.ui");
- gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GisAccountPageLocal,
avatar_button);
- gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GisAccountPageLocal, avatar_image);
- gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GisAccountPageLocal, header);
- gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GisAccountPageLocal,
fullname_entry);
- gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GisAccountPageLocal,
username_combo);
- gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GisAccountPageLocal,
username_explanation);
- gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GisAccountPageLocal,
enable_parental_controls_box);
- gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GisAccountPageLocal,
enable_parental_controls_check_button);
+ gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (klass), GisAccountPageLocal, avatar_button);
+ gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (klass), GisAccountPageLocal, avatar_image);
+ gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (klass), GisAccountPageLocal, header);
+ gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (klass), GisAccountPageLocal, fullname_entry);
+ gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (klass), GisAccountPageLocal, username_combo);
+ gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (klass), GisAccountPageLocal, username_explanation);
+ gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (klass), GisAccountPageLocal,
enable_parental_controls_box);
+ gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (klass), GisAccountPageLocal,
enable_parental_controls_check_button);
object_class->constructed = gis_account_page_local_constructed;
object_class->dispose = gis_account_page_local_dispose;
@@ -670,9 +661,7 @@ gis_account_page_local_init (GisAccountPageLocal *page)
gboolean
gis_account_page_local_validate (GisAccountPageLocal *page)
{
- GisAccountPageLocalPrivate *priv = gis_account_page_local_get_instance_private (page);
-
- return priv->valid_name && priv->valid_username;
+ return page->valid_name && page->valid_username;
}
gboolean
@@ -686,29 +675,28 @@ gis_account_page_local_create_user (GisAccountPageLocal *local,
gboolean
gis_account_page_local_apply (GisAccountPageLocal *local, GisPage *page)
{
- GisAccountPageLocalPrivate *priv = gis_account_page_local_get_instance_private (local);
const gchar *username, *full_name;
gboolean parental_controls_enabled;
- username = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (priv->username_combo));
+ username = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (local->username_combo));
gis_driver_set_username (GIS_PAGE (page)->driver, username);
- full_name = gtk_editable_get_text (GTK_EDITABLE (priv->fullname_entry));
+ full_name = gtk_editable_get_text (GTK_EDITABLE (local->fullname_entry));
gis_driver_set_full_name (GIS_PAGE (page)->driver, full_name);
- if (priv->avatar_pixbuf != NULL)
+ if (local->avatar_pixbuf != NULL)
{
g_autoptr(GdkTexture) texture = NULL;
- texture = gdk_texture_new_for_pixbuf (priv->avatar_pixbuf);
+ texture = gdk_texture_new_for_pixbuf (local->avatar_pixbuf);
gis_driver_set_avatar (GIS_PAGE (page)->driver, GDK_PAINTABLE (texture));
}
- else if (priv->avatar_filename != NULL)
+ else if (local->avatar_filename != NULL)
{
g_autoptr(GdkTexture) texture = NULL;
g_autoptr(GError) error = NULL;
- texture = gdk_texture_new_from_filename (priv->avatar_filename, &error);
+ texture = gdk_texture_new_from_filename (local->avatar_filename, &error);
if (!error)
gis_driver_set_avatar (GIS_PAGE (page)->driver, GDK_PAINTABLE (texture));
@@ -717,7 +705,7 @@ gis_account_page_local_apply (GisAccountPageLocal *local, GisPage *page)
}
#ifdef HAVE_PARENTAL_CONTROLS
- parental_controls_enabled = gtk_check_button_get_active (GTK_CHECK_BUTTON
(priv->enable_parental_controls_check_button));
+ parental_controls_enabled = gtk_check_button_get_active (GTK_CHECK_BUTTON
(local->enable_parental_controls_check_button));
#else
parental_controls_enabled = FALSE;
#endif
@@ -729,6 +717,5 @@ gis_account_page_local_apply (GisAccountPageLocal *local, GisPage *page)
void
gis_account_page_local_shown (GisAccountPageLocal *local)
{
- GisAccountPageLocalPrivate *priv = gis_account_page_local_get_instance_private (local);
- gtk_widget_grab_focus (priv->fullname_entry);
+ gtk_widget_grab_focus (local->fullname_entry);
}
diff --git a/gnome-initial-setup/pages/account/gis-account-page-local.h
b/gnome-initial-setup/pages/account/gis-account-page-local.h
index bf670073..9d8dea04 100644
--- a/gnome-initial-setup/pages/account/gis-account-page-local.h
+++ b/gnome-initial-setup/pages/account/gis-account-page-local.h
@@ -25,27 +25,8 @@
G_BEGIN_DECLS
-#define GIS_TYPE_ACCOUNT_PAGE_LOCAL (gis_account_page_local_get_type ())
-#define GIS_ACCOUNT_PAGE_LOCAL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj),
GIS_TYPE_ACCOUNT_PAGE_LOCAL, GisAccountPageLocal))
-#define GIS_ACCOUNT_PAGE_LOCAL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass),
GIS_TYPE_ACCOUNT_PAGE_LOCAL, GisAccountPageLocalClass))
-#define GIS_IS_ACCOUNT_PAGE_LOCAL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj),
GIS_TYPE_ACCOUNT_PAGE_LOCAL))
-#define GIS_IS_ACCOUNT_PAGE_LOCAL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),
GIS_TYPE_ACCOUNT_PAGE_LOCAL))
-#define GIS_ACCOUNT_PAGE_LOCAL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),
GIS_TYPE_ACCOUNT_PAGE_LOCAL, GisAccountPageLocalClass))
-
-typedef struct _GisAccountPageLocal GisAccountPageLocal;
-typedef struct _GisAccountPageLocalClass GisAccountPageLocalClass;
-
-struct _GisAccountPageLocal
-{
- AdwBin parent;
-};
-
-struct _GisAccountPageLocalClass
-{
- AdwBinClass parent_class;
-};
-
-GType gis_account_page_local_get_type (void);
+#define GIS_TYPE_ACCOUNT_PAGE_LOCAL (gis_account_page_local_get_type ())
+G_DECLARE_FINAL_TYPE (GisAccountPageLocal, gis_account_page_local, GIS, ACCOUNT_PAGE_LOCAL, AdwBin)
gboolean gis_account_page_local_validate (GisAccountPageLocal *local);
gboolean gis_account_page_local_apply (GisAccountPageLocal *local, GisPage *page);
diff --git a/gnome-initial-setup/pages/account/gis-account-page.c
b/gnome-initial-setup/pages/account/gis-account-page.c
index f319a267..04a8e543 100644
--- a/gnome-initial-setup/pages/account/gis-account-page.c
+++ b/gnome-initial-setup/pages/account/gis-account-page.c
@@ -32,8 +32,10 @@
#include <glib/gi18n.h>
#include <gio/gio.h>
-struct _GisAccountPagePrivate
+struct _GisAccountPage
{
+ GisPage parent;
+
GtkWidget *page_local;
GtkWidget *page_enterprise;
GtkWidget *stack;
@@ -44,9 +46,8 @@ struct _GisAccountPagePrivate
UmAccountMode mode;
};
-typedef struct _GisAccountPagePrivate GisAccountPagePrivate;
-G_DEFINE_TYPE_WITH_PRIVATE (GisAccountPage, gis_account_page, GIS_TYPE_PAGE);
+G_DEFINE_TYPE (GisAccountPage, gis_account_page, GIS_TYPE_PAGE);
static void
enterprise_apply_complete (GisPage *dummy,
@@ -61,13 +62,11 @@ enterprise_apply_complete (GisPage *dummy,
static gboolean
page_validate (GisAccountPage *page)
{
- GisAccountPagePrivate *priv = gis_account_page_get_instance_private (page);
-
- switch (priv->mode) {
+ switch (page->mode) {
case UM_LOCAL:
- return gis_account_page_local_validate (GIS_ACCOUNT_PAGE_LOCAL (priv->page_local));
+ return gis_account_page_local_validate (GIS_ACCOUNT_PAGE_LOCAL (page->page_local));
case UM_ENTERPRISE:
- return gis_account_page_enterprise_validate (GIS_ACCOUNT_PAGE_ENTERPRISE (priv->page_enterprise));
+ return gis_account_page_enterprise_validate (GIS_ACCOUNT_PAGE_ENTERPRISE (page->page_enterprise));
default:
g_assert_not_reached ();
}
@@ -90,23 +89,21 @@ static void
set_mode (GisAccountPage *page,
UmAccountMode mode)
{
- GisAccountPagePrivate *priv = gis_account_page_get_instance_private (page);
-
- if (priv->mode == mode)
+ if (page->mode == mode)
return;
- priv->mode = mode;
+ page->mode = mode;
gis_driver_set_account_mode (GIS_PAGE (page)->driver, mode);
switch (mode)
{
case UM_LOCAL:
- gtk_stack_set_visible_child (GTK_STACK (priv->stack), priv->page_local);
- gis_account_page_local_shown (GIS_ACCOUNT_PAGE_LOCAL (priv->page_local));
+ gtk_stack_set_visible_child (GTK_STACK (page->stack), page->page_local);
+ gis_account_page_local_shown (GIS_ACCOUNT_PAGE_LOCAL (page->page_local));
break;
case UM_ENTERPRISE:
- gtk_stack_set_visible_child (GTK_STACK (priv->stack), priv->page_enterprise);
- gis_account_page_enterprise_shown (GIS_ACCOUNT_PAGE_ENTERPRISE (priv->page_enterprise));
+ gtk_stack_set_visible_child (GTK_STACK (page->stack), page->page_enterprise);
+ gis_account_page_enterprise_shown (GIS_ACCOUNT_PAGE_ENTERPRISE (page->page_enterprise));
break;
default:
g_assert_not_reached ();
@@ -128,13 +125,12 @@ gis_account_page_apply (GisPage *gis_page,
GCancellable *cancellable)
{
GisAccountPage *page = GIS_ACCOUNT_PAGE (gis_page);
- GisAccountPagePrivate *priv = gis_account_page_get_instance_private (page);
- switch (priv->mode) {
+ switch (page->mode) {
case UM_LOCAL:
- return gis_account_page_local_apply (GIS_ACCOUNT_PAGE_LOCAL (priv->page_local), gis_page);
+ return gis_account_page_local_apply (GIS_ACCOUNT_PAGE_LOCAL (page->page_local), gis_page);
case UM_ENTERPRISE:
- return gis_account_page_enterprise_apply (GIS_ACCOUNT_PAGE_ENTERPRISE (priv->page_enterprise),
cancellable,
+ return gis_account_page_enterprise_apply (GIS_ACCOUNT_PAGE_ENTERPRISE (page->page_enterprise),
cancellable,
enterprise_apply_complete, page);
default:
g_assert_not_reached ();
@@ -147,11 +143,10 @@ gis_account_page_save_data (GisPage *gis_page,
GError **error)
{
GisAccountPage *page = GIS_ACCOUNT_PAGE (gis_page);
- GisAccountPagePrivate *priv = gis_account_page_get_instance_private (page);
- switch (priv->mode) {
+ switch (page->mode) {
case UM_LOCAL:
- return gis_account_page_local_create_user (GIS_ACCOUNT_PAGE_LOCAL (priv->page_local), gis_page, error);
+ return gis_account_page_local_create_user (GIS_ACCOUNT_PAGE_LOCAL (page->page_local), gis_page, error);
case UM_ENTERPRISE:
/* Nothing to do. */
return TRUE;
@@ -165,9 +160,8 @@ static void
gis_account_page_shown (GisPage *gis_page)
{
GisAccountPage *page = GIS_ACCOUNT_PAGE (gis_page);
- GisAccountPagePrivate *priv = gis_account_page_get_instance_private (page);
- gis_account_page_local_shown (GIS_ACCOUNT_PAGE_LOCAL (priv->page_local));
+ gis_account_page_local_shown (GIS_ACCOUNT_PAGE_LOCAL (page->page_local));
}
static void
@@ -227,46 +221,43 @@ on_network_changed (GNetworkMonitor *monitor,
gboolean available,
GisAccountPage *page)
{
- GisAccountPagePrivate *priv = gis_account_page_get_instance_private (page);
-
- if (!available && priv->mode != UM_ENTERPRISE)
- gtk_stack_set_visible_child (GTK_STACK (priv->offline_stack), priv->offline_label);
+ if (!available && page->mode != UM_ENTERPRISE)
+ gtk_stack_set_visible_child (GTK_STACK (page->offline_stack), page->offline_label);
else
- gtk_stack_set_visible_child (GTK_STACK (priv->offline_stack), priv->page_toggle);
+ gtk_stack_set_visible_child (GTK_STACK (page->offline_stack), page->page_toggle);
}
static void
gis_account_page_constructed (GObject *object)
{
GisAccountPage *page = GIS_ACCOUNT_PAGE (object);
- GisAccountPagePrivate *priv = gis_account_page_get_instance_private (page);
GNetworkMonitor *monitor;
gboolean available;
G_OBJECT_CLASS (gis_account_page_parent_class)->constructed (object);
- g_signal_connect (priv->page_local, "validation-changed",
+ g_signal_connect (page->page_local, "validation-changed",
G_CALLBACK (on_validation_changed), page);
- g_signal_connect (priv->page_local, "main-user-created",
+ g_signal_connect (page->page_local, "main-user-created",
G_CALLBACK (on_local_main_user_created), page);
- g_signal_connect (priv->page_local, "parent-user-created",
+ g_signal_connect (page->page_local, "parent-user-created",
G_CALLBACK (on_local_parent_user_created), page);
- g_signal_connect (priv->page_local, "confirm",
+ g_signal_connect (page->page_local, "confirm",
G_CALLBACK (on_local_page_confirmed), page);
- g_signal_connect (priv->page_enterprise, "validation-changed",
+ g_signal_connect (page->page_enterprise, "validation-changed",
G_CALLBACK (on_validation_changed), page);
- g_signal_connect (priv->page_enterprise, "user-cached",
+ g_signal_connect (page->page_enterprise, "user-cached",
G_CALLBACK (on_local_user_cached), page);
update_page_validation (page);
- g_signal_connect (priv->page_toggle, "toggled", G_CALLBACK (toggle_mode), page);
- g_object_bind_property (page, "applying", priv->page_toggle, "sensitive", G_BINDING_INVERT_BOOLEAN);
- g_object_bind_property (priv->page_enterprise, "visible", priv->offline_stack, "visible",
G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
+ g_signal_connect (page->page_toggle, "toggled", G_CALLBACK (toggle_mode), page);
+ g_object_bind_property (page, "applying", page->page_toggle, "sensitive", G_BINDING_INVERT_BOOLEAN);
+ g_object_bind_property (page->page_enterprise, "visible", page->offline_stack, "visible",
G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
/* force a refresh by setting to an invalid value */
- priv->mode = NUM_MODES;
+ page->mode = NUM_MODES;
set_mode (page, UM_LOCAL);
monitor = g_network_monitor_get_default ();
@@ -291,13 +282,13 @@ gis_account_page_class_init (GisAccountPageClass *klass)
gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass),
"/org/gnome/initial-setup/gis-account-page.ui");
- gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GisAccountPage, page_local);
- gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GisAccountPage, page_enterprise);
- gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GisAccountPage, stack);
+ gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (klass), GisAccountPage, page_local);
+ gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (klass), GisAccountPage, page_enterprise);
+ gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (klass), GisAccountPage, stack);
- gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GisAccountPage, page_toggle);
- gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GisAccountPage, offline_label);
- gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GisAccountPage, offline_stack);
+ gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (klass), GisAccountPage, page_toggle);
+ gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (klass), GisAccountPage, offline_label);
+ gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (klass), GisAccountPage, offline_stack);
page_class->page_id = PAGE_ID;
page_class->locale_changed = gis_account_page_locale_changed;
diff --git a/gnome-initial-setup/pages/account/gis-account-page.h
b/gnome-initial-setup/pages/account/gis-account-page.h
index 006fcbd1..17a86fab 100644
--- a/gnome-initial-setup/pages/account/gis-account-page.h
+++ b/gnome-initial-setup/pages/account/gis-account-page.h
@@ -27,26 +27,7 @@
G_BEGIN_DECLS
-#define GIS_TYPE_ACCOUNT_PAGE (gis_account_page_get_type ())
-#define GIS_ACCOUNT_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj),
GIS_TYPE_ACCOUNT_PAGE, GisAccountPage))
-#define GIS_ACCOUNT_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass),
GIS_TYPE_ACCOUNT_PAGE, GisAccountPageClass))
-#define GIS_IS_ACCOUNT_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIS_TYPE_ACCOUNT_PAGE))
-#define GIS_IS_ACCOUNT_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIS_TYPE_ACCOUNT_PAGE))
-#define GIS_ACCOUNT_PAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),
GIS_TYPE_ACCOUNT_PAGE, GisAccountPageClass))
-
-typedef struct _GisAccountPage GisAccountPage;
-typedef struct _GisAccountPageClass GisAccountPageClass;
-
-struct _GisAccountPage
-{
- GisPage parent;
-};
-
-struct _GisAccountPageClass
-{
- GisPageClass parent_class;
-};
-
-GType gis_account_page_get_type (void);
+#define GIS_TYPE_ACCOUNT_PAGE (gis_account_page_get_type ())
+G_DECLARE_FINAL_TYPE (GisAccountPage, gis_account_page, GIS, ACCOUNT_PAGE, GisPage)
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]