[gnome-initial-setup] Use the new G_DEFINE_TYPE_WITH_PRIVATE shenanigans
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-initial-setup] Use the new G_DEFINE_TYPE_WITH_PRIVATE shenanigans
- Date: Thu, 29 Aug 2013 20:13:40 +0000 (UTC)
commit b2e97c372c2f4902c230f855e94b4340f1c849c4
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Sat Aug 3 13:17:44 2013 -0400
Use the new G_DEFINE_TYPE_WITH_PRIVATE shenanigans
configure.ac | 4 -
gnome-initial-setup/gis-assistant-gtk.c | 25 ++---
gnome-initial-setup/gis-assistant-gtk.h | 3 -
gnome-initial-setup/gis-assistant.c | 75 ++++++------
gnome-initial-setup/gis-assistant.h | 3 -
gnome-initial-setup/gis-center-container.c | 21 +--
gnome-initial-setup/gis-center-container.h | 3 -
gnome-initial-setup/gis-driver.c | 48 ++++----
gnome-initial-setup/gis-driver.h | 3 -
gnome-initial-setup/gis-page.c | 87 +++++++-------
gnome-initial-setup/gis-page.h | 2 -
.../pages/account/gis-account-page.c | 127 +++++++++++---------
.../pages/account/gis-account-page.h | 3 -
gnome-initial-setup/pages/eulas/gis-eula-page.c | 22 ++--
gnome-initial-setup/pages/eulas/gis-eula-page.h | 3 -
gnome-initial-setup/pages/goa/gis-goa-page.c | 24 ++--
gnome-initial-setup/pages/goa/gis-goa-page.h | 3 -
.../pages/keyboard/gis-keyboard-page.c | 72 +++++------
.../pages/keyboard/gis-keyboard-page.h | 3 -
.../pages/language/gis-language-page.c | 30 ++---
.../pages/language/gis-language-page.h | 3 -
.../pages/location/gis-location-page.c | 29 +++--
.../pages/location/gis-location-page.h | 3 -
.../pages/network/gis-network-page.c | 24 ++--
.../pages/network/gis-network-page.h | 3 -
.../pages/summary/gis-summary-page.c | 17 +--
.../pages/summary/gis-summary-page.h | 3 -
27 files changed, 291 insertions(+), 352 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 8298599..76d8492 100644
--- a/configure.ac
+++ b/configure.ac
@@ -95,10 +95,6 @@ PKG_CHECK_MODULES(ISOCODES, iso-codes)
AC_DEFINE_UNQUOTED([ISO_CODES_PREFIX],["`$PKG_CONFIG --variable=prefix iso-codes`"],[ISO codes prefix])
ISO_CODES=iso-codes
-GLIB_VERSION_DEFINES="-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_36
'-DGLIB_VERSION_MAX_ALLOWED=G_ENCODE_VERSION(2,36)'"
-
-INITIAL_SETUP_CFLAGS="$INITIAL_SETUP_CFLAGS $GLIB_VERSION_DEFINES"
-
AC_SUBST(INITIAL_SETUP_CFLAGS)
AC_SUBST(INITIAL_SETUP_LIBS)
diff --git a/gnome-initial-setup/gis-assistant-gtk.c b/gnome-initial-setup/gis-assistant-gtk.c
index 33be664..cb2da35 100644
--- a/gnome-initial-setup/gis-assistant-gtk.c
+++ b/gnome-initial-setup/gis-assistant-gtk.c
@@ -30,14 +30,13 @@
#include "gis-assistant-gtk.h"
#include "gis-assistant-private.h"
-G_DEFINE_TYPE (GisAssistantGtk, gis_assistant_gtk, GIS_TYPE_ASSISTANT)
-
-#define GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GIS_TYPE_ASSISTANT_GTK, GisAssistantGtkPrivate))
-
struct _GisAssistantGtkPrivate
{
GtkWidget *stack;
};
+typedef struct _GisAssistantGtkPrivate GisAssistantGtkPrivate;
+
+G_DEFINE_TYPE_WITH_PRIVATE (GisAssistantGtk, gis_assistant_gtk, GIS_TYPE_ASSISTANT)
static void
current_page_changed (GObject *gobject,
@@ -52,10 +51,10 @@ current_page_changed (GObject *gobject,
static void
gis_assistant_gtk_switch_to (GisAssistant *assistant,
- GisAssistantDirection direction,
- GisPage *page)
+ GisAssistantDirection direction,
+ GisPage *page)
{
- GisAssistantGtkPrivate *priv = GIS_ASSISTANT_GTK (assistant)->priv;
+ GisAssistantGtkPrivate *priv = gis_assistant_gtk_get_instance_private (GIS_ASSISTANT_GTK (assistant));
GtkStackTransitionType transition_type;
switch (direction) {
@@ -72,26 +71,24 @@ gis_assistant_gtk_switch_to (GisAssistant *assistant,
gtk_stack_set_transition_type (GTK_STACK (priv->stack), transition_type);
gtk_stack_set_visible_child (GTK_STACK (priv->stack),
- GTK_WIDGET (page));
+ GTK_WIDGET (page));
}
static void
gis_assistant_gtk_add_page (GisAssistant *assistant,
- GisPage *page)
+ GisPage *page)
{
- GisAssistantGtkPrivate *priv = GIS_ASSISTANT_GTK (assistant)->priv;
+ GisAssistantGtkPrivate *priv = gis_assistant_gtk_get_instance_private (GIS_ASSISTANT_GTK (assistant));
gtk_container_add (GTK_CONTAINER (priv->stack), GTK_WIDGET (page));
}
static void
gis_assistant_gtk_init (GisAssistantGtk *assistant_gtk)
{
- GisAssistantGtkPrivate *priv = GET_PRIVATE (assistant_gtk);
GisAssistant *assistant = GIS_ASSISTANT (assistant_gtk);
+ GisAssistantGtkPrivate *priv = gis_assistant_gtk_get_instance_private (assistant_gtk);
GtkWidget *frame;
- assistant_gtk->priv = priv;
-
frame = _gis_assistant_get_frame (assistant);
priv->stack = gtk_stack_new ();
gtk_stack_set_transition_type (GTK_STACK (priv->stack),
@@ -109,8 +106,6 @@ gis_assistant_gtk_class_init (GisAssistantGtkClass *klass)
{
GisAssistantClass *assistant_class = GIS_ASSISTANT_CLASS (klass);
- g_type_class_add_private (klass, sizeof (GisAssistantGtkPrivate));
-
assistant_class->add_page = gis_assistant_gtk_add_page;
assistant_class->switch_to = gis_assistant_gtk_switch_to;
}
diff --git a/gnome-initial-setup/gis-assistant-gtk.h b/gnome-initial-setup/gis-assistant-gtk.h
index de3fdb5..668c384 100644
--- a/gnome-initial-setup/gis-assistant-gtk.h
+++ b/gnome-initial-setup/gis-assistant-gtk.h
@@ -39,13 +39,10 @@ G_BEGIN_DECLS
typedef struct _GisAssistantGtk GisAssistantGtk;
typedef struct _GisAssistantGtkClass GisAssistantGtkClass;
-typedef struct _GisAssistantGtkPrivate GisAssistantGtkPrivate;
struct _GisAssistantGtk
{
GisAssistant parent;
-
- GisAssistantGtkPrivate *priv;
};
struct _GisAssistantGtkClass
diff --git a/gnome-initial-setup/gis-assistant.c b/gnome-initial-setup/gis-assistant.c
index 8c510c2..8ea36c4 100644
--- a/gnome-initial-setup/gis-assistant.c
+++ b/gnome-initial-setup/gis-assistant.c
@@ -32,10 +32,6 @@
#include "gis-assistant-private.h"
#include "gis-center-container.h"
-G_DEFINE_TYPE (GisAssistant, gis_assistant, GTK_TYPE_BOX)
-
-#define GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GIS_TYPE_ASSISTANT, GisAssistantPrivate))
-
enum {
PROP_0,
PROP_TITLE,
@@ -66,6 +62,9 @@ struct _GisAssistantPrivate
GList *pages;
GisPage *current_page;
};
+typedef struct _GisAssistantPrivate GisAssistantPrivate;
+
+G_DEFINE_TYPE_WITH_PRIVATE (GisAssistant, gis_assistant, GTK_TYPE_BOX)
struct _GisAssistantPagePrivate
{
@@ -77,7 +76,7 @@ widget_destroyed (GtkWidget *widget,
GisAssistant *assistant)
{
GisPage *page = GIS_PAGE (widget);
- GisAssistantPrivate *priv = assistant->priv;
+ GisAssistantPrivate *priv = gis_assistant_get_instance_private (assistant);
priv->pages = g_list_delete_link (priv->pages, page->assistant_priv->link);
if (page == priv->current_page)
@@ -101,16 +100,19 @@ on_apply_done (GisPage *page,
gpointer user_data)
{
GisAssistant *assistant = GIS_ASSISTANT (user_data);
+ GisAssistantPrivate *priv = gis_assistant_get_instance_private (assistant);
+
if (valid)
g_signal_emit (assistant, signals[NEXT_PAGE], 0,
- assistant->priv->current_page);
+ priv->current_page);
+
g_object_unref (assistant);
}
void
gis_assistant_next_page (GisAssistant *assistant)
{
- GisAssistantPrivate *priv = assistant->priv;
+ GisAssistantPrivate *priv = gis_assistant_get_instance_private (assistant);
if (priv->current_page)
gis_page_apply_begin (priv->current_page, on_apply_done,
g_object_ref (assistant));
@@ -155,7 +157,7 @@ find_prev_page (GisPage *page)
void
gis_assistant_previous_page (GisAssistant *assistant)
{
- GisAssistantPrivate *priv = assistant->priv;
+ GisAssistantPrivate *priv = gis_assistant_get_instance_private (assistant);
g_return_if_fail (priv->current_page != NULL);
gis_assistant_switch_to (assistant, GIS_ASSISTANT_PREV, find_prev_page (priv->current_page));
}
@@ -171,7 +173,7 @@ remove_from_page_action_area (GtkWidget *widget,
static void
update_action_widget (GisAssistant *assistant)
{
- GisAssistantPrivate *priv = assistant->priv;
+ GisAssistantPrivate *priv = gis_assistant_get_instance_private (assistant);
GtkWidget *action;
gtk_container_foreach (GTK_CONTAINER (priv->page_action_widget_area),
@@ -194,7 +196,7 @@ remove_from_progress_indicator (GtkWidget *widget,
static void
update_progress_indicator (GisAssistant *assistant)
{
- GisAssistantPrivate *priv = assistant->priv;
+ GisAssistantPrivate *priv = gis_assistant_get_instance_private (assistant);
GList *l;
gtk_container_foreach (GTK_CONTAINER (priv->progress_indicator),
@@ -219,7 +221,7 @@ update_progress_indicator (GisAssistant *assistant)
static void
update_navigation_buttons (GisAssistant *assistant)
{
- GisAssistantPrivate *priv = assistant->priv;
+ GisAssistantPrivate *priv = gis_assistant_get_instance_private (assistant);
GisPage *page = priv->current_page;
GisAssistantPagePrivate *page_priv;
gboolean is_last_page;
@@ -255,18 +257,19 @@ static void
update_applying_state (GisAssistant *assistant)
{
gboolean applying = FALSE;
- if (assistant->priv->current_page)
- applying = gis_page_get_applying (assistant->priv->current_page);
- gtk_widget_set_sensitive (assistant->priv->frame, !applying);
- gtk_widget_set_sensitive (assistant->priv->forward, !applying);
- gtk_widget_set_visible (assistant->priv->back, !applying);
- gtk_widget_set_visible (assistant->priv->cancel, applying);
- gtk_widget_set_visible (assistant->priv->spinner, applying);
+ GisAssistantPrivate *priv = gis_assistant_get_instance_private (assistant);
+ if (priv->current_page)
+ applying = gis_page_get_applying (priv->current_page);
+ gtk_widget_set_sensitive (priv->frame, !applying);
+ gtk_widget_set_sensitive (priv->forward, !applying);
+ gtk_widget_set_visible (priv->back, !applying);
+ gtk_widget_set_visible (priv->cancel, applying);
+ gtk_widget_set_visible (priv->spinner, applying);
if (applying)
- gtk_spinner_start (GTK_SPINNER (assistant->priv->spinner));
+ gtk_spinner_start (GTK_SPINNER (priv->spinner));
else
- gtk_spinner_stop (GTK_SPINNER (assistant->priv->spinner));
+ gtk_spinner_stop (GTK_SPINNER (priv->spinner));
}
static void
@@ -274,7 +277,9 @@ page_notify (GisPage *page,
GParamSpec *pspec,
GisAssistant *assistant)
{
- if (page != assistant->priv->current_page)
+ GisAssistantPrivate *priv = gis_assistant_get_instance_private (assistant);
+
+ if (page != priv->current_page)
return;
if (strcmp (pspec->name, "title") == 0)
@@ -289,7 +294,7 @@ void
gis_assistant_add_page (GisAssistant *assistant,
GisPage *page)
{
- GisAssistantPrivate *priv = assistant->priv;
+ GisAssistantPrivate *priv = gis_assistant_get_instance_private (assistant);
GList *link;
g_return_if_fail (page->assistant_priv == NULL);
@@ -312,14 +317,14 @@ gis_assistant_add_page (GisAssistant *assistant,
GisPage *
gis_assistant_get_current_page (GisAssistant *assistant)
{
- GisAssistantPrivate *priv = assistant->priv;
+ GisAssistantPrivate *priv = gis_assistant_get_instance_private (assistant);
return priv->current_page;
}
GList *
gis_assistant_get_all_pages (GisAssistant *assistant)
{
- GisAssistantPrivate *priv = assistant->priv;
+ GisAssistantPrivate *priv = gis_assistant_get_instance_private (assistant);
return priv->pages;
}
@@ -341,14 +346,15 @@ static void
do_cancel (GtkWidget *button,
GisAssistant *assistant)
{
- if (assistant->priv->current_page)
- gis_page_apply_cancel (assistant->priv->current_page);
+ GisAssistantPrivate *priv = gis_assistant_get_instance_private (assistant);
+ if (priv->current_page)
+ gis_page_apply_cancel (priv->current_page);
}
gchar *
gis_assistant_get_title (GisAssistant *assistant)
{
- GisAssistantPrivate *priv = assistant->priv;
+ GisAssistantPrivate *priv = gis_assistant_get_instance_private (assistant);
if (priv->current_page != NULL)
return gis_page_get_title (priv->current_page);
else
@@ -358,14 +364,15 @@ gis_assistant_get_title (GisAssistant *assistant)
GtkWidget *
_gis_assistant_get_frame (GisAssistant *assistant)
{
- return assistant->priv->frame;
+ GisAssistantPrivate *priv = gis_assistant_get_instance_private (assistant);
+ return priv->frame;
}
void
_gis_assistant_current_page_changed (GisAssistant *assistant,
GisPage *page)
{
- GisAssistantPrivate *priv = assistant->priv;
+ GisAssistantPrivate *priv = gis_assistant_get_instance_private (assistant);
if (priv->current_page == page)
return;
@@ -383,7 +390,7 @@ _gis_assistant_current_page_changed (GisAssistant *assistant,
void
gis_assistant_locale_changed (GisAssistant *assistant)
{
- GisAssistantPrivate *priv = assistant->priv;
+ GisAssistantPrivate *priv = gis_assistant_get_instance_private (assistant);
GList *l;
gtk_button_set_label (GTK_BUTTON (priv->forward), _("_Next"));
@@ -397,7 +404,7 @@ gis_assistant_locale_changed (GisAssistant *assistant)
void
gis_assistant_save_data (GisAssistant *assistant)
{
- GisAssistantPrivate *priv = assistant->priv;
+ GisAssistantPrivate *priv = gis_assistant_get_instance_private (assistant);
GList *l;
for (l = priv->pages; l != NULL; l = l->next)
@@ -407,12 +414,10 @@ gis_assistant_save_data (GisAssistant *assistant)
static void
gis_assistant_init (GisAssistant *assistant)
{
- GisAssistantPrivate *priv = GET_PRIVATE (assistant);
+ GisAssistantPrivate *priv = gis_assistant_get_instance_private (assistant);
GtkWidget *navigation;
GtkWidget *widget;
- assistant->priv = priv;
-
priv->main_layout = gtk_box_new (GTK_ORIENTATION_VERTICAL, 20);
gtk_box_pack_start (GTK_BOX (assistant), priv->main_layout, TRUE, TRUE, 0);
@@ -497,8 +502,6 @@ gis_assistant_class_init (GisAssistantClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- g_type_class_add_private (klass, sizeof (GisAssistantPrivate));
-
gobject_class->get_property = gis_assistant_get_property;
klass->next_page = gis_assistant_real_next_page;
diff --git a/gnome-initial-setup/gis-assistant.h b/gnome-initial-setup/gis-assistant.h
index 3c93765..dd3c79a 100644
--- a/gnome-initial-setup/gis-assistant.h
+++ b/gnome-initial-setup/gis-assistant.h
@@ -37,7 +37,6 @@ G_BEGIN_DECLS
typedef struct _GisAssistant GisAssistant;
typedef struct _GisAssistantClass GisAssistantClass;
-typedef struct _GisAssistantPrivate GisAssistantPrivate;
typedef enum {
GIS_ASSISTANT_PREV,
@@ -47,8 +46,6 @@ typedef enum {
struct _GisAssistant
{
GtkBox parent;
-
- GisAssistantPrivate *priv;
};
struct _GisAssistantClass
diff --git a/gnome-initial-setup/gis-center-container.c b/gnome-initial-setup/gis-center-container.c
index 9612fa8..1b4a0ef 100644
--- a/gnome-initial-setup/gis-center-container.c
+++ b/gnome-initial-setup/gis-center-container.c
@@ -30,19 +30,15 @@ struct _GisCenterContainerPrivate
GtkWidget *center;
GtkWidget *right;
};
+typedef struct _GisCenterContainerPrivate GisCenterContainerPrivate;
-G_DEFINE_TYPE (GisCenterContainer, gis_center_container, GTK_TYPE_CONTAINER);
+G_DEFINE_TYPE_WITH_PRIVATE (GisCenterContainer, gis_center_container, GTK_TYPE_CONTAINER);
#define SPACING 6
static void
gis_center_container_init (GisCenterContainer *center)
{
- GisCenterContainerPrivate *priv;
-
- priv = G_TYPE_INSTANCE_GET_PRIVATE (center, GIS_TYPE_CENTER_CONTAINER, GisCenterContainerPrivate);
- center->priv = priv;
-
gtk_widget_set_has_window (GTK_WIDGET (center), FALSE);
}
@@ -52,7 +48,7 @@ gis_center_container_get_preferred_width (GtkWidget *widget,
gint *natural_size)
{
GisCenterContainer *center = GIS_CENTER_CONTAINER (widget);
- GisCenterContainerPrivate *priv = center->priv;
+ GisCenterContainerPrivate *priv = gis_center_container_get_instance_private (center);
gint sum_min, sum_nat;
gint child_min, child_nat;
@@ -81,7 +77,7 @@ gis_center_container_get_preferred_height (GtkWidget *widget,
gint *natural_size)
{
GisCenterContainer *center = GIS_CENTER_CONTAINER (widget);
- GisCenterContainerPrivate *priv = center->priv;
+ GisCenterContainerPrivate *priv = gis_center_container_get_instance_private (center);
gint max_min, max_nat;
gint child_min, child_nat;
@@ -108,7 +104,7 @@ gis_center_container_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
GisCenterContainer *center = GIS_CENTER_CONTAINER (widget);
- GisCenterContainerPrivate *priv = center->priv;
+ GisCenterContainerPrivate *priv = gis_center_container_get_instance_private (center);
GtkAllocation child_allocation;
gint max_side;
@@ -151,7 +147,7 @@ gis_center_container_forall (GtkContainer *container,
gpointer callback_data)
{
GisCenterContainer *center = GIS_CENTER_CONTAINER (container);
- GisCenterContainerPrivate *priv = center->priv;
+ GisCenterContainerPrivate *priv = gis_center_container_get_instance_private (center);
callback (priv->left, callback_data);
callback (priv->center, callback_data);
@@ -161,7 +157,6 @@ gis_center_container_forall (GtkContainer *container,
static void
gis_center_container_class_init (GisCenterContainerClass *class)
{
- GObjectClass *object_class = G_OBJECT_CLASS (class);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
GtkContainerClass *container_class = GTK_CONTAINER_CLASS (class);
@@ -172,8 +167,6 @@ gis_center_container_class_init (GisCenterContainerClass *class)
container_class->forall = gis_center_container_forall;
container_class->child_type = gis_center_container_child_type;
gtk_container_class_handle_border_width (container_class);
-
- g_type_class_add_private (object_class, sizeof (GisCenterContainerPrivate));
}
GtkWidget *
@@ -182,7 +175,7 @@ gis_center_container_new (GtkWidget *left,
GtkWidget *right)
{
GisCenterContainer *container = g_object_new (GIS_TYPE_CENTER_CONTAINER, NULL);
- GisCenterContainerPrivate *priv = container->priv;
+ GisCenterContainerPrivate *priv = gis_center_container_get_instance_private (container);
priv->left = left;
gtk_widget_set_parent (left, GTK_WIDGET (container));
diff --git a/gnome-initial-setup/gis-center-container.h b/gnome-initial-setup/gis-center-container.h
index 9bff7e9..68c36f5 100644
--- a/gnome-initial-setup/gis-center-container.h
+++ b/gnome-initial-setup/gis-center-container.h
@@ -38,13 +38,10 @@ G_BEGIN_DECLS
typedef struct _GisCenterContainer GisCenterContainer;
typedef struct _GisCenterContainerClass GisCenterContainerClass;
-typedef struct _GisCenterContainerPrivate GisCenterContainerPrivate;
struct _GisCenterContainer
{
GtkContainer parent;
-
- GisCenterContainerPrivate *priv;
};
struct _GisCenterContainerClass
diff --git a/gnome-initial-setup/gis-driver.c b/gnome-initial-setup/gis-driver.c
index 7abd426..da6d07f 100644
--- a/gnome-initial-setup/gis-driver.c
+++ b/gnome-initial-setup/gis-driver.c
@@ -49,10 +49,6 @@ gis_driver_mode_get_type (void) {
return enum_type_id;
}
-G_DEFINE_TYPE(GisDriver, gis_driver, GTK_TYPE_APPLICATION)
-
-#define GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GIS_TYPE_DRIVER, GisDriverPrivate))
-
enum {
REBUILD_PAGES,
LOCALE_CHANGED,
@@ -80,12 +76,15 @@ struct _GisDriverPrivate {
GisDriverMode mode;
};
+typedef struct _GisDriverPrivate GisDriverPrivate;
+
+G_DEFINE_TYPE_WITH_PRIVATE(GisDriver, gis_driver, GTK_TYPE_APPLICATION)
static void
gis_driver_finalize (GObject *object)
{
GisDriver *driver = GIS_DRIVER (object);
- GisDriverPrivate *priv = driver->priv;
+ GisDriverPrivate *priv = gis_driver_get_instance_private (driver);
g_free (priv->lang_id);
@@ -97,14 +96,14 @@ title_changed_cb (GisAssistant *assistant,
GParamSpec *gparam,
GisDriver *driver)
{
- GisDriverPrivate *priv = driver->priv;
+ GisDriverPrivate *priv = gis_driver_get_instance_private (driver);
gtk_window_set_title (priv->main_window, gis_assistant_get_title (assistant));
}
static void
prepare_main_window (GisDriver *driver)
{
- GisDriverPrivate *priv = driver->priv;
+ GisDriverPrivate *priv = gis_driver_get_instance_private (driver);
GdkGeometry size_hints;
size_hints.min_width = 680;
@@ -130,14 +129,14 @@ rebuild_pages (GisDriver *driver)
GisAssistant *
gis_driver_get_assistant (GisDriver *driver)
{
- GisDriverPrivate *priv = driver->priv;
+ GisDriverPrivate *priv = gis_driver_get_instance_private (driver);
return priv->assistant;
}
void
gis_driver_set_user_language (GisDriver *driver, const gchar *lang_id)
{
- GisDriverPrivate *priv = driver->priv;
+ GisDriverPrivate *priv = gis_driver_get_instance_private (driver);
g_free (priv->lang_id);
priv->lang_id = g_strdup (lang_id);
}
@@ -145,7 +144,7 @@ gis_driver_set_user_language (GisDriver *driver, const gchar *lang_id)
const gchar *
gis_driver_get_user_language (GisDriver *driver)
{
- GisDriverPrivate *priv = driver->priv;
+ GisDriverPrivate *priv = gis_driver_get_instance_private (driver);
return priv->lang_id;
}
@@ -154,7 +153,7 @@ gis_driver_set_user_permissions (GisDriver *driver,
ActUser *user,
const gchar *password)
{
- GisDriverPrivate *priv = driver->priv;
+ GisDriverPrivate *priv = gis_driver_get_instance_private (driver);
priv->user_account = user;
priv->user_password = password;
}
@@ -164,7 +163,7 @@ gis_driver_get_user_permissions (GisDriver *driver,
ActUser **user,
const gchar **password)
{
- GisDriverPrivate *priv = driver->priv;
+ GisDriverPrivate *priv = gis_driver_get_instance_private (driver);
*user = priv->user_account;
*password = priv->user_password;
}
@@ -173,14 +172,14 @@ void
gis_driver_add_page (GisDriver *driver,
GisPage *page)
{
- GisDriverPrivate *priv = driver->priv;
+ GisDriverPrivate *priv = gis_driver_get_instance_private (driver);
gis_assistant_add_page (priv->assistant, page);
}
static void
gis_driver_real_locale_changed (GisDriver *driver)
{
- GisDriverPrivate *priv = driver->priv;
+ GisDriverPrivate *priv = gis_driver_get_instance_private (driver);
g_idle_add ((GSourceFunc) rebuild_pages, driver);
gis_assistant_locale_changed (priv->assistant);
}
@@ -194,7 +193,7 @@ gis_driver_locale_changed (GisDriver *driver)
GisDriverMode
gis_driver_get_mode (GisDriver *driver)
{
- GisDriverPrivate *priv = driver->priv;
+ GisDriverPrivate *priv = gis_driver_get_instance_private (driver);
return priv->mode;
}
@@ -205,10 +204,11 @@ gis_driver_get_property (GObject *object,
GParamSpec *pspec)
{
GisDriver *driver = GIS_DRIVER (object);
+ GisDriverPrivate *priv = gis_driver_get_instance_private (driver);
switch (prop_id)
{
case PROP_MODE:
- g_value_set_enum (value, driver->priv->mode);
+ g_value_set_enum (value, priv->mode);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -223,10 +223,11 @@ gis_driver_set_property (GObject *object,
GParamSpec *pspec)
{
GisDriver *driver = GIS_DRIVER (object);
+ GisDriverPrivate *priv = gis_driver_get_instance_private (driver);
switch (prop_id)
{
case PROP_MODE:
- driver->priv->mode = g_value_get_enum (value);
+ priv->mode = g_value_get_enum (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -238,7 +239,7 @@ static void
gis_driver_activate (GApplication *app)
{
GisDriver *driver = GIS_DRIVER (app);
- GisDriverPrivate *priv = driver->priv;
+ GisDriverPrivate *priv = gis_driver_get_instance_private (driver);
G_APPLICATION_CLASS (gis_driver_parent_class)->activate (app);
@@ -248,7 +249,8 @@ gis_driver_activate (GApplication *app)
static void
window_realize_cb (GtkWidget *widget, gpointer user_data)
{
- GisDriverPrivate *priv = GIS_DRIVER (user_data)->priv;
+ GisDriver *driver = GIS_DRIVER (user_data);
+ GisDriverPrivate *priv = gis_driver_get_instance_private (driver);
GdkWindow *window;
window = gtk_widget_get_window (GTK_WIDGET (priv->main_window));
/* disable WM functions except move */
@@ -259,7 +261,7 @@ static void
gis_driver_startup (GApplication *app)
{
GisDriver *driver = GIS_DRIVER (app);
- GisDriverPrivate *priv = driver->priv;
+ GisDriverPrivate *priv = gis_driver_get_instance_private (driver);
G_APPLICATION_CLASS (gis_driver_parent_class)->startup (app);
@@ -292,7 +294,6 @@ gis_driver_startup (GApplication *app)
static void
gis_driver_init (GisDriver *driver)
{
- driver->priv = GET_PRIVATE (driver);
}
static void
@@ -301,8 +302,6 @@ gis_driver_class_init (GisDriverClass *klass)
GApplicationClass *application_class = G_APPLICATION_CLASS (klass);
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- g_type_class_add_private (klass, sizeof (GisDriverPrivate));
-
gobject_class->get_property = gis_driver_get_property;
gobject_class->set_property = gis_driver_set_property;
gobject_class->finalize = gis_driver_finalize;
@@ -338,7 +337,8 @@ gis_driver_class_init (GisDriverClass *klass)
void
gis_driver_save_data (GisDriver *driver)
{
- gis_assistant_save_data (driver->priv->assistant);
+ GisDriverPrivate *priv = gis_driver_get_instance_private (driver);
+ gis_assistant_save_data (priv->assistant);
}
GisDriver *
diff --git a/gnome-initial-setup/gis-driver.h b/gnome-initial-setup/gis-driver.h
index 786e242..ff079df 100644
--- a/gnome-initial-setup/gis-driver.h
+++ b/gnome-initial-setup/gis-driver.h
@@ -39,13 +39,10 @@ G_BEGIN_DECLS
typedef struct _GisDriver GisDriver;
typedef struct _GisDriverClass GisDriverClass;
-typedef struct _GisDriverPrivate GisDriverPrivate;
struct _GisDriver
{
GtkApplication parent;
-
- GisDriverPrivate *priv;
};
struct _GisDriverClass
diff --git a/gnome-initial-setup/gis-page.c b/gnome-initial-setup/gis-page.c
index abe5ea1..7346412 100644
--- a/gnome-initial-setup/gis-page.c
+++ b/gnome-initial-setup/gis-page.c
@@ -27,10 +27,6 @@
#include "gis-page.h"
-G_DEFINE_ABSTRACT_TYPE (GisPage, gis_page, GTK_TYPE_BIN);
-
-#define GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GIS_TYPE_PAGE, GisPagePrivate))
-
struct _GisPagePrivate
{
char *title;
@@ -43,6 +39,9 @@ struct _GisPagePrivate
guint complete : 1;
guint padding : 6;
};
+typedef struct _GisPagePrivate GisPagePrivate;
+
+G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GisPage, gis_page, GTK_TYPE_BIN);
enum
{
@@ -63,16 +62,17 @@ gis_page_get_property (GObject *object,
GParamSpec *pspec)
{
GisPage *page = GIS_PAGE (object);
+ GisPagePrivate *priv = gis_page_get_instance_private (page);
switch (prop_id)
{
case PROP_DRIVER:
g_value_set_object (value, page->driver);
break;
case PROP_TITLE:
- g_value_set_string (value, page->priv->title);
+ g_value_set_string (value, priv->title);
break;
case PROP_COMPLETE:
- g_value_set_boolean (value, page->priv->complete);
+ g_value_set_boolean (value, priv->complete);
break;
case PROP_APPLYING:
g_value_set_boolean (value, gis_page_get_applying (page));
@@ -90,6 +90,7 @@ gis_page_set_property (GObject *object,
GParamSpec *pspec)
{
GisPage *page = GIS_PAGE (object);
+ GisPagePrivate *priv = gis_page_get_instance_private (page);
switch (prop_id)
{
case PROP_DRIVER:
@@ -99,7 +100,7 @@ gis_page_set_property (GObject *object,
gis_page_set_title (page, (char *) g_value_get_string (value));
break;
case PROP_COMPLETE:
- page->priv->complete = g_value_get_boolean (value);
+ priv->complete = g_value_get_boolean (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -111,11 +112,12 @@ static void
gis_page_finalize (GObject *object)
{
GisPage *page = GIS_PAGE (object);
+ GisPagePrivate *priv = gis_page_get_instance_private (page);
- g_free (page->priv->title);
- g_assert (!page->priv->applying);
- g_assert (page->priv->apply_cb == NULL);
- g_assert (page->priv->apply_cancel == NULL);
+ g_free (priv->title);
+ g_assert (!priv->applying);
+ g_assert (priv->apply_cb == NULL);
+ g_assert (priv->apply_cancel == NULL);
G_OBJECT_CLASS (gis_page_parent_class)->finalize (object);
}
@@ -124,9 +126,10 @@ static void
gis_page_dispose (GObject *object)
{
GisPage *page = GIS_PAGE (object);
+ GisPagePrivate *priv = gis_page_get_instance_private (page);
- if (page->priv->apply_cancel)
- g_cancellable_cancel (page->priv->apply_cancel);
+ if (priv->apply_cancel)
+ g_cancellable_cancel (priv->apply_cancel);
g_clear_object (&page->driver);
g_clear_object (&page->builder);
@@ -215,21 +218,19 @@ gis_page_class_init (GisPageClass *klass)
G_PARAM_STATIC_STRINGS | G_PARAM_READABLE);
g_object_class_install_properties (object_class, PROP_LAST, obj_props);
-
- g_type_class_add_private (object_class, sizeof(GisPagePrivate));
}
static void
gis_page_init (GisPage *page)
{
- page->priv = GET_PRIVATE (page);
}
char *
gis_page_get_title (GisPage *page)
{
- if (page->priv->title != NULL)
- return page->priv->title;
+ GisPagePrivate *priv = gis_page_get_instance_private (page);
+ if (priv->title != NULL)
+ return priv->title;
else
return "";
}
@@ -237,21 +238,24 @@ gis_page_get_title (GisPage *page)
void
gis_page_set_title (GisPage *page, char *title)
{
- g_clear_pointer (&page->priv->title, g_free);
- page->priv->title = g_strdup (title);
+ GisPagePrivate *priv = gis_page_get_instance_private (page);
+ g_clear_pointer (&priv->title, g_free);
+ priv->title = g_strdup (title);
g_object_notify_by_pspec (G_OBJECT (page), obj_props[PROP_TITLE]);
}
gboolean
gis_page_get_complete (GisPage *page)
{
- return page->priv->complete;
+ GisPagePrivate *priv = gis_page_get_instance_private (page);
+ return priv->complete;
}
void
gis_page_set_complete (GisPage *page, gboolean complete)
{
- page->priv->complete = complete;
+ GisPagePrivate *priv = gis_page_get_instance_private (page);
+ priv->complete = complete;
g_object_notify_by_pspec (G_OBJECT (page), obj_props[PROP_COMPLETE]);
}
@@ -276,21 +280,22 @@ gis_page_apply_begin (GisPage *page,
gpointer user_data)
{
GisPageClass *klass;
+ GisPagePrivate *priv = gis_page_get_instance_private (page);
g_return_if_fail (GIS_IS_PAGE (page));
- g_return_if_fail (page->priv->applying == FALSE);
+ g_return_if_fail (priv->applying == FALSE);
klass = GIS_PAGE_GET_CLASS (page);
/* Unrefs in gis_page_apply_complete() */
g_object_ref (page);
- page->priv->apply_cb = callback;
- page->priv->apply_data = user_data;
- page->priv->apply_cancel = g_cancellable_new ();
- page->priv->applying = TRUE;
+ priv->apply_cb = callback;
+ priv->apply_data = user_data;
+ priv->apply_cancel = g_cancellable_new ();
+ priv->applying = TRUE;
- if (!klass->apply (page, page->priv->apply_cancel))
+ if (!klass->apply (page, priv->apply_cancel))
{
/* Shortcut case where we don't want apply, to avoid flicker */
gis_page_apply_complete (page, TRUE);
@@ -305,17 +310,18 @@ gis_page_apply_complete (GisPage *page,
{
GisPageApplyCallback callback;
gpointer user_data;
+ GisPagePrivate *priv = gis_page_get_instance_private (page);
g_return_if_fail (GIS_IS_PAGE (page));
- g_return_if_fail (page->priv->applying == TRUE);
+ g_return_if_fail (priv->applying == TRUE);
- callback = page->priv->apply_cb;
- page->priv->apply_cb = NULL;
- user_data = page->priv->apply_data;
- page->priv->apply_data = NULL;
+ callback = priv->apply_cb;
+ priv->apply_cb = NULL;
+ user_data = priv->apply_data;
+ priv->apply_data = NULL;
- g_clear_object (&page->priv->apply_cancel);
- page->priv->applying = FALSE;
+ g_clear_object (&priv->apply_cancel);
+ priv->applying = FALSE;
g_object_notify_by_pspec (G_OBJECT (page), obj_props[PROP_APPLYING]);
if (callback)
@@ -328,18 +334,15 @@ gis_page_apply_complete (GisPage *page,
gboolean
gis_page_get_applying (GisPage *page)
{
- g_return_val_if_fail (GIS_IS_PAGE (page), FALSE);
-
- return page->priv->applying;
+ GisPagePrivate *priv = gis_page_get_instance_private (page);
+ return priv->applying;
}
void
gis_page_apply_cancel (GisPage *page)
{
- g_return_if_fail (GIS_IS_PAGE (page));
- g_return_if_fail (page->priv->applying == TRUE);
-
- g_cancellable_cancel (page->priv->apply_cancel);
+ GisPagePrivate *priv = gis_page_get_instance_private (page);
+ g_cancellable_cancel (priv->apply_cancel);
}
void
diff --git a/gnome-initial-setup/gis-page.h b/gnome-initial-setup/gis-page.h
index 4c9ab9d..17452ea 100644
--- a/gnome-initial-setup/gis-page.h
+++ b/gnome-initial-setup/gis-page.h
@@ -37,7 +37,6 @@ G_BEGIN_DECLS
typedef struct _GisPage GisPage;
typedef struct _GisPageClass GisPageClass;
-typedef struct _GisPagePrivate GisPagePrivate;
typedef struct _GisAssistantPagePrivate GisAssistantPagePrivate;
typedef void (* GisPageApplyCallback) (GisPage *page,
@@ -51,7 +50,6 @@ struct _GisPage
GisDriver *driver;
GtkBuilder *builder;
- GisPagePrivate *priv;
GisAssistantPagePrivate *assistant_priv;
};
diff --git a/gnome-initial-setup/pages/account/gis-account-page.c
b/gnome-initial-setup/pages/account/gis-account-page.c
index ebbc118..fcd1418 100644
--- a/gnome-initial-setup/pages/account/gis-account-page.c
+++ b/gnome-initial-setup/pages/account/gis-account-page.c
@@ -53,10 +53,6 @@ static void on_realm_joined (GObject *source,
GAsyncResult *result,
gpointer user_data);
-G_DEFINE_TYPE (GisAccountPage, gis_account_page, GIS_TYPE_PAGE);
-
-#define GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GIS_TYPE_ACCOUNT_PAGE, GisAccountPagePrivate))
-
typedef enum {
UM_LOCAL,
UM_ENTERPRISE,
@@ -89,6 +85,9 @@ struct _GisAccountPagePrivate
GtkWidget *action;
};
+typedef struct _GisAccountPagePrivate GisAccountPagePrivate;
+
+G_DEFINE_TYPE_WITH_PRIVATE (GisAccountPage, gis_account_page, GIS_TYPE_PAGE);
#define OBJ(type,name) ((type)gtk_builder_get_object(GIS_PAGE (page)->builder,(name)))
#define WID(name) OBJ(GtkWidget*,name)
@@ -122,7 +121,7 @@ show_error_dialog (GisAccountPage *page,
static void
clear_account_page (GisAccountPage *page)
{
- GisAccountPagePrivate *priv = page->priv;
+ GisAccountPagePrivate *priv = gis_account_page_get_instance_private (page);
GtkWidget *fullname_entry;
GtkWidget *username_combo;
GtkWidget *password_entry;
@@ -149,7 +148,7 @@ clear_account_page (GisAccountPage *page)
static gboolean
local_validate (GisAccountPage *page)
{
- GisAccountPagePrivate *priv = page->priv;
+ GisAccountPagePrivate *priv = gis_account_page_get_instance_private (page);
return priv->valid_name &&
priv->valid_username &&
@@ -182,7 +181,8 @@ enterprise_validate (GisAccountPage *page)
static gboolean
page_validate (GisAccountPage *page)
{
- GisAccountPagePrivate *priv = page->priv;
+ GisAccountPagePrivate *priv = gis_account_page_get_instance_private (page);
+
switch (priv->mode) {
case UM_LOCAL:
return local_validate (page);
@@ -203,7 +203,7 @@ static void
set_mode (GisAccountPage *page,
UmAccountMode mode)
{
- GisAccountPagePrivate *priv = page->priv;
+ GisAccountPagePrivate *priv = gis_account_page_get_instance_private (page);
GtkWidget *nb;
if (priv->mode == mode)
@@ -221,7 +221,7 @@ static void
set_has_enterprise (GisAccountPage *page,
gboolean has_enterprise)
{
- GisAccountPagePrivate *priv = page->priv;
+ GisAccountPagePrivate *priv = gis_account_page_get_instance_private (page);
if (priv->has_enterprise == has_enterprise)
return;
@@ -237,7 +237,7 @@ set_has_enterprise (GisAccountPage *page,
static void
update_valid_confirm (GisAccountPage *page)
{
- GisAccountPagePrivate *priv = page->priv;
+ GisAccountPagePrivate *priv = gis_account_page_get_instance_private (page);
const gchar *password, *verify;
password = gtk_entry_get_text (GTK_ENTRY (WID("account-password-entry")));
@@ -251,7 +251,7 @@ fullname_changed (GtkWidget *w,
GParamSpec *pspec,
GisAccountPage *page)
{
- GisAccountPagePrivate *priv = page->priv;
+ GisAccountPagePrivate *priv = gis_account_page_get_instance_private (page);
GtkWidget *combo;
GtkWidget *entry;
GtkTreeModel *model;
@@ -283,7 +283,7 @@ static void
username_changed (GtkComboBoxText *combo,
GisAccountPage *page)
{
- GisAccountPagePrivate *priv = page->priv;
+ GisAccountPagePrivate *priv = gis_account_page_get_instance_private (page);
const gchar *username;
gchar *tip;
GtkWidget *entry;
@@ -313,7 +313,7 @@ static gboolean
reason_timeout_cb (gpointer data)
{
GisAccountPage *page = GIS_ACCOUNT_PAGE (data);
- GisAccountPagePrivate *priv = page->priv;
+ GisAccountPagePrivate *priv = gis_account_page_get_instance_private (page);
GtkWidget *password_entry;
GtkWidget *confirm_entry;
const gchar *password;
@@ -340,7 +340,7 @@ reason_timeout_cb (gpointer data)
static void
refresh_reason_timeout (GisAccountPage *page)
{
- GisAccountPagePrivate *priv = page->priv;
+ GisAccountPagePrivate *priv = gis_account_page_get_instance_private (page);
if (priv->reason_timeout != 0)
g_source_remove (priv->reason_timeout);
@@ -351,7 +351,7 @@ refresh_reason_timeout (GisAccountPage *page)
static void
update_password_entries (GisAccountPage *page)
{
- GisAccountPagePrivate *priv = page->priv;
+ GisAccountPagePrivate *priv = gis_account_page_get_instance_private (page);
const gchar *password;
const gchar *username;
GtkWidget *password_entry;
@@ -413,8 +413,10 @@ password_entry_focus_out (GtkWidget *widget,
GdkEventFocus *event,
GisAccountPage *page)
{
- if (page->priv->reason_timeout != 0)
- g_source_remove (page->priv->reason_timeout);
+ GisAccountPagePrivate *priv = gis_account_page_get_instance_private (page);
+
+ if (priv->reason_timeout != 0)
+ g_source_remove (priv->reason_timeout);
return FALSE;
}
@@ -424,7 +426,7 @@ confirm_entry_focus_out (GtkWidget *widget,
GdkEventFocus *event,
GisAccountPage *page)
{
- GisAccountPagePrivate *priv = page->priv;
+ GisAccountPagePrivate *priv = gis_account_page_get_instance_private (page);
GtkEntry *entry = GTK_ENTRY (widget);
const gchar *verify;
@@ -441,7 +443,7 @@ confirm_entry_focus_out (GtkWidget *widget,
static void
local_create_user (GisAccountPage *page)
{
- GisAccountPagePrivate *priv = page->priv;
+ GisAccountPagePrivate *priv = gis_account_page_get_instance_private (page);
const gchar *username;
const gchar *password;
const gchar *fullname;
@@ -481,8 +483,7 @@ on_permit_user_login (GObject *source,
gpointer user_data)
{
GisAccountPage *page = user_data;
- GisAccountPagePrivate *priv = page->priv;
-
+ GisAccountPagePrivate *priv = gis_account_page_get_instance_private (page);
UmRealmCommon *common;
GError *error = NULL;
gchar *login;
@@ -516,6 +517,7 @@ on_permit_user_login (GObject *source,
static void
enterprise_permit_user_login (GisAccountPage *page, UmRealmObject *realm)
{
+ GisAccountPagePrivate *priv = gis_account_page_get_instance_private (page);
UmRealmCommon *common;
gchar *login;
const gchar *add[2];
@@ -536,7 +538,7 @@ enterprise_permit_user_login (GisAccountPage *page, UmRealmObject *realm)
um_realm_common_call_change_login_policy (common, "",
add, remove, options,
- page->priv->cancellable,
+ priv->cancellable,
on_permit_user_login,
page);
@@ -550,6 +552,7 @@ on_set_static_hostname (GObject *source,
gpointer user_data)
{
GisAccountPage *page = user_data;
+ GisAccountPagePrivate *priv = gis_account_page_get_instance_private (page);
GError *error = NULL;
GVariant *retval;
const gchar *name;
@@ -567,9 +570,9 @@ on_set_static_hostname (GObject *source,
g_debug ("Logging in as admin user: %s", name);
/* Prompted for some admin credentials, try to use them to log in */
- um_realm_login (page->priv->realm, name,
+ um_realm_login (priv->realm, name,
gtk_entry_get_text (OBJ (GtkEntry *, "join-password")),
- page->priv->cancellable, on_join_login, page);
+ priv->cancellable, on_join_login, page);
}
static void
@@ -578,6 +581,7 @@ on_join_response (GtkDialog *dialog,
gpointer user_data)
{
GisAccountPage *page = user_data;
+ GisAccountPagePrivate *priv = gis_account_page_get_instance_private (page);
GDBusConnection *connection;
GError *error = NULL;
gchar hostname[128];
@@ -594,7 +598,7 @@ on_join_response (GtkDialog *dialog,
!g_str_equal (name, hostname)) {
g_debug ("Setting StaticHostname to '%s'", name);
- connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, page->priv->cancellable, &error);
+ connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, priv->cancellable, &error);
if (error != NULL) {
gis_page_apply_complete (GIS_PAGE (page), FALSE);
g_warning ("Could not get DBus connection: %s", error->message);
@@ -615,7 +619,7 @@ on_join_response (GtkDialog *dialog,
g_debug ("Logging in as admin user: %s", name);
/* Prompted for some admin credentials, try to use them to log in */
- um_realm_login (page->priv->realm, name,
+ um_realm_login (priv->realm, name,
gtk_entry_get_text (OBJ (GtkEntry *, "join-password")),
NULL, on_join_login, page);
}
@@ -625,6 +629,7 @@ static void
join_show_prompt (GisAccountPage *page,
GError *error)
{
+ GisAccountPagePrivate *priv = gis_account_page_get_instance_private (page);
UmRealmKerberosMembership *membership;
UmRealmKerberos *kerberos;
gchar hostname[128];
@@ -644,8 +649,8 @@ join_show_prompt (GisAccountPage *page,
gtk_entry_set_text (join_password, "");
gtk_widget_grab_focus (GTK_WIDGET (join_password));
- kerberos = um_realm_object_get_kerberos (page->priv->realm);
- membership = um_realm_object_get_kerberos_membership (page->priv->realm);
+ kerberos = um_realm_object_get_kerberos (priv->realm);
+ membership = um_realm_object_get_kerberos_membership (priv->realm);
gtk_label_set_text (join_domain,
um_realm_kerberos_get_domain_name (kerberos));
@@ -656,7 +661,7 @@ join_show_prompt (GisAccountPage *page,
clear_entry_validation_error (join_name);
clear_entry_validation_error (join_password);
- if (!page->priv->join_prompted) {
+ if (!priv->join_prompted) {
name = um_realm_kerberos_membership_get_suggested_administrator (membership);
if (name && !g_str_equal (name, "")) {
g_debug ("Suggesting admin user: %s", name);
@@ -685,7 +690,7 @@ join_show_prompt (GisAccountPage *page,
gtk_window_set_modal (GTK_WINDOW (join_dialog), TRUE);
gtk_window_present (GTK_WINDOW (join_dialog));
- page->priv->join_prompted = TRUE;
+ priv->join_prompted = TRUE;
g_object_unref (kerberos);
g_object_unref (membership);
@@ -698,14 +703,15 @@ on_join_login (GObject *source,
gpointer user_data)
{
GisAccountPage *page = user_data;
+ GisAccountPagePrivate *priv = gis_account_page_get_instance_private (page);
GError *error = NULL;
GBytes *creds;
- um_realm_login_finish (page->priv->realm, result, &creds, &error);
+ um_realm_login_finish (priv->realm, result, &creds, &error);
/* Logged in as admin successfully, use creds to join domain */
if (error == NULL) {
- if (!um_realm_join_as_admin (page->priv->realm,
+ if (!um_realm_join_as_admin (priv->realm,
gtk_entry_get_text (OBJ (GtkEntry *, "join-name")),
gtk_entry_get_text (OBJ (GtkEntry *, "join-password")),
creds, NULL, on_realm_joined, page)) {
@@ -729,14 +735,15 @@ on_realm_joined (GObject *source,
gpointer user_data)
{
GisAccountPage *page = user_data;
+ GisAccountPagePrivate *priv = gis_account_page_get_instance_private (page);
GError *error = NULL;
- um_realm_join_finish (page->priv->realm, result, &error);
+ um_realm_join_finish (priv->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, page->priv->realm);
+ enterprise_permit_user_login (page, priv->realm);
/* Credential failure while joining domain, prompt for admin creds */
} else if (g_error_matches (error, UM_REALM_ERROR, UM_REALM_ERROR_BAD_LOGIN) ||
@@ -762,10 +769,11 @@ on_realm_login (GObject *source,
gpointer user_data)
{
GisAccountPage *page = user_data;
+ GisAccountPagePrivate *priv = gis_account_page_get_instance_private (page);
GError *error = NULL;
GBytes *creds = NULL;
- um_realm_login_finish (page->priv->realm, result, &creds, &error);
+ um_realm_login_finish (priv->realm, result, &creds, &error);
/*
* User login is valid, but cannot authenticate right now (eg: user needs
@@ -779,16 +787,16 @@ on_realm_login (GObject *source,
if (error == NULL) {
/* Already joined to the domain, just register this user */
- if (um_realm_is_configured (page->priv->realm)) {
+ if (um_realm_is_configured (priv->realm)) {
g_debug ("Already joined to this realm");
- enterprise_permit_user_login (page, page->priv->realm);
+ enterprise_permit_user_login (page, priv->realm);
/* Join the domain, try using the user's creds */
} else if (creds == NULL ||
- !um_realm_join_as_user (page->priv->realm,
+ !um_realm_join_as_user (priv->realm,
gtk_entry_get_text (OBJ (GtkEntry *, "enterprise-login")),
gtk_entry_get_text (OBJ (GtkEntry *, "enterprise-password")),
- creds, page->priv->cancellable,
+ creds, priv->cancellable,
on_realm_joined,
page)) {
@@ -826,12 +834,14 @@ on_realm_login (GObject *source,
static void
enterprise_check_login (GisAccountPage *page)
{
- g_assert (page->priv->realm);
+ GisAccountPagePrivate *priv = gis_account_page_get_instance_private (page);
+
+ g_assert (priv->realm);
- um_realm_login (page->priv->realm,
+ um_realm_login (priv->realm,
gtk_entry_get_text (OBJ (GtkEntry *, "enterprise-login")),
gtk_entry_get_text (OBJ (GtkEntry *, "enterprise-password")),
- page->priv->cancellable,
+ priv->cancellable,
on_realm_login,
page);
}
@@ -842,7 +852,7 @@ on_realm_discover_input (GObject *source,
gpointer user_data)
{
GisAccountPage *page = user_data;
- GisAccountPagePrivate *priv = page->priv;
+ GisAccountPagePrivate *priv = gis_account_page_get_instance_private (page);
GError *error = NULL;
GList *realms;
@@ -870,7 +880,7 @@ on_realm_discover_input (GObject *source,
static void
enterprise_add_user (GisAccountPage *page)
{
- GisAccountPagePrivate *priv = page->priv;
+ GisAccountPagePrivate *priv = gis_account_page_get_instance_private (page);
GtkTreeIter iter;
GtkComboBox *domain = OBJ(GtkComboBox*, "enterprise-domain");
@@ -936,7 +946,7 @@ static void
enterprise_add_realm (GisAccountPage *page,
UmRealmObject *realm)
{
- GisAccountPagePrivate *priv = page->priv;
+ GisAccountPagePrivate *priv = gis_account_page_get_instance_private (page);
GtkTreeIter iter;
GtkComboBox *domain = OBJ(GtkComboBox*, "enterprise-domain");
GtkTreeModel *model = OBJ(GtkTreeModel*, "enterprise-realms-model");
@@ -983,7 +993,7 @@ on_realm_manager_created (GObject *source,
gpointer user_data)
{
GisAccountPage *page = user_data;
- GisAccountPagePrivate *priv = page->priv;
+ GisAccountPagePrivate *priv = gis_account_page_get_instance_private (page);
GError *error = NULL;
GList *realms, *l;
@@ -1026,7 +1036,7 @@ on_realmd_disappeared (GDBusConnection *unused1,
gpointer user_data)
{
GisAccountPage *page = user_data;
- GisAccountPagePrivate *priv = page->priv;
+ GisAccountPagePrivate *priv = gis_account_page_get_instance_private (page);
if (priv->realm_manager != NULL) {
g_signal_handlers_disconnect_by_func (priv->realm_manager,
@@ -1043,7 +1053,9 @@ on_domain_changed (GtkComboBox *widget,
gpointer user_data)
{
GisAccountPage *page = user_data;
- page->priv->domain_chosen = TRUE;
+ GisAccountPagePrivate *priv = gis_account_page_get_instance_private (page);
+
+ priv->domain_chosen = TRUE;
update_account_page_status (page);
clear_entry_validation_error (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (widget))));
}
@@ -1070,13 +1082,13 @@ gis_account_page_apply (GisPage *gis_page,
GCancellable *cancellable)
{
GisAccountPage *page = GIS_ACCOUNT_PAGE (gis_page);
- GisAccountPagePrivate *priv = page->priv;
+ GisAccountPagePrivate *priv = gis_account_page_get_instance_private (page);
switch (priv->mode) {
case UM_LOCAL:
return FALSE;
case UM_ENTERPRISE:
- page->priv->cancellable = g_object_ref (cancellable);
+ priv->cancellable = g_object_ref (cancellable);
enterprise_add_user (page);
return TRUE;
default:
@@ -1088,7 +1100,7 @@ static void
gis_account_page_save_data (GisPage *gis_page)
{
GisAccountPage *page = GIS_ACCOUNT_PAGE (gis_page);
- GisAccountPagePrivate *priv = page->priv;
+ GisAccountPagePrivate *priv = gis_account_page_get_instance_private (page);
switch (priv->mode) {
case UM_LOCAL:
@@ -1105,8 +1117,7 @@ static void
gis_account_page_constructed (GObject *object)
{
GisAccountPage *page = GIS_ACCOUNT_PAGE (object);
- GisAccountPagePrivate *priv = page->priv;
-
+ GisAccountPagePrivate *priv = gis_account_page_get_instance_private (page);
GtkWidget *fullname_entry;
GtkWidget *username_combo;
GtkWidget *password_entry;
@@ -1169,7 +1180,8 @@ static void
gis_account_page_dispose (GObject *object)
{
GisAccountPage *page = GIS_ACCOUNT_PAGE (object);
- GisAccountPagePrivate *priv = page->priv;
+ GisAccountPagePrivate *priv = gis_account_page_get_instance_private (page);
+
if (priv->realmd_watch)
g_bus_unwatch_name (priv->realmd_watch);
@@ -1188,7 +1200,9 @@ gis_account_page_dispose (GObject *object)
static GtkWidget *
gis_account_page_get_action_widget (GisPage *page)
{
- return GIS_ACCOUNT_PAGE (page)->priv->action;
+ GisAccountPage *account = GIS_ACCOUNT_PAGE (page);
+ GisAccountPagePrivate *priv = gis_account_page_get_instance_private (account);
+ return priv->action;
}
static void
@@ -1210,15 +1224,12 @@ gis_account_page_class_init (GisAccountPageClass *klass)
page_class->save_data = gis_account_page_save_data;
object_class->constructed = gis_account_page_constructed;
object_class->dispose = gis_account_page_dispose;
-
- g_type_class_add_private (object_class, sizeof(GisAccountPagePrivate));
}
static void
gis_account_page_init (GisAccountPage *page)
{
g_resources_register (account_get_resource ());
- page->priv = GET_PRIVATE (page);
}
void
diff --git a/gnome-initial-setup/pages/account/gis-account-page.h
b/gnome-initial-setup/pages/account/gis-account-page.h
index 496da21..ed22eef 100644
--- a/gnome-initial-setup/pages/account/gis-account-page.h
+++ b/gnome-initial-setup/pages/account/gis-account-page.h
@@ -39,13 +39,10 @@ G_BEGIN_DECLS
typedef struct _GisAccountPage GisAccountPage;
typedef struct _GisAccountPageClass GisAccountPageClass;
-typedef struct _GisAccountPagePrivate GisAccountPagePrivate;
struct _GisAccountPage
{
GisPage parent;
-
- GisAccountPagePrivate *priv;
};
struct _GisAccountPageClass
diff --git a/gnome-initial-setup/pages/eulas/gis-eula-page.c b/gnome-initial-setup/pages/eulas/gis-eula-page.c
index ae5b13f..25e9249 100644
--- a/gnome-initial-setup/pages/eulas/gis-eula-page.c
+++ b/gnome-initial-setup/pages/eulas/gis-eula-page.c
@@ -34,10 +34,6 @@
#include <gio/gio.h>
#include <gtk/gtk.h>
-G_DEFINE_TYPE (GisEulaPage, gis_eula_page, GIS_TYPE_PAGE);
-
-#define GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GIS_TYPE_EULA_PAGE, GisEulaPagePrivate))
-
struct _GisEulaPagePrivate
{
GFile *eula;
@@ -48,6 +44,9 @@ struct _GisEulaPagePrivate
gboolean require_checkbox;
gboolean require_scroll;
};
+typedef struct _GisEulaPagePrivate GisEulaPagePrivate;
+
+G_DEFINE_TYPE_WITH_PRIVATE (GisEulaPage, gis_eula_page, GIS_TYPE_PAGE);
#define OBJ(type,name) ((type)gtk_builder_get_object(GIS_PAGE(page)->builder,(name)))
#define WID(name) OBJ(GtkWidget*,name)
@@ -163,7 +162,7 @@ build_eula_text_view (GFile *eula)
static gboolean
get_page_complete (GisEulaPage *page)
{
- GisEulaPagePrivate *priv = page->priv;
+ GisEulaPagePrivate *priv = gis_eula_page_get_instance_private (page);
if (priv->require_checkbox) {
GtkToggleButton *checkbox = GTK_TOGGLE_BUTTON (priv->checkbox);
@@ -223,7 +222,7 @@ static void
gis_eula_page_constructed (GObject *object)
{
GisEulaPage *page = GIS_EULA_PAGE (object);
- GisEulaPagePrivate *priv = page->priv;
+ GisEulaPagePrivate *priv = gis_eula_page_get_instance_private (page);
GtkWidget *text_view;
gboolean require_checkbox = FALSE;
@@ -275,7 +274,8 @@ gis_eula_page_get_property (GObject *object,
GParamSpec *pspec)
{
GisEulaPage *page = GIS_EULA_PAGE (object);
- GisEulaPagePrivate *priv = page->priv;
+ GisEulaPagePrivate *priv = gis_eula_page_get_instance_private (page);
+
switch (prop_id)
{
case PROP_EULA:
@@ -294,7 +294,8 @@ gis_eula_page_set_property (GObject *object,
GParamSpec *pspec)
{
GisEulaPage *page = GIS_EULA_PAGE (object);
- GisEulaPagePrivate *priv = page->priv;
+ GisEulaPagePrivate *priv = gis_eula_page_get_instance_private (page);
+
switch (prop_id)
{
case PROP_EULA:
@@ -310,7 +311,7 @@ static void
gis_eula_page_dispose (GObject *object)
{
GisEulaPage *page = GIS_EULA_PAGE (object);
- GisEulaPagePrivate *priv = page->priv;
+ GisEulaPagePrivate *priv = gis_eula_page_get_instance_private (page);
g_clear_object (&priv->eula);
@@ -342,13 +343,10 @@ gis_eula_page_class_init (GisEulaPageClass *klass)
G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
g_object_class_install_properties (object_class, PROP_LAST, obj_props);
-
- g_type_class_add_private (object_class, sizeof(GisEulaPagePrivate));
}
static void
gis_eula_page_init (GisEulaPage *page)
{
g_resources_register (eulas_get_resource ());
- page->priv = GET_PRIVATE (page);
}
diff --git a/gnome-initial-setup/pages/eulas/gis-eula-page.h b/gnome-initial-setup/pages/eulas/gis-eula-page.h
index 46b5166..2ed2981 100644
--- a/gnome-initial-setup/pages/eulas/gis-eula-page.h
+++ b/gnome-initial-setup/pages/eulas/gis-eula-page.h
@@ -39,13 +39,10 @@ G_BEGIN_DECLS
typedef struct _GisEulaPage GisEulaPage;
typedef struct _GisEulaPageClass GisEulaPageClass;
-typedef struct _GisEulaPagePrivate GisEulaPagePrivate;
struct _GisEulaPage
{
GisPage parent;
-
- GisEulaPagePrivate *priv;
};
struct _GisEulaPageClass
diff --git a/gnome-initial-setup/pages/goa/gis-goa-page.c b/gnome-initial-setup/pages/goa/gis-goa-page.c
index df93195..4a6f826 100644
--- a/gnome-initial-setup/pages/goa/gis-goa-page.c
+++ b/gnome-initial-setup/pages/goa/gis-goa-page.c
@@ -41,15 +41,14 @@
#include <glib/gi18n.h>
#include <gio/gio.h>
-G_DEFINE_TYPE (GisGoaPage, gis_goa_page, GIS_TYPE_PAGE);
-
-#define GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GIS_TYPE_GOA_PAGE, GisGoaPagePrivate))
-
struct _GisGoaPagePrivate {
GoaClient *goa_client;
GtkWidget *dialog;
gboolean accounts_exist;
};
+typedef struct _GisGoaPagePrivate GisGoaPagePrivate;
+
+G_DEFINE_TYPE_WITH_PRIVATE (GisGoaPage, gis_goa_page, GIS_TYPE_PAGE);
#define OBJ(type,name) ((type)gtk_builder_get_object(GIS_PAGE(page)->builder,(name)))
#define WID(name) OBJ(GtkWidget*,name)
@@ -63,7 +62,7 @@ on_have_providers (GObject *source,
GList *l;
GError *error = NULL;
GisGoaPage *page = GIS_GOA_PAGE (user_data);
- GisGoaPagePrivate *priv = page->priv;
+ GisGoaPagePrivate *priv = gis_goa_page_get_instance_private (page);
if (!goa_provider_get_all_finish (&providers, res, &error))
goto out;
@@ -92,7 +91,7 @@ show_online_account_dialog (GtkButton *button,
gpointer user_data)
{
GisGoaPage *page = GIS_GOA_PAGE (user_data);
- GisGoaPagePrivate *priv = page->priv;
+ GisGoaPagePrivate *priv = gis_goa_page_get_instance_private (page);
GtkWindow *parent;
GtkWidget *dialog;
gint response;
@@ -201,7 +200,7 @@ confirm_remove_account (GtkButton *button, gpointer user_data)
static void
update_visibility (GisGoaPage *page)
{
- GisGoaPagePrivate *priv = page->priv;
+ GisGoaPagePrivate *priv = gis_goa_page_get_instance_private (page);
GList *accounts;
accounts = goa_client_get_accounts (priv->goa_client);
@@ -304,7 +303,7 @@ remove_account_from_list (GisGoaPage *page, GoaObject *object)
static void
populate_account_list (GisGoaPage *page)
{
- GisGoaPagePrivate *priv = page->priv;
+ GisGoaPagePrivate *priv = gis_goa_page_get_instance_private (page);
GList *accounts, *l;
GoaObject *object;
@@ -347,7 +346,7 @@ network_status_changed (GNetworkMonitor *monitor,
gpointer user_data)
{
GisGoaPage *page = GIS_GOA_PAGE (user_data);
- GisGoaPagePrivate *priv = page->priv;
+ GisGoaPagePrivate *priv = gis_goa_page_get_instance_private (page);
GisAssistant *assistant = gis_driver_get_assistant (GIS_PAGE (page)->driver);
/* Ignore the network change if we're the current page or if an account
@@ -382,7 +381,7 @@ static void
gis_goa_page_constructed (GObject *object)
{
GisGoaPage *page = GIS_GOA_PAGE (object);
- GisGoaPagePrivate *priv = page->priv;
+ GisGoaPagePrivate *priv = gis_goa_page_get_instance_private (page);
GtkWidget *button;
GError *error = NULL;
GNetworkMonitor *network_monitor = g_network_monitor_get_default ();
@@ -433,7 +432,7 @@ static void
gis_goa_page_dispose (GObject *object)
{
GisGoaPage *page = GIS_GOA_PAGE (object);
- GisGoaPagePrivate *priv = page->priv;
+ GisGoaPagePrivate *priv = gis_goa_page_get_instance_private (page);
GNetworkMonitor *network_monitor = g_network_monitor_get_default ();
g_clear_object (&priv->goa_client);
@@ -459,15 +458,12 @@ gis_goa_page_class_init (GisGoaPageClass *klass)
page_class->locale_changed = gis_goa_page_locale_changed;
object_class->constructed = gis_goa_page_constructed;
object_class->dispose = gis_goa_page_dispose;
-
- g_type_class_add_private (object_class, sizeof(GisGoaPagePrivate));
}
static void
gis_goa_page_init (GisGoaPage *page)
{
g_resources_register (goa_get_resource ());
- page->priv = GET_PRIVATE (page);
}
void
diff --git a/gnome-initial-setup/pages/goa/gis-goa-page.h b/gnome-initial-setup/pages/goa/gis-goa-page.h
index 6824c16..c5e1bb3 100644
--- a/gnome-initial-setup/pages/goa/gis-goa-page.h
+++ b/gnome-initial-setup/pages/goa/gis-goa-page.h
@@ -37,13 +37,10 @@ G_BEGIN_DECLS
typedef struct _GisGoaPage GisGoaPage;
typedef struct _GisGoaPageClass GisGoaPageClass;
-typedef struct _GisGoaPagePrivate GisGoaPagePrivate;
struct _GisGoaPage
{
GisPage parent;
-
- GisGoaPagePrivate *priv;
};
struct _GisGoaPageClass
diff --git a/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c
b/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c
index 7d89d87..39541d3 100644
--- a/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c
+++ b/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c
@@ -57,10 +57,6 @@
#define MAX_INPUT_ROWS_VISIBLE 5
-G_DEFINE_TYPE (GisKeyboardPage, gis_keyboard_page, GIS_TYPE_PAGE)
-
-#define KEYBOARD_PAGE_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GIS_TYPE_KEYBOARD_PAGE,
GisKeyboardPagePrivate))
-
struct _GisKeyboardPagePrivate {
GDBusProxy *localed;
GCancellable *cancellable;
@@ -85,15 +81,18 @@ struct _GisKeyboardPagePrivate {
GCancellable *ibus_cancellable;
#endif
};
+typedef struct _GisKeyboardPagePrivate GisKeyboardPagePrivate;
#define OBJ(type,name) ((type)gtk_builder_get_object(GIS_PAGE (self)->builder,(name)))
#define WID(name) OBJ(GtkWidget*,name)
+G_DEFINE_TYPE_WITH_PRIVATE (GisKeyboardPage, gis_keyboard_page, GIS_TYPE_PAGE);
+
static void
gis_keyboard_page_finalize (GObject *object)
{
GisKeyboardPage *self = GIS_KEYBOARD_PAGE (object);
- GisKeyboardPagePrivate *priv = self->priv;
+ GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self);
g_cancellable_cancel (priv->cancellable);
g_clear_object (&priv->cancellable);
@@ -130,7 +129,7 @@ static void
gis_keyboard_page_constructed (GObject *object)
{
GisKeyboardPage *self = GIS_KEYBOARD_PAGE (object);
- GisKeyboardPagePrivate *priv = self->priv;
+ GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self);
GisAssistant *assistant = gis_driver_get_assistant (GIS_PAGE (self)->driver);
G_OBJECT_CLASS (gis_keyboard_page_parent_class)->constructed (object);
@@ -173,8 +172,6 @@ gis_keyboard_page_class_init (GisKeyboardPageClass * klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GisPageClass * page_class = GIS_PAGE_CLASS (klass);
- g_type_class_add_private (klass, sizeof (GisKeyboardPagePrivate));
-
page_class->page_id = PAGE_ID;
page_class->locale_changed = gis_keyboard_page_locale_changed;
@@ -206,7 +203,7 @@ static void remove_selected_input (GisKeyboardPage *self);
static void
update_ibus_active_sources (GisKeyboardPage *self)
{
- GisKeyboardPagePrivate *priv = self->priv;
+ GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self);
GList *rows, *l;
GtkWidget *row;
const gchar *type;
@@ -237,7 +234,7 @@ update_ibus_active_sources (GisKeyboardPage *self)
static void
update_input_chooser (GisKeyboardPage *self)
{
- GisKeyboardPagePrivate *priv = self->priv;
+ GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self);
GtkWidget *chooser;
chooser = g_object_get_data (G_OBJECT (self), "input-chooser");
@@ -252,7 +249,7 @@ fetch_ibus_engines_result (GObject *object,
GAsyncResult *result,
GisKeyboardPage *self)
{
- GisKeyboardPagePrivate *priv = self->priv;
+ GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self);
GList *list, *l;
GError *error;
@@ -286,7 +283,7 @@ fetch_ibus_engines_result (GObject *object,
static void
fetch_ibus_engines (GisKeyboardPage *self)
{
- GisKeyboardPagePrivate *priv = self->priv;
+ GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self);
priv->ibus_cancellable = g_cancellable_new ();
@@ -337,7 +334,7 @@ setup_app_info_for_id (const gchar *id)
static void
adjust_input_list_scrolling (GisKeyboardPage *self)
{
- GisKeyboardPagePrivate *priv = self->priv;
+ GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self);
if (priv->n_input_rows >= MAX_INPUT_ROWS_VISIBLE) {
GtkWidget *parent;
@@ -363,7 +360,7 @@ add_input_row (GisKeyboardPage *self,
const gchar *name,
GDesktopAppInfo *app_info)
{
- GisKeyboardPagePrivate *priv = self->priv;
+ GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self);
GtkWidget *row;
GtkWidget *label;
GtkWidget *image;
@@ -388,7 +385,7 @@ add_input_row (GisKeyboardPage *self,
}
gtk_widget_show_all (row);
- gtk_container_add (GTK_CONTAINER (self->priv->input_list), row);
+ gtk_container_add (GTK_CONTAINER (priv->input_list), row);
g_object_set_data (G_OBJECT (row), "label", label);
g_object_set_data (G_OBJECT (row), "type", (gpointer)type);
@@ -408,7 +405,7 @@ add_input_source (GisKeyboardPage *self,
const gchar *type,
const gchar *id)
{
- GisKeyboardPagePrivate *priv = self->priv;
+ GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self);
const gchar *name;
gchar *display_name;
GDesktopAppInfo *app_info;
@@ -462,7 +459,7 @@ add_input_sources (GisKeyboardPage *self,
static void
add_input_sources_from_settings (GisKeyboardPage *self)
{
- GisKeyboardPagePrivate *priv = self->priv;
+ GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self);
GVariant *sources;
sources = g_settings_get_value (priv->input_settings, "sources");
add_input_sources (self, sources);
@@ -472,7 +469,7 @@ add_input_sources_from_settings (GisKeyboardPage *self)
static void
clear_input_sources (GisKeyboardPage *self)
{
- GisKeyboardPagePrivate *priv = self->priv;
+ GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self);
GList *list, *l;
list = gtk_container_get_children (GTK_CONTAINER (priv->input_list));
for (l = list; l; l = l->next) {
@@ -500,7 +497,9 @@ static void
select_input (GisKeyboardPage *self,
const gchar *id)
{
- gtk_container_foreach (GTK_CONTAINER (self->priv->input_list),
+ GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self);
+
+ gtk_container_foreach (GTK_CONTAINER (priv->input_list),
select_by_id, (gpointer)id);
}
@@ -509,7 +508,7 @@ input_sources_changed (GSettings *settings,
const gchar *key,
GisKeyboardPage *self)
{
- GisKeyboardPagePrivate *priv = self->priv;
+ GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self);
GtkWidget *selected;
gchar *id = NULL;
@@ -528,7 +527,7 @@ input_sources_changed (GSettings *settings,
static void
update_buttons (GisKeyboardPage *self)
{
- GisKeyboardPagePrivate *priv = self->priv;
+ GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self);
GtkWidget *selected;
GList *children;
gboolean multiple_sources;
@@ -556,7 +555,7 @@ update_buttons (GisKeyboardPage *self)
static void
set_input_settings (GisKeyboardPage *self)
{
- GisKeyboardPagePrivate *priv = self->priv;
+ GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self);
const gchar *type;
const gchar *id;
GVariantBuilder builder;
@@ -610,12 +609,11 @@ change_locale_permission_acquired (GObject *source,
GAsyncResult *res,
gpointer data)
{
- GisKeyboardPagePrivate *priv;
+ GisKeyboardPage *page = GIS_KEYBOARD_PAGE (data);
+ GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (page);
GError *error = NULL;
gboolean allowed;
- priv = GIS_KEYBOARD_PAGE (data)->priv;
-
allowed = g_permission_acquire_finish (priv->permission, res, &error);
if (error) {
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
@@ -632,9 +630,7 @@ change_locale_permission_acquired (GObject *source,
static void
update_input (GisKeyboardPage *self)
{
- GisKeyboardPagePrivate *priv;
-
- priv = self->priv;
+ GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self);
set_input_settings (self);
@@ -655,7 +651,7 @@ static gboolean
input_source_already_added (GisKeyboardPage *self,
const gchar *id)
{
- GisKeyboardPagePrivate *priv = self->priv;
+ GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self);
GList *list, *l;
gboolean retval = FALSE;
@@ -709,7 +705,7 @@ input_response (GtkWidget *chooser, gint response_id, gpointer data)
static void
show_input_chooser (GisKeyboardPage *self)
{
- GisKeyboardPagePrivate *priv = self->priv;
+ GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self);
GtkWidget *chooser;
GtkWidget *toplevel;
@@ -768,7 +764,7 @@ out:
static void
do_remove_selected_input (GisKeyboardPage *self)
{
- GisKeyboardPagePrivate *priv = self->priv;
+ GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self);
GtkWidget *selected;
GtkWidget *sibling;
@@ -796,7 +792,7 @@ remove_selected_input (GisKeyboardPage *self)
static void
show_selected_settings (GisKeyboardPage *self)
{
- GisKeyboardPagePrivate *priv = self->priv;
+ GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self);
GtkWidget *selected;
GdkAppLaunchContext *ctx;
GDesktopAppInfo *app_info;
@@ -829,7 +825,7 @@ show_selected_settings (GisKeyboardPage *self)
static void
show_selected_layout (GisKeyboardPage *self)
{
- GisKeyboardPagePrivate *priv = self->priv;
+ GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self);
GtkWidget *selected;
const gchar *type;
const gchar *id;
@@ -924,7 +920,7 @@ add_default_input_source_for_locale (GisKeyboardPage *self)
static void
setup_input_section (GisKeyboardPage *self)
{
- GisKeyboardPagePrivate *priv = self->priv;
+ GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self);
priv->input_settings = g_settings_new (GNOME_DESKTOP_INPUT_SOURCES_DIR);
g_settings_delay (priv->input_settings);
@@ -978,7 +974,7 @@ setup_input_section (GisKeyboardPage *self)
static void
add_input_sources_from_localed (GisKeyboardPage *self)
{
- GisKeyboardPagePrivate *priv = self->priv;
+ GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self);
GVariant *v;
const gchar *s;
gchar **layouts = NULL;
@@ -1034,7 +1030,7 @@ add_input_sources_from_localed (GisKeyboardPage *self)
static void
set_localed_input (GisKeyboardPage *self)
{
- GisKeyboardPagePrivate *priv = self->priv;
+ GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self);
GString *layouts;
GString *variants;
const gchar *type, *id;
@@ -1078,7 +1074,7 @@ localed_proxy_ready (GObject *source,
gpointer data)
{
GisKeyboardPage *self = data;
- GisKeyboardPagePrivate *priv;
+ GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self);
GDBusProxy *proxy;
GError *error = NULL;
@@ -1091,7 +1087,6 @@ localed_proxy_ready (GObject *source,
return;
}
- priv = self->priv;
priv->localed = proxy;
add_input_sources_from_localed (self);
@@ -1101,7 +1096,6 @@ localed_proxy_ready (GObject *source,
static void
gis_keyboard_page_init (GisKeyboardPage *self)
{
- self->priv = KEYBOARD_PAGE_PRIVATE (self);
g_resources_register (keyboard_get_resource ());
}
diff --git a/gnome-initial-setup/pages/keyboard/gis-keyboard-page.h
b/gnome-initial-setup/pages/keyboard/gis-keyboard-page.h
index 807d87c..798836d 100644
--- a/gnome-initial-setup/pages/keyboard/gis-keyboard-page.h
+++ b/gnome-initial-setup/pages/keyboard/gis-keyboard-page.h
@@ -51,13 +51,10 @@ G_BEGIN_DECLS
typedef struct _GisKeyboardPage GisKeyboardPage;
typedef struct _GisKeyboardPageClass GisKeyboardPageClass;
-typedef struct _GisKeyboardPagePrivate GisKeyboardPagePrivate;
struct _GisKeyboardPage
{
GisPage parent;
-
- GisKeyboardPagePrivate *priv;
};
struct _GisKeyboardPageClass
diff --git a/gnome-initial-setup/pages/language/gis-language-page.c
b/gnome-initial-setup/pages/language/gis-language-page.c
index 3fcff01..d7f6bb7 100644
--- a/gnome-initial-setup/pages/language/gis-language-page.c
+++ b/gnome-initial-setup/pages/language/gis-language-page.c
@@ -38,10 +38,6 @@
#include <locale.h>
#include <gtk/gtk.h>
-G_DEFINE_TYPE (GisLanguagePage, gis_language_page, GIS_TYPE_PAGE);
-
-#define GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GIS_TYPE_LANGUAGE_PAGE, GisLanguagePagePrivate))
-
struct _GisLanguagePagePrivate
{
GtkWidget *language_chooser;
@@ -52,6 +48,9 @@ struct _GisLanguagePagePrivate
GCancellable *cancellable;
};
+typedef struct _GisLanguagePagePrivate GisLanguagePagePrivate;
+
+G_DEFINE_TYPE_WITH_PRIVATE (GisLanguagePage, gis_language_page, GIS_TYPE_PAGE);
#define OBJ(type,name) ((type)gtk_builder_get_object(GIS_PAGE (page)->builder,(name)))
#define WID(name) OBJ(GtkWidget*,name)
@@ -59,7 +58,7 @@ struct _GisLanguagePagePrivate
static void
set_localed_locale (GisLanguagePage *self)
{
- GisLanguagePagePrivate *priv = self->priv;
+ GisLanguagePagePrivate *priv = gis_language_page_get_instance_private (self);
GVariantBuilder *b;
gchar *s;
@@ -81,12 +80,11 @@ change_locale_permission_acquired (GObject *source,
GAsyncResult *res,
gpointer data)
{
- GisLanguagePagePrivate *priv;
+ GisLanguagePage *page = GIS_LANGUAGE_PAGE (data);
+ GisLanguagePagePrivate *priv = gis_language_page_get_instance_private (page);
GError *error = NULL;
gboolean allowed;
- priv = GIS_LANGUAGE_PAGE (data)->priv;
-
allowed = g_permission_acquire_finish (priv->permission, res, &error);
if (error) {
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
@@ -96,7 +94,7 @@ change_locale_permission_acquired (GObject *source,
}
if (allowed)
- set_localed_locale (GIS_LANGUAGE_PAGE (data));
+ set_localed_locale (page);
}
static void
@@ -124,7 +122,7 @@ language_changed (CcLanguageChooser *chooser,
GParamSpec *pspec,
GisLanguagePage *page)
{
- GisLanguagePagePrivate *priv = page->priv;
+ GisLanguagePagePrivate *priv = gis_language_page_get_instance_private (page);
ActUser *user;
GisDriver *driver;
@@ -173,7 +171,7 @@ localed_proxy_ready (GObject *source,
gpointer data)
{
GisLanguagePage *self = data;
- GisLanguagePagePrivate *priv;
+ GisLanguagePagePrivate *priv = gis_language_page_get_instance_private (self);
GDBusProxy *proxy;
GError *error = NULL;
@@ -186,15 +184,14 @@ localed_proxy_ready (GObject *source,
return;
}
- priv = self->priv;
priv->localed = proxy;
}
-static void
+ static void
gis_language_page_constructed (GObject *object)
{
GisLanguagePage *page = GIS_LANGUAGE_PAGE (object);
- GisLanguagePagePrivate *priv = page->priv;
+ GisLanguagePagePrivate *priv = gis_language_page_get_instance_private (page);
GDBusConnection *bus;
g_type_ensure (CC_TYPE_LANGUAGE_CHOOSER);
@@ -240,7 +237,7 @@ static void
gis_language_page_dispose (GObject *object)
{
GisLanguagePage *page = GIS_LANGUAGE_PAGE (object);
- GisLanguagePagePrivate *priv = page->priv;
+ GisLanguagePagePrivate *priv = gis_language_page_get_instance_private (page);
g_source_remove (priv->selection_done_source);
g_clear_object (&priv->permission);
@@ -258,15 +255,12 @@ gis_language_page_class_init (GisLanguagePageClass *klass)
page_class->locale_changed = gis_language_page_locale_changed;
object_class->constructed = gis_language_page_constructed;
object_class->dispose = gis_language_page_dispose;
-
- g_type_class_add_private (object_class, sizeof(GisLanguagePagePrivate));
}
static void
gis_language_page_init (GisLanguagePage *page)
{
g_resources_register (language_get_resource ());
- page->priv = GET_PRIVATE (page);
}
void
diff --git a/gnome-initial-setup/pages/language/gis-language-page.h
b/gnome-initial-setup/pages/language/gis-language-page.h
index c2695ad..7f45148 100644
--- a/gnome-initial-setup/pages/language/gis-language-page.h
+++ b/gnome-initial-setup/pages/language/gis-language-page.h
@@ -39,13 +39,10 @@ G_BEGIN_DECLS
typedef struct _GisLanguagePage GisLanguagePage;
typedef struct _GisLanguagePageClass GisLanguagePageClass;
-typedef struct _GisLanguagePagePrivate GisLanguagePagePrivate;
struct _GisLanguagePage
{
GisPage parent;
-
- GisLanguagePagePrivate *priv;
};
struct _GisLanguagePageClass
diff --git a/gnome-initial-setup/pages/location/gis-location-page.c
b/gnome-initial-setup/pages/location/gis-location-page.c
index 359f602..f93b96a 100644
--- a/gnome-initial-setup/pages/location/gis-location-page.c
+++ b/gnome-initial-setup/pages/location/gis-location-page.c
@@ -44,16 +44,15 @@
#define DEFAULT_TZ "Europe/London"
-G_DEFINE_TYPE (GisLocationPage, gis_location_page, GIS_TYPE_PAGE);
-
-#define GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GIS_TYPE_LOCATION_PAGE, GisLocationPagePrivate))
-
struct _GisLocationPagePrivate
{
CcTimezoneMap *map;
TzLocation *current_location;
Timedate1 *dtm;
};
+typedef struct _GisLocationPagePrivate GisLocationPagePrivate;
+
+G_DEFINE_TYPE_WITH_PRIVATE (GisLocationPage, gis_location_page, GIS_TYPE_PAGE);
#define OBJ(type,name) ((type)gtk_builder_get_object(GIS_PAGE (page)->builder,(name)))
#define WID(name) OBJ(GtkWidget*,name)
@@ -64,10 +63,11 @@ set_timezone_cb (GObject *source,
gpointer user_data)
{
GisLocationPage *page = user_data;
+ GisLocationPagePrivate *priv = gis_location_page_get_instance_private (page);
GError *error;
error = NULL;
- if (!timedate1_call_set_timezone_finish (page->priv->dtm,
+ if (!timedate1_call_set_timezone_finish (priv->dtm,
res,
&error)) {
/* TODO: display any error in a user friendly way */
@@ -80,7 +80,7 @@ set_timezone_cb (GObject *source,
static void
queue_set_timezone (GisLocationPage *page)
{
- GisLocationPagePrivate *priv = page->priv;
+ GisLocationPagePrivate *priv = gis_location_page_get_instance_private (page);
/* for now just do it */
if (priv->current_location) {
@@ -96,13 +96,14 @@ queue_set_timezone (GisLocationPage *page)
static void
update_timezone (GisLocationPage *page)
{
+ GisLocationPagePrivate *priv = gis_location_page_get_instance_private (page);
GString *str;
gchar *location;
gchar *timezone;
gchar *c;
str = g_string_new ("");
- for (c = page->priv->current_location->zone; *c; c++) {
+ for (c = priv->current_location->zone; *c; c++) {
switch (*c) {
case '_':
g_string_append_c (str, ' ');
@@ -133,9 +134,11 @@ location_changed_cb (CcTimezoneMap *map,
TzLocation *location,
GisLocationPage *page)
{
+ GisLocationPagePrivate *priv = gis_location_page_get_instance_private (page);
+
g_debug ("location changed to %s/%s", location->country, location->zone);
- page->priv->current_location = location;
+ priv->current_location = location;
update_timezone (page);
@@ -146,6 +149,7 @@ static void
set_location_from_gweather_location (GisLocationPage *page,
GWeatherLocation *gloc)
{
+ GisLocationPagePrivate *priv = gis_location_page_get_instance_private (page);
GWeatherTimezone *zone = gweather_location_get_timezone (gloc);
gchar *city = gweather_location_get_city_name (gloc);
@@ -163,7 +167,7 @@ set_location_from_gweather_location (GisLocationPage *page,
name = id;
}
gtk_label_set_label (label, name);
- cc_timezone_map_set_timezone (page->priv->map, id);
+ cc_timezone_map_set_timezone (priv->map, id);
}
if (city != NULL) {
@@ -262,7 +266,7 @@ static void
gis_location_page_constructed (GObject *object)
{
GisLocationPage *page = GIS_LOCATION_PAGE (object);
- GisLocationPagePrivate *priv = page->priv;
+ GisLocationPagePrivate *priv = gis_location_page_get_instance_private (page);
GtkWidget *frame, *map, *entry;
GWeatherLocation *world;
GError *error;
@@ -344,7 +348,7 @@ static void
gis_location_page_dispose (GObject *object)
{
GisLocationPage *page = GIS_LOCATION_PAGE (object);
- GisLocationPagePrivate *priv = page->priv;
+ GisLocationPagePrivate *priv = gis_location_page_get_instance_private (page);
g_clear_object (&priv->dtm);
@@ -367,8 +371,6 @@ gis_location_page_class_init (GisLocationPageClass *klass)
page_class->locale_changed = gis_location_page_locale_changed;
object_class->constructed = gis_location_page_constructed;
object_class->dispose = gis_location_page_dispose;
-
- g_type_class_add_private (object_class, sizeof(GisLocationPagePrivate));
}
static void
@@ -376,7 +378,6 @@ gis_location_page_init (GisLocationPage *page)
{
g_resources_register (location_get_resource ());
g_resources_register (datetime_get_resource ());
- page->priv = GET_PRIVATE (page);
}
void
diff --git a/gnome-initial-setup/pages/location/gis-location-page.h
b/gnome-initial-setup/pages/location/gis-location-page.h
index eb78ee1..f4fd303 100644
--- a/gnome-initial-setup/pages/location/gis-location-page.h
+++ b/gnome-initial-setup/pages/location/gis-location-page.h
@@ -39,13 +39,10 @@ G_BEGIN_DECLS
typedef struct _GisLocationPage GisLocationPage;
typedef struct _GisLocationPageClass GisLocationPageClass;
-typedef struct _GisLocationPagePrivate GisLocationPagePrivate;
struct _GisLocationPage
{
GisPage parent;
-
- GisLocationPagePrivate *priv;
};
struct _GisLocationPageClass
diff --git a/gnome-initial-setup/pages/network/gis-network-page.c
b/gnome-initial-setup/pages/network/gis-network-page.c
index ac4ccef..fed3454 100644
--- a/gnome-initial-setup/pages/network/gis-network-page.c
+++ b/gnome-initial-setup/pages/network/gis-network-page.c
@@ -52,10 +52,6 @@ typedef enum {
NM_AP_SEC_WPA2
} NMAccessPointSecurity;
-G_DEFINE_TYPE (GisNetworkPage, gis_network_page, GIS_TYPE_PAGE);
-
-#define GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GIS_TYPE_NETWORK_PAGE, GisNetworkPagePrivate))
-
struct _GisNetworkPagePrivate {
NMClient *nm_client;
NMRemoteSettings *nm_settings;
@@ -63,6 +59,9 @@ struct _GisNetworkPagePrivate {
gboolean refreshing;
GtkSizeGroup *icons;
};
+typedef struct _GisNetworkPagePrivate GisNetworkPagePrivate;
+
+G_DEFINE_TYPE_WITH_PRIVATE (GisNetworkPage, gis_network_page, GIS_TYPE_PAGE);
#define OBJ(type,name) ((type)gtk_builder_get_object(GIS_PAGE(page)->builder,(name)))
#define WID(name) OBJ(GtkWidget*,name)
@@ -181,7 +180,7 @@ update_separator (GtkWidget **separator,
static void
add_access_point (GisNetworkPage *page, NMAccessPoint *ap, NMAccessPoint *active)
{
- GisNetworkPagePrivate *priv = page->priv;
+ GisNetworkPagePrivate *priv = gis_network_page_get_instance_private (page);
const GByteArray *ssid;
gchar *ssid_text;
const gchar *object_path;
@@ -329,7 +328,7 @@ refresh_again (gpointer user_data)
static void
refresh_without_device (GisNetworkPage *page)
{
- GisNetworkPagePrivate *priv = page->priv;
+ GisNetworkPagePrivate *priv = gis_network_page_get_instance_private (page);
GtkWidget *label;
GtkWidget *spinner;
GtkWidget *swin;
@@ -353,7 +352,7 @@ refresh_without_device (GisNetworkPage *page)
static void
refresh_wireless_list (GisNetworkPage *page)
{
- GisNetworkPagePrivate *priv = page->priv;
+ GisNetworkPagePrivate *priv = gis_network_page_get_instance_private (page);
NMDeviceState state = NM_DEVICE_STATE_UNAVAILABLE;
NMAccessPoint *active_ap = NULL;
NMAccessPoint *ap;
@@ -455,7 +454,7 @@ connection_add_activate_cb (NMClient *client,
static void
connect_to_hidden_network (GisNetworkPage *page)
{
- GisNetworkPagePrivate *priv = page->priv;
+ GisNetworkPagePrivate *priv = gis_network_page_get_instance_private (page);
cc_network_panel_connect_to_hidden_network (gtk_widget_get_toplevel (GTK_WIDGET (page)),
priv->nm_client,
priv->nm_settings);
@@ -464,7 +463,7 @@ connect_to_hidden_network (GisNetworkPage *page)
static void
child_activated (EggListBox *box, GtkWidget *child, GisNetworkPage *page)
{
- GisNetworkPagePrivate *priv = page->priv;
+ GisNetworkPagePrivate *priv = gis_network_page_get_instance_private (page);
gchar *object_path;
GSList *list, *filtered, *l;
NMConnection *connection;
@@ -555,7 +554,7 @@ static void
gis_network_page_constructed (GObject *object)
{
GisNetworkPage *page = GIS_NETWORK_PAGE (object);
- GisNetworkPagePrivate *priv = page->priv;
+ GisNetworkPagePrivate *priv = gis_network_page_get_instance_private (page);
const GPtrArray *devices;
NMDevice *device;
guint i;
@@ -632,7 +631,7 @@ static void
gis_network_page_dispose (GObject *object)
{
GisNetworkPage *page = GIS_NETWORK_PAGE (object);
- GisNetworkPagePrivate *priv = page->priv;
+ GisNetworkPagePrivate *priv = gis_network_page_get_instance_private (page);
g_clear_object (&priv->nm_client);
g_clear_object (&priv->nm_settings);
@@ -658,15 +657,12 @@ gis_network_page_class_init (GisNetworkPageClass *klass)
page_class->locale_changed = gis_network_page_locale_changed;
object_class->constructed = gis_network_page_constructed;
object_class->dispose = gis_network_page_dispose;
-
- g_type_class_add_private (object_class, sizeof(GisNetworkPagePrivate));
}
static void
gis_network_page_init (GisNetworkPage *page)
{
g_resources_register (network_get_resource ());
- page->priv = GET_PRIVATE (page);
}
void
diff --git a/gnome-initial-setup/pages/network/gis-network-page.h
b/gnome-initial-setup/pages/network/gis-network-page.h
index 89e74d2..61fcd2c 100644
--- a/gnome-initial-setup/pages/network/gis-network-page.h
+++ b/gnome-initial-setup/pages/network/gis-network-page.h
@@ -37,13 +37,10 @@ G_BEGIN_DECLS
typedef struct _GisNetworkPage GisNetworkPage;
typedef struct _GisNetworkPageClass GisNetworkPageClass;
-typedef struct _GisNetworkPagePrivate GisNetworkPagePrivate;
struct _GisNetworkPage
{
GisPage parent;
-
- GisNetworkPagePrivate *priv;
};
struct _GisNetworkPageClass
diff --git a/gnome-initial-setup/pages/summary/gis-summary-page.c
b/gnome-initial-setup/pages/summary/gis-summary-page.c
index f16c4eb..e4b16d4 100644
--- a/gnome-initial-setup/pages/summary/gis-summary-page.c
+++ b/gnome-initial-setup/pages/summary/gis-summary-page.c
@@ -41,14 +41,13 @@
#define SERVICE_NAME "gdm-password"
-G_DEFINE_TYPE (GisSummaryPage, gis_summary_page, GIS_TYPE_PAGE);
-
-#define GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GIS_TYPE_SUMMARY_PAGE, GisSummaryPagePrivate))
-
struct _GisSummaryPagePrivate {
ActUser *user_account;
const gchar *user_password;
};
+typedef struct _GisSummaryPagePrivate GisSummaryPagePrivate;
+
+G_DEFINE_TYPE_WITH_PRIVATE (GisSummaryPage, gis_summary_page, GIS_TYPE_PAGE);
#define OBJ(type,name) ((type)gtk_builder_get_object(GIS_PAGE(page)->builder,(name)))
#define WID(name) OBJ(GtkWidget*,name)
@@ -128,7 +127,7 @@ on_secret_info_query (GdmUserVerifier *user_verifier,
const char *question,
GisSummaryPage *page)
{
- GisSummaryPagePrivate *priv = page->priv;
+ GisSummaryPagePrivate *priv = gis_summary_page_get_instance_private (page);
gboolean should_send_password = priv->user_password != NULL;
g_debug ("PAM module secret info query: %s\n", question);
@@ -177,7 +176,7 @@ add_uid_file (uid_t uid)
static void
log_user_in (GisSummaryPage *page)
{
- GisSummaryPagePrivate *priv = page->priv;
+ GisSummaryPagePrivate *priv = gis_summary_page_get_instance_private (page);
GError *error = NULL;
GdmGreeter *greeter;
GdmUserVerifier *user_verifier;
@@ -264,7 +263,8 @@ done_cb (GtkButton *button, GisSummaryPage *page)
static void
gis_summary_page_shown (GisPage *page)
{
- GisSummaryPagePrivate *priv = GIS_SUMMARY_PAGE (page)->priv;
+ GisSummaryPage *summary = GIS_SUMMARY_PAGE (page);
+ GisSummaryPagePrivate *priv = gis_summary_page_get_instance_private (summary);
gis_driver_save_data (GIS_PAGE (page)->driver);
@@ -387,15 +387,12 @@ gis_summary_page_class_init (GisSummaryPageClass *klass)
page_class->locale_changed = gis_summary_page_locale_changed;
page_class->shown = gis_summary_page_shown;
object_class->constructed = gis_summary_page_constructed;
-
- g_type_class_add_private (object_class, sizeof(GisSummaryPagePrivate));
}
static void
gis_summary_page_init (GisSummaryPage *page)
{
g_resources_register (summary_get_resource ());
- page->priv = GET_PRIVATE (page);
}
void
diff --git a/gnome-initial-setup/pages/summary/gis-summary-page.h
b/gnome-initial-setup/pages/summary/gis-summary-page.h
index 6e2efee..43fdd29 100644
--- a/gnome-initial-setup/pages/summary/gis-summary-page.h
+++ b/gnome-initial-setup/pages/summary/gis-summary-page.h
@@ -37,13 +37,10 @@ G_BEGIN_DECLS
typedef struct _GisSummaryPage GisSummaryPage;
typedef struct _GisSummaryPageClass GisSummaryPageClass;
-typedef struct _GisSummaryPagePrivate GisSummaryPagePrivate;
struct _GisSummaryPage
{
GisPage parent;
-
- GisSummaryPagePrivate *priv;
};
struct _GisSummaryPageClass
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]