aboutsummaryrefslogtreecommitdiff
path: root/src/device.c
diff options
context:
space:
mode:
authorRobert Tari <robert@tari.in>2020-09-03 18:43:57 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2020-09-04 19:15:05 +0000
commit147130a91624079dbc6237d2426f122e0f6513e6 (patch)
tree3f5f484e69eb1daa45a2e1a4feba003cfbe9f0ed /src/device.c
parent2849569fffd380b4424278c848e9483e54e4a0c5 (diff)
downloadayatana-indicator-power-147130a91624079dbc6237d2426f122e0f6513e6.tar.gz
ayatana-indicator-power-147130a91624079dbc6237d2426f122e0f6513e6.tar.bz2
ayatana-indicator-power-147130a91624079dbc6237d2426f122e0f6513e6.zip
Fix deprecations and build warnings.
Fixes AyatanaIndicators/ayatana-indicator-power#9.
Diffstat (limited to 'src/device.c')
-rw-r--r--src/device.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/device.c b/src/device.c
index 524ce92..05eb15e 100644
--- a/src/device.c
+++ b/src/device.c
@@ -69,7 +69,7 @@ static void set_property (GObject*, guint prop_id, const GValue*, GParamSpec* );
static void get_property (GObject*, guint prop_id, GValue*, GParamSpec* );
/* LCOV_EXCL_START */
-G_DEFINE_TYPE (IndicatorPowerDevice, indicator_power_device, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE(IndicatorPowerDevice, indicator_power_device, G_TYPE_OBJECT)
/* LCOV_EXCL_STOP */
static void
@@ -77,8 +77,6 @@ indicator_power_device_class_init (IndicatorPowerDeviceClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- g_type_class_add_private (klass, sizeof (IndicatorPowerDevicePrivate));
-
object_class->dispose = indicator_power_device_dispose;
object_class->finalize = indicator_power_device_finalize;
object_class->set_property = set_property;
@@ -133,8 +131,7 @@ indicator_power_device_init (IndicatorPowerDevice *self)
{
IndicatorPowerDevicePrivate * priv;
- priv = G_TYPE_INSTANCE_GET_PRIVATE (self, INDICATOR_POWER_DEVICE_TYPE,
- IndicatorPowerDevicePrivate);
+ priv = indicator_power_device_get_instance_private(self);
priv->kind = UP_DEVICE_KIND_UNKNOWN;
priv->state = UP_DEVICE_STATE_UNKNOWN;
priv->object_path = NULL;
@@ -449,6 +446,7 @@ indicator_power_device_get_icon_names (const IndicatorPowerDevice * device)
break;
case UP_DEVICE_STATE_CHARGING:
+
suffix_str = get_device_icon_suffix (percentage);
index_str = get_closest_10_percent_percentage (percentage);
g_ptr_array_add (names, g_strdup_printf ("%s-%s-charging", kind_str, index_str));