diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2012-05-26 16:57:13 -0500 |
---|---|---|
committer | Charles Kerr <charles.kerr@canonical.com> | 2012-05-26 16:57:13 -0500 |
commit | 194cfbc5c7be5b7b298a6e7079452af2f8331142 (patch) | |
tree | 8a2da080ec535cb21eb9bddc86aeb1f527813ec2 /src | |
parent | aeb6ab59af1f325261db754aade493a949d5a1e3 (diff) | |
download | ayatana-indicator-power-194cfbc5c7be5b7b298a6e7079452af2f8331142.tar.gz ayatana-indicator-power-194cfbc5c7be5b7b298a6e7079452af2f8331142.tar.bz2 ayatana-indicator-power-194cfbc5c7be5b7b298a6e7079452af2f8331142.zip |
try adding LCOV_EXCL_{START,STOP} for unreachable conditions (glib looking for subclasses of IndicatorPowerDevice; unreachables in G_DEFINE_TYPE)
Diffstat (limited to 'src')
-rw-r--r-- | src/device.c | 20 | ||||
-rw-r--r-- | src/indicator-power.c | 6 |
2 files changed, 23 insertions, 3 deletions
diff --git a/src/device.c b/src/device.c index 4b983e9..5cd39dd 100644 --- a/src/device.c +++ b/src/device.c @@ -55,7 +55,9 @@ static void indicator_power_device_finalize (GObject *object); 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); +/* LCOV_EXCL_STOP */ static void indicator_power_device_class_init (IndicatorPowerDeviceClass *klass) @@ -219,7 +221,9 @@ set_property (GObject * o, guint prop_id, const GValue * value, GParamSpec * psp UpDeviceKind indicator_power_device_get_kind (const IndicatorPowerDevice * device) { + /* LCOV_EXCL_START */ g_return_val_if_fail (INDICATOR_IS_POWER_DEVICE(device), UP_DEVICE_KIND_UNKNOWN); + /* LCOV_EXCL_STOP */ return device->priv->kind; } @@ -227,7 +231,9 @@ indicator_power_device_get_kind (const IndicatorPowerDevice * device) UpDeviceState indicator_power_device_get_state (const IndicatorPowerDevice * device) { + /* LCOV_EXCL_START */ g_return_val_if_fail (INDICATOR_IS_POWER_DEVICE(device), UP_DEVICE_STATE_UNKNOWN); + /* LCOV_EXCL_STOP */ return device->priv->state; } @@ -235,7 +241,9 @@ indicator_power_device_get_state (const IndicatorPowerDevice * device) const gchar * indicator_power_device_get_object_path (const IndicatorPowerDevice * device) { - g_return_val_if_fail (INDICATOR_IS_POWER_DEVICE(device), UP_DEVICE_KIND_UNKNOWN); + /* LCOV_EXCL_START */ + g_return_val_if_fail (INDICATOR_IS_POWER_DEVICE(device), NULL); + /* LCOV_EXCL_STOP */ return device->priv->object_path; } @@ -243,7 +251,9 @@ indicator_power_device_get_object_path (const IndicatorPowerDevice * device) const gchar * indicator_power_device_get_icon (const IndicatorPowerDevice * device) { + /* LCOV_EXCL_START */ g_return_val_if_fail (INDICATOR_IS_POWER_DEVICE(device), UP_DEVICE_KIND_UNKNOWN); + /* LCOV_EXCL_STOP */ return device->priv->icon; } @@ -251,7 +261,9 @@ indicator_power_device_get_icon (const IndicatorPowerDevice * device) gdouble indicator_power_device_get_percentage (const IndicatorPowerDevice * device) { - g_return_val_if_fail (INDICATOR_IS_POWER_DEVICE(device), UP_DEVICE_KIND_UNKNOWN); + /* LCOV_EXCL_START */ + g_return_val_if_fail (INDICATOR_IS_POWER_DEVICE(device), 0.0); + /* LCOV_EXCL_STOP */ return device->priv->percentage; } @@ -259,7 +271,9 @@ indicator_power_device_get_percentage (const IndicatorPowerDevice * device) time_t indicator_power_device_get_time (const IndicatorPowerDevice * device) { - g_return_val_if_fail (INDICATOR_IS_POWER_DEVICE(device), UP_DEVICE_KIND_UNKNOWN); + /* LCOV_EXCL_START */ + g_return_val_if_fail (INDICATOR_IS_POWER_DEVICE(device), (time_t)0); + /* LCOV_EXCL_STOP */ return device->priv->time; } diff --git a/src/indicator-power.c b/src/indicator-power.c index dc95aae..cf96619 100644 --- a/src/indicator-power.c +++ b/src/indicator-power.c @@ -59,8 +59,10 @@ struct _IndicatorPowerPrivate }; +/* LCOV_EXCL_START */ INDICATOR_SET_VERSION INDICATOR_SET_TYPE (INDICATOR_POWER_TYPE) +/* LCOV_EXCL_STOP */ /* Prototypes */ static void indicator_power_dispose (GObject *object); @@ -81,7 +83,9 @@ static void on_entry_added (IndicatorObject * io, I static void gsd_appeared_callback (GDBusConnection *connection, const gchar *name, const gchar *name_owner, gpointer user_data); */ +/* LCOV_EXCL_START */ G_DEFINE_TYPE (IndicatorPower, indicator_power, INDICATOR_OBJECT_TYPE); +/* LCOV_EXCL_STOP */ static void indicator_power_class_init (IndicatorPowerClass *klass) @@ -767,7 +771,9 @@ indicator_power_set_devices (IndicatorPower * self, GSList * new_devices; IndicatorPowerPrivate * priv; +/* LCOV_EXCL_START */ g_return_if_fail (IS_INDICATOR_POWER(self)); +/* LCOV_EXCL_STOP */ priv = self->priv; /* make a reff'ed list of the new devices */ |