aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2014-07-23 16:22:27 -0500
committerCharles Kerr <charles.kerr@canonical.com>2014-07-23 16:22:27 -0500
commitd185409f22c859e3c29bf387955d195a5cd884c3 (patch)
treeeb0b61ac9f1c13c3de22ccd3d8760e8fd5e0339a /src
parentaba9e6261a6f02c501fa690e12babbbc8eea3a53 (diff)
downloadayatana-indicator-power-d185409f22c859e3c29bf387955d195a5cd884c3.tar.gz
ayatana-indicator-power-d185409f22c859e3c29bf387955d195a5cd884c3.tar.bz2
ayatana-indicator-power-d185409f22c859e3c29bf387955d195a5cd884c3.zip
remove instance_count from IndicatorPowerNotifierClass
Diffstat (limited to 'src')
-rw-r--r--src/notifier.c18
-rw-r--r--src/notifier.h3
2 files changed, 8 insertions, 13 deletions
diff --git a/src/notifier.c b/src/notifier.c
index 62952e6..c6b0025 100644
--- a/src/notifier.c
+++ b/src/notifier.c
@@ -51,6 +51,8 @@ enum
static GParamSpec * properties[LAST_PROP];
+static int instance_count = 0;
+
/**
***
**/
@@ -276,11 +278,12 @@ my_dispose (GObject * o)
}
static void
-my_finalize (GObject * o)
+my_finalize (GObject * o G_GNUC_UNUSED)
{
- IndicatorPowerNotifierClass * klass = INDICATOR_POWER_NOTIFIER_GET_CLASS(o);
-
- if (!--klass->instance_count)
+ /* FIXME: This is an awkward place to put this.
+ Ordinarily something like this would go in main(), but we need libnotify
+ to clean itself up before shutting down the bus in the unit tests as well. */
+ if (!--instance_count)
notify_uninit();
}
@@ -292,7 +295,6 @@ static void
indicator_power_notifier_init (IndicatorPowerNotifier * self)
{
priv_t * p;
- IndicatorPowerNotifierClass * klass;
p = G_TYPE_INSTANCE_GET_PRIVATE (self,
INDICATOR_TYPE_POWER_NOTIFIER,
@@ -315,9 +317,7 @@ indicator_power_notifier_init (IndicatorPowerNotifier * self)
PROP_POWER_LEVEL_NAME,
G_BINDING_SYNC_CREATE);
- klass = INDICATOR_POWER_NOTIFIER_GET_CLASS(self);
-
- if (!klass->instance_count++)
+ if (!instance_count++)
{
if (!notify_init("indicator-power-service"))
{
@@ -364,8 +364,6 @@ indicator_power_notifier_class_init (IndicatorPowerNotifierClass * klass)
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (object_class, LAST_PROP, properties);
-
- klass->instance_count = 0;
}
/***
diff --git a/src/notifier.h b/src/notifier.h
index dddb6e9..8763ad6 100644
--- a/src/notifier.h
+++ b/src/notifier.h
@@ -60,9 +60,6 @@ struct _IndicatorPowerNotifier
struct _IndicatorPowerNotifierClass
{
GObjectClass parent_class;
-
- /*< private >*/
- gint instance_count;
};
/***