summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Barciela <[email protected]>2019-08-14 04:34:14 +0200
committerVictor Kareh <[email protected]>2019-08-20 13:34:13 -0400
commit29b50f4ae8400c3b1bd6856209ca78927467a849 (patch)
treee5e2f5c0e336c7d93b509c74a86b5206fc02f042
parente5500ce4be1bf71a45b5521003775493ddc353ba (diff)
downloadmate-power-manager-29b50f4ae8400c3b1bd6856209ca78927467a849.tar.bz2
mate-power-manager-29b50f4ae8400c3b1bd6856209ca78927467a849.tar.xz
egg-idletime: avoid 'g_type_class_add_private'
-rw-r--r--src/egg-idletime.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/egg-idletime.c b/src/egg-idletime.c
index 28b7390..486acd3 100644
--- a/src/egg-idletime.c
+++ b/src/egg-idletime.c
@@ -37,8 +37,6 @@
static void egg_idletime_finalize (GObject *object);
-#define EGG_IDLETIME_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), EGG_IDLETIME_TYPE, EggIdletimePrivate))
-
struct EggIdletimePrivate
{
gint sync_event;
@@ -71,7 +69,7 @@ typedef enum {
static guint signals [LAST_SIGNAL] = { 0 };
static gpointer egg_idletime_object = NULL;
-G_DEFINE_TYPE (EggIdletime, egg_idletime, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE (EggIdletime, egg_idletime, G_TYPE_OBJECT)
/**
* egg_idletime_xsyncvalue_to_int64:
@@ -362,7 +360,6 @@ egg_idletime_class_init (EggIdletimeClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = egg_idletime_finalize;
- g_type_class_add_private (klass, sizeof (EggIdletimePrivate));
signals [SIGNAL_ALARM_EXPIRED] =
g_signal_new ("alarm-expired",
@@ -392,7 +389,7 @@ egg_idletime_init (EggIdletime *idletime)
EggIdletimeAlarm *alarm;
guint i;
- idletime->priv = EGG_IDLETIME_GET_PRIVATE (idletime);
+ idletime->priv = egg_idletime_get_instance_private (idletime);
idletime->priv->array = g_ptr_array_new ();
@@ -443,7 +440,7 @@ egg_idletime_finalize (GObject *object)
g_return_if_fail (EGG_IS_IDLETIME (object));
idletime = EGG_IDLETIME (object);
- idletime->priv = EGG_IDLETIME_GET_PRIVATE (idletime);
+ idletime->priv = egg_idletime_get_instance_private (idletime);
/* free all counters, including reset counter */
for (i=0; i<idletime->priv->array->len; i++) {