summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorraveit65 <[email protected]>2019-09-25 11:54:39 +0200
committerraveit65 <[email protected]>2019-09-26 11:08:59 +0200
commitfbfbc8c52c6454a9b4a9840c8aac42dcd5d51b5d (patch)
treeb679149816253e6591a9aa2e55cc03de40b4c819 /src
parent92f5ca9facce367ab1eb58cb28326fe5edcd9960 (diff)
downloadmate-power-manager-fbfbc8c52c6454a9b4a9840c8aac42dcd5d51b5d.tar.bz2
mate-power-manager-fbfbc8c52c6454a9b4a9840c8aac42dcd5d51b5d.tar.xz
drop obsolete version checks for upower
with required version bump to upower-0.99.8 we don't need them any more.
Diffstat (limited to 'src')
-rw-r--r--src/gpm-backlight.c9
-rw-r--r--src/gpm-button.c9
-rw-r--r--src/gpm-engine.c375
-rw-r--r--src/gpm-kbd-backlight.c11
-rw-r--r--src/gpm-manager.c9
-rw-r--r--src/gpm-prefs-core.c11
-rw-r--r--src/gpm-statistics.c45
7 files changed, 2 insertions, 467 deletions
diff --git a/src/gpm-backlight.c b/src/gpm-backlight.c
index 7e493ac..21eed90 100644
--- a/src/gpm-backlight.c
+++ b/src/gpm-backlight.c
@@ -412,11 +412,7 @@ gpm_settings_key_changed_cb (GSettings *settings, const gchar *key, GpmBacklight
* Does the actions when the ac power source is inserted/removed.
**/
static void
-#if UP_CHECK_VERSION(0, 99, 0)
gpm_backlight_client_changed_cb (UpClient *client, GParamSpec *pspec, GpmBacklight *backlight)
-#else
-gpm_backlight_client_changed_cb (UpClient *client, GpmBacklight *backlight)
-#endif
{
gpm_backlight_brightness_evaluate_and_set (backlight, FALSE, TRUE);
}
@@ -746,13 +742,8 @@ gpm_backlight_init (GpmBacklight *backlight)
/* we use up_client for the ac-adapter-changed signal */
backlight->priv->client = up_client_new ();
-#if UP_CHECK_VERSION(0, 99, 0)
g_signal_connect (backlight->priv->client, "notify",
G_CALLBACK (gpm_backlight_client_changed_cb), backlight);
-#else
- g_signal_connect (backlight->priv->client, "changed",
- G_CALLBACK (gpm_backlight_client_changed_cb), backlight);
-#endif
/* gets caps */
backlight->priv->can_dim = gpm_brightness_has_hw (backlight->priv->brightness);
diff --git a/src/gpm-button.c b/src/gpm-button.c
index f1ac8e9..0975966 100644
--- a/src/gpm-button.c
+++ b/src/gpm-button.c
@@ -323,11 +323,7 @@ gpm_button_reset_time (GpmButton *button)
* gpm_button_client_changed_cb
**/
static void
-#if UP_CHECK_VERSION(0, 99, 0)
gpm_button_client_changed_cb (UpClient *client, GParamSpec *pspec, GpmButton *button)
-#else
-gpm_button_client_changed_cb (UpClient *client, GpmButton *button)
-#endif
{
gboolean lid_is_closed;
@@ -366,13 +362,8 @@ gpm_button_init (GpmButton *button)
button->priv->client = up_client_new ();
button->priv->lid_is_closed = up_client_get_lid_is_closed (button->priv->client);
-#if UP_CHECK_VERSION(0, 99, 0)
g_signal_connect (button->priv->client, "notify",
G_CALLBACK (gpm_button_client_changed_cb), button);
-#else
- g_signal_connect (button->priv->client, "changed",
- G_CALLBACK (gpm_button_client_changed_cb), button);
-#endif
/* register the brightness keys */
gpm_button_xevent_key (button, XF86XK_PowerOff, GPM_BUTTON_POWER);
diff --git a/src/gpm-engine.c b/src/gpm-engine.c
index 248553c..18f69b8 100644
--- a/src/gpm-engine.c
+++ b/src/gpm-engine.c
@@ -82,7 +82,6 @@ G_DEFINE_TYPE_WITH_PRIVATE (GpmEngine, gpm_engine, G_TYPE_OBJECT)
static UpDevice *gpm_engine_get_composite_device (GpmEngine *engine, UpDevice *original_device);
static UpDevice *gpm_engine_update_composite_device (GpmEngine *engine, UpDevice *original_device);
-#if UP_CHECK_VERSION (0, 99, 0)
static void gpm_engine_device_changed_cb (UpDevice *device, GParamSpec *pspec, GpmEngine *engine);
#define GPM_ENGINE_WARNING_NONE UP_DEVICE_LEVEL_NONE
@@ -106,147 +105,6 @@ gpm_engine_get_warning (GpmEngine *engine, UpDevice *device)
g_object_get (device, "warning-level", &warning, NULL);
return warning;
}
-#else
-
-typedef enum {
- GPM_ENGINE_WARNING_NONE = 0,
- GPM_ENGINE_WARNING_DISCHARGING = 1,
- GPM_ENGINE_WARNING_LOW = 2,
- GPM_ENGINE_WARNING_CRITICAL = 3,
- GPM_ENGINE_WARNING_ACTION = 4
-} GpmEngineWarning;
-
-/**
- * gpm_engine_get_warning_csr:
- **/
-static GpmEngineWarning
-gpm_engine_get_warning_csr (GpmEngine *engine, UpDevice *device)
-{
- gdouble percentage;
-
- /* get device properties */
- g_object_get (device, "percentage", &percentage, NULL);
-
- if (percentage < 26.0f)
- return GPM_ENGINE_WARNING_LOW;
- else if (percentage < 13.0f)
- return GPM_ENGINE_WARNING_CRITICAL;
- return GPM_ENGINE_WARNING_NONE;
-}
-
-/**
- * gpm_engine_get_warning_percentage:
- **/
-static GpmEngineWarning
-gpm_engine_get_warning_percentage (GpmEngine *engine, UpDevice *device)
-{
- gdouble percentage;
-
- /* get device properties */
- g_object_get (device, "percentage", &percentage, NULL);
-
- if (percentage <= engine->priv->action_percentage)
- return GPM_ENGINE_WARNING_ACTION;
- if (percentage <= engine->priv->critical_percentage)
- return GPM_ENGINE_WARNING_CRITICAL;
- if (percentage <= engine->priv->low_percentage)
- return GPM_ENGINE_WARNING_LOW;
- return GPM_ENGINE_WARNING_NONE;
-}
-
-/**
- * gpm_engine_get_warning_time:
- **/
-static GpmEngineWarning
-gpm_engine_get_warning_time (GpmEngine *engine, UpDevice *device)
-{
- UpDeviceKind kind;
- gint64 time_to_empty;
-
- /* get device properties */
- g_object_get (device,
- "kind", &kind,
- "time-to-empty", &time_to_empty,
- NULL);
-
- /* this is probably an error condition */
- if (time_to_empty == 0) {
- egg_debug ("time zero, falling back to percentage for %s", up_device_kind_to_string (kind));
- return gpm_engine_get_warning_percentage (engine, device);
- }
-
- if (time_to_empty <= engine->priv->action_time)
- return GPM_ENGINE_WARNING_ACTION;
- if (time_to_empty <= engine->priv->critical_time)
- return GPM_ENGINE_WARNING_CRITICAL;
- if (time_to_empty <= engine->priv->low_time)
- return GPM_ENGINE_WARNING_LOW;
- return GPM_ENGINE_WARNING_NONE;
-}
-
-/**
- * gpm_engine_get_warning:
- *
- * This gets the possible engine state for the device according to the
- * policy, which could be per-percent, or per-time.
- *
- * Return value: A GpmEngine state, e.g. GPM_ENGINE_WARNING_DISCHARGING
- **/
-static GpmEngineWarning
-gpm_engine_get_warning (GpmEngine *engine, UpDevice *device)
-{
- UpDeviceKind kind;
- UpDeviceState state;
- GpmEngineWarning warning_type;
-
- /* get device properties */
- g_object_get (device,
- "kind", &kind,
- "state", &state,
- NULL);
-
- /* default to no engine */
- warning_type = GPM_ENGINE_WARNING_NONE;
-
- /* if the device in question is on ac, don't give a warning */
- if (state == UP_DEVICE_STATE_CHARGING)
- goto out;
-
- if (kind == UP_DEVICE_KIND_MOUSE ||
- kind == UP_DEVICE_KIND_KEYBOARD) {
-
- warning_type = gpm_engine_get_warning_csr (engine, device);
-
- } else if (kind == UP_DEVICE_KIND_UPS ||
- kind == UP_DEVICE_KIND_MEDIA_PLAYER ||
- kind == UP_DEVICE_KIND_TABLET ||
- kind == UP_DEVICE_KIND_COMPUTER ||
- kind == UP_DEVICE_KIND_PDA) {
-
- warning_type = gpm_engine_get_warning_percentage (engine, device);
-
- } else if (kind == UP_DEVICE_KIND_PHONE) {
-
- warning_type = gpm_engine_get_warning_percentage (engine, device);
-
- } else if (kind == UP_DEVICE_KIND_BATTERY) {
- /* only use the time when it is accurate, and MateConf is not disabled */
- if (engine->priv->use_time_primary)
- warning_type = gpm_engine_get_warning_time (engine, device);
- else
- warning_type = gpm_engine_get_warning_percentage (engine, device);
- }
-
- /* If we have no important engines, we should test for discharging */
- if (warning_type == GPM_ENGINE_WARNING_NONE) {
- if (state == UP_DEVICE_STATE_DISCHARGING)
- warning_type = GPM_ENGINE_WARNING_DISCHARGING;
- }
-
- out:
- return warning_type;
-}
-#endif
/**
* gpm_engine_get_summary:
@@ -303,20 +161,12 @@ gpm_engine_get_summary (GpmEngine *engine)
* Returns the icon
**/
static gchar *
-#if UP_CHECK_VERSION (0, 99, 0)
gpm_engine_get_icon_priv (GpmEngine *engine, UpDeviceKind device_kind, UpDeviceLevel warning, gboolean use_state)
-#else
-gpm_engine_get_icon_priv (GpmEngine *engine, UpDeviceKind device_kind, GpmEngineWarning warning, gboolean use_state)
-#endif
{
guint i;
GPtrArray *array;
UpDevice *device;
-#if UP_CHECK_VERSION (0, 99, 0)
UpDeviceLevel warning_temp;
-#else
- GpmEngineWarning warning_temp;
-#endif
UpDeviceKind kind;
UpDeviceState state;
gboolean is_present;
@@ -603,45 +453,7 @@ gpm_engine_device_check_capacity (GpmEngine *engine, UpDevice *device)
static UpDevice *
gpm_engine_get_composite_device (GpmEngine *engine, UpDevice *original_device)
{
-#if UP_CHECK_VERSION (0, 99, 0)
return engine->priv->battery_composite;
-#else
- guint battery_devices = 0;
- GPtrArray *array;
- UpDevice *device;
- UpDeviceKind kind;
- UpDeviceKind original_kind;
- guint i;
-
- /* get the type of the original device */
- g_object_get (original_device,
- "kind", &original_kind,
- NULL);
-
- /* find out how many batteries in the system */
- array = engine->priv->array;
- for (i=0;i<array->len;i++) {
- device = g_ptr_array_index (engine->priv->array, i);
- g_object_get (device,
- "kind", &kind,
- NULL);
- if (kind == original_kind)
- battery_devices++;
- }
-
- /* just use the original device if only one primary battery */
- if (battery_devices <= 1) {
- egg_debug ("using original device as only one primary battery");
- device = original_device;
- goto out;
- }
-
- /* use the composite device */
- device = engine->priv->battery_composite;
-out:
- /* return composite device or original device */
- return device;
-#endif
}
/**
@@ -650,7 +462,6 @@ out:
static UpDevice *
gpm_engine_update_composite_device (GpmEngine *engine, UpDevice *original_device)
{
-#if UP_CHECK_VERSION (0, 99, 0)
gchar *text;
text = up_device_to_text (engine->priv->battery_composite);
@@ -661,125 +472,6 @@ gpm_engine_update_composite_device (GpmEngine *engine, UpDevice *original_device
gpm_engine_recalculate_state_icon (engine);
return engine->priv->battery_composite;
-#else
- guint i;
- gdouble percentage = 0.0;
- gdouble energy = 0.0;
- gdouble energy_full = 0.0;
- gdouble energy_rate = 0.0;
- gdouble energy_total = 0.0;
- gdouble energy_full_total = 0.0;
- gdouble energy_rate_total = 0.0;
- gint64 time_to_empty = 0;
- gint64 time_to_full = 0;
- guint battery_devices = 0;
- gboolean is_charging = FALSE;
- gboolean is_discharging = FALSE;
- gboolean is_fully_charged = TRUE;
- GPtrArray *array;
- UpDevice *device;
- UpDeviceState state;
- UpDeviceKind kind;
- UpDeviceKind original_kind;
- gboolean debug;
- gchar *text;
-
- /* are we printing to console? */
- debug = egg_debug_enabled ();
-
- /* get the type of the original device */
- g_object_get (original_device,
- "kind", &original_kind,
- NULL);
-
- /* update the composite device */
- array = engine->priv->array;
- for (i=0;i<array->len;i++) {
- device = g_ptr_array_index (engine->priv->array, i);
- g_object_get (device,
- "kind", &kind,
- "state", &state,
- "energy", &energy,
- "energy-full", &energy_full,
- "energy-rate", &energy_rate,
- NULL);
- if (kind != original_kind)
- continue;
-
- if (debug) {
- text = up_device_to_text (device);
- egg_debug ("printing device %i:\n%s", i, text);
- g_free (text);
- }
-
- /* one of these will be charging or discharging */
- if (state == UP_DEVICE_STATE_CHARGING)
- is_charging = TRUE;
- if (state == UP_DEVICE_STATE_DISCHARGING)
- is_discharging = TRUE;
- if (state != UP_DEVICE_STATE_FULLY_CHARGED)
- is_fully_charged = FALSE;
-
- /* sum up composite */
- energy_total += energy;
- energy_full_total += energy_full;
- energy_rate_total += energy_rate;
- battery_devices++;
- }
-
- /* just use the original device if only one primary battery */
- if (battery_devices == 1) {
- egg_debug ("using original device as only one primary battery");
- device = original_device;
- goto out;
- }
-
- /* use percentage weighted for each battery capacity */
- percentage = 100.0 * energy_total / energy_full_total;
-
- /* set composite state */
- if (is_charging)
- state = UP_DEVICE_STATE_CHARGING;
- else if (is_discharging)
- state = UP_DEVICE_STATE_DISCHARGING;
- else if (is_fully_charged)
- state = UP_DEVICE_STATE_FULLY_CHARGED;
- else
- state = UP_DEVICE_STATE_UNKNOWN;
-
- /* calculate a quick and dirty time remaining value */
- if (energy_rate_total > 0) {
- if (state == UP_DEVICE_STATE_DISCHARGING)
- time_to_empty = 3600 * (energy_total / energy_rate_total);
- else if (state == UP_DEVICE_STATE_CHARGING)
- time_to_full = 3600 * ((energy_full_total - energy_total) / energy_rate_total);
- }
-
- /* okay, we can use the composite device */
- device = engine->priv->battery_composite;
-
- egg_debug ("printing composite device");
- g_object_set (device,
- "energy", energy,
- "energy-full", energy_full,
- "energy-rate", energy_rate,
- "time-to-empty", time_to_empty,
- "time-to-full", time_to_full,
- "percentage", percentage,
- "state", state,
- NULL);
- if (debug) {
- text = up_device_to_text (device);
- egg_debug ("composite:\n%s", text);
- g_free (text);
- }
-
- /* force update of icon */
- gpm_engine_recalculate_state_icon (engine);
-out:
- /* return composite device or original device */
- return device;
-#endif
}
/**
@@ -788,11 +480,7 @@ out:
static void
gpm_engine_device_add (GpmEngine *engine, UpDevice *device)
{
-#if UP_CHECK_VERSION (0, 99, 0)
UpDeviceLevel warning;
-#else
- GpmEngineWarning warning;
-#endif
UpDeviceState state;
UpDeviceKind kind;
UpDevice *composite;
@@ -825,12 +513,9 @@ gpm_engine_device_add (GpmEngine *engine, UpDevice *device)
g_object_set_data (G_OBJECT(composite), "engine-state-old", GUINT_TO_POINTER(state));
}
-#if UP_CHECK_VERSION (0, 99, 0)
g_signal_connect (device, "notify", G_CALLBACK (gpm_engine_device_changed_cb), engine);
g_ptr_array_add (engine->priv->array, g_object_ref (device));
gpm_engine_recalculate_state (engine);
-#endif
-
}
/**
@@ -842,22 +527,9 @@ gpm_engine_coldplug_idle_cb (GpmEngine *engine)
guint i;
GPtrArray *array = NULL;
UpDevice *device;
-#if !UP_CHECK_VERSION(0, 99, 0)
- gboolean ret;
- GError *error = NULL;
-#endif
g_return_val_if_fail (engine != NULL, FALSE);
g_return_val_if_fail (GPM_IS_ENGINE (engine), FALSE);
-#if !UP_CHECK_VERSION(0, 99, 0)
- /* get devices from UPower */
- ret = up_client_enumerate_devices_sync (engine->priv->client, NULL, &error);
- if (!ret) {
- egg_error ("failed to get device list: %s", error->message);
- g_error_free (error);
- goto out;
- }
-#endif
/* connected mobile phones */
gpm_phone_coldplug (engine->priv->phone);
@@ -869,9 +541,6 @@ gpm_engine_coldplug_idle_cb (GpmEngine *engine)
device = g_ptr_array_index (array, i);
gpm_engine_device_add (engine, device);
}
-#if !UP_CHECK_VERSION(0, 99, 0)
-out:
-#endif
if (array != NULL)
g_ptr_array_unref (array);
/* never repeat */
@@ -884,21 +553,13 @@ out:
static void
gpm_engine_device_added_cb (UpClient *client, UpDevice *device, GpmEngine *engine)
{
-#if UP_CHECK_VERSION (0, 99, 0)
gpm_engine_device_add (engine, device);
-#else
- /* add to list */
- g_ptr_array_add (engine->priv->array, g_object_ref (device));
-
- gpm_engine_recalculate_state (engine);
-#endif
}
/**
* gpm_engine_device_removed_cb:
**/
static void
-#if UP_CHECK_VERSION(0, 99, 0)
gpm_engine_device_removed_cb (UpClient *client, const char *object_path, GpmEngine *engine)
{
guint i;
@@ -913,37 +574,18 @@ gpm_engine_device_removed_cb (UpClient *client, const char *object_path, GpmEngi
}
gpm_engine_recalculate_state (engine);
}
-#else
-gpm_engine_device_removed_cb (UpClient *client, UpDevice *device, GpmEngine *engine)
-{
- gboolean ret;
- ret = g_ptr_array_remove (engine->priv->array, device);
- if (!ret)
- return;
- gpm_engine_recalculate_state (engine);
-}
-#endif
/**
* gpm_engine_device_changed_cb:
**/
static void
-#if UP_CHECK_VERSION(0, 99, 0)
gpm_engine_device_changed_cb (UpDevice *device, GParamSpec *pspec, GpmEngine *engine)
-#else
-gpm_engine_device_changed_cb (UpClient *client, UpDevice *device, GpmEngine *engine)
-#endif
{
UpDeviceKind kind;
UpDeviceState state;
UpDeviceState state_old;
-#if UP_CHECK_VERSION(0, 99, 0)
UpDeviceLevel warning_old;
UpDeviceLevel warning;
-#else
- GpmEngineWarning warning_old;
- GpmEngineWarning warning;
-#endif
/* get device properties */
g_object_get (device,
@@ -1154,10 +796,8 @@ phone_device_refresh_cb (GpmPhone *phone, guint idx, GpmEngine *engine)
static void
gpm_engine_init (GpmEngine *engine)
{
-#if UP_CHECK_VERSION(0, 99, 0)
GPtrArray *array = NULL;
guint i;
-#endif
guint idle_id;
engine->priv = gpm_engine_get_instance_private (engine);
@@ -1167,10 +807,6 @@ gpm_engine_init (GpmEngine *engine)
G_CALLBACK (gpm_engine_device_added_cb), engine);
g_signal_connect (engine->priv->client, "device-removed",
G_CALLBACK (gpm_engine_device_removed_cb), engine);
-#if !UP_CHECK_VERSION(0, 99, 0)
- g_signal_connect (engine->priv->client, "device-changed",
- G_CALLBACK (gpm_engine_device_changed_cb), engine);
-#endif
engine->priv->settings = g_settings_new (GPM_SETTINGS_SCHEMA);
g_signal_connect (engine->priv->settings, "changed",
@@ -1185,20 +821,9 @@ gpm_engine_init (GpmEngine *engine)
G_CALLBACK (phone_device_refresh_cb), engine);
/* create a fake virtual composite battery */
-#if UP_CHECK_VERSION(0, 99, 0)
engine->priv->battery_composite = up_client_get_display_device (engine->priv->client);
g_signal_connect (engine->priv->battery_composite, "notify",
G_CALLBACK (gpm_engine_device_changed_cb), engine);
-#else
- engine->priv->battery_composite = up_device_new ();
- g_object_set (engine->priv->battery_composite,
- "kind", UP_DEVICE_KIND_BATTERY,
- "is-rechargeable", TRUE,
- "native-path", "dummy:composite_battery",
- "power-supply", TRUE,
- "is-present", TRUE,
- NULL);
-#endif
engine->priv->previous_icon = NULL;
engine->priv->previous_summary = NULL;
diff --git a/src/gpm-kbd-backlight.c b/src/gpm-kbd-backlight.c
index 2be69f7..6f363e8 100644
--- a/src/gpm-kbd-backlight.c
+++ b/src/gpm-kbd-backlight.c
@@ -493,10 +493,8 @@ gpm_kbd_backlight_control_resume_cb (GpmControl *control,
**/
static void
gpm_kbd_backlight_client_changed_cb (UpClient *client,
-#if UP_CHECK_VERSION(0, 99, 0)
- GParamSpec *pspec,
-#endif
- GpmKbdBacklight *backlight)
+ GParamSpec *pspec,
+ GpmKbdBacklight *backlight)
{
gpm_kbd_backlight_evaluate_power_source_and_set (backlight);
}
@@ -760,13 +758,8 @@ noerr:
/* Use upower for ac changed signal */
backlight->priv->client = up_client_new ();
-#if UP_CHECK_VERSION(0, 99, 0)
g_signal_connect (backlight->priv->client, "notify",
G_CALLBACK (gpm_kbd_backlight_client_changed_cb), backlight);
-#else
- g_signal_connect (backlight->priv->client, "changed",
- G_CALLBACK (gpm_kbd_backlight_client_changed_cb), backlight);
-#endif
backlight->priv->settings = g_settings_new (GPM_SETTINGS_SCHEMA);
diff --git a/src/gpm-manager.c b/src/gpm-manager.c
index 1d70c5c..d4ed7b5 100644
--- a/src/gpm-manager.c
+++ b/src/gpm-manager.c
@@ -946,11 +946,7 @@ gpm_manager_button_pressed_cb (GpmButton *button, const gchar *type, GpmManager
* gpm_manager_client_changed_cb:
**/
static void
-#if UP_CHECK_VERSION(0, 99, 0)
gpm_manager_client_changed_cb (UpClient *client, GParamSpec *pspec, GpmManager *manager)
-#else
-gpm_manager_client_changed_cb (UpClient *client, GpmManager *manager)
-#endif
{
gboolean event_when_closed;
gint timeout;
@@ -1852,15 +1848,10 @@ gpm_manager_init (GpmManager *manager)
g_signal_connect (manager->priv->settings, "changed",
G_CALLBACK (gpm_manager_settings_changed_cb), manager);
manager->priv->client = up_client_new ();
-#if UP_CHECK_VERSION(0, 99, 0)
g_signal_connect (manager->priv->client, "notify::lid-is-closed",
G_CALLBACK (gpm_manager_client_changed_cb), manager);
g_signal_connect (manager->priv->client, "notify::on-battery",
G_CALLBACK (gpm_manager_client_changed_cb), manager);
-#else
- g_signal_connect (manager->priv->client, "changed",
- G_CALLBACK (gpm_manager_client_changed_cb), manager);
-#endif
/* use libmatenotify */
notify_init (GPM_NAME);
diff --git a/src/gpm-prefs-core.c b/src/gpm-prefs-core.c
index a0dea5a..e51e367 100644
--- a/src/gpm-prefs-core.c
+++ b/src/gpm-prefs-core.c
@@ -673,9 +673,6 @@ gpm_prefs_init (GpmPrefs *prefs)
UpDevice *device;
UpDeviceKind kind;
GpmBrightness *brightness;
-#if !UP_CHECK_VERSION(0, 99, 0)
- gboolean ret;
-#endif
guint i;
GDBusProxy *proxy;
@@ -810,14 +807,6 @@ gpm_prefs_init (GpmPrefs *prefs)
brightness = gpm_brightness_new ();
prefs->priv->has_lcd = gpm_brightness_has_hw (brightness);
g_object_unref (brightness);
-#if !UP_CHECK_VERSION(0, 99, 0)
- /* get device list */
- ret = up_client_enumerate_devices_sync (prefs->priv->client, NULL, &error);
- if (!ret) {
- egg_warning ("failed to get device list: %s", error->message);
- g_error_free (error);
- }
-#endif
devices = up_client_get_devices2 (prefs->priv->client);
for (i=0; i<devices->len; i++) {
device = g_ptr_array_index (devices, i);
diff --git a/src/gpm-statistics.c b/src/gpm-statistics.c
index 34541f6..5d18e30 100644
--- a/src/gpm-statistics.c
+++ b/src/gpm-statistics.c
@@ -1190,11 +1190,7 @@ gpm_stats_window_activated_cb (GtkApplication *app, gpointer data)
* gpm_stats_device_changed_cb:
**/
static void
-#if UP_CHECK_VERSION(0, 99, 0)
gpm_stats_device_changed_cb (UpDevice *device, GParamSpec *pspec, gpointer user_data)
-#else
-gpm_stats_device_changed_cb (UpClient *client, UpDevice *device, gpointer user_data)
-#endif
{
const gchar *object_path;
object_path = up_device_get_object_path (device);
@@ -1209,11 +1205,7 @@ gpm_stats_device_changed_cb (UpClient *client, UpDevice *device, gpointer user_d
* gpm_stats_add_device:
**/
static void
-#if UP_CHECK_VERSION(0, 99, 0)
gpm_stats_add_device (UpDevice *device, GPtrArray *devices)
-#else
-gpm_stats_add_device (UpDevice *device)
-#endif
{
const gchar *id;
GtkTreeIter iter;
@@ -1222,13 +1214,11 @@ gpm_stats_add_device (UpDevice *device)
UpDeviceKind kind;
gchar *label, *vendor, *model;
-#if UP_CHECK_VERSION(0, 99, 0)
if (devices != NULL)
g_ptr_array_add (devices, device);
g_signal_connect (device, "notify",
G_CALLBACK (gpm_stats_device_changed_cb), NULL);
-#endif
/* get device properties */
g_object_get (device,
@@ -1270,38 +1260,25 @@ gpm_stats_data_changed_cb (UpClient *client, gpointer user_data)
* gpm_stats_device_added_cb:
**/
static void
-#if UP_CHECK_VERSION(0, 99, 0)
gpm_stats_device_added_cb (UpClient *client, UpDevice *device, GPtrArray *devices)
-#else
-gpm_stats_device_added_cb (UpClient *client, UpDevice *device, gpointer user_data)
-#endif
{
const gchar *object_path;
object_path = up_device_get_object_path (device);
egg_debug ("added: %s", object_path);
-#if UP_CHECK_VERSION(0, 99, 0)
gpm_stats_add_device (device, devices);
-#else
- gpm_stats_add_device (device);
-#endif
}
/**
* gpm_stats_device_removed_cb:
**/
static void
-#if UP_CHECK_VERSION(0, 99, 0)
gpm_stats_device_removed_cb (UpClient *client, const gchar *object_path, GPtrArray *devices)
-#else
-gpm_stats_device_removed_cb (UpClient *client, UpDevice *device, gpointer user_data)
-#endif
{
GtkTreeIter iter;
gchar *id = NULL;
gboolean ret;
-#if UP_CHECK_VERSION(0, 99, 0)
UpDevice *device_tmp;
guint i;
@@ -1312,9 +1289,6 @@ gpm_stats_device_removed_cb (UpClient *client, UpDevice *device, gpointer user_d
break;
}
}
-#else
- const gchar *object_path = up_device_get_object_path (device);
-#endif
egg_debug ("removed: %s", object_path);
if (g_strcmp0 (current_device, object_path) == 0) {
gtk_list_store_clear (list_store_info);
@@ -1790,12 +1764,6 @@ main (int argc, char *argv[])
wakeups = up_wakeups_new ();
g_signal_connect (wakeups, "data-changed", G_CALLBACK (gpm_stats_data_changed_cb), NULL);
-#if !UP_CHECK_VERSION(0, 99, 0)
- /* coldplug */
- ret = up_client_enumerate_devices_sync (client, NULL, NULL);
- if (!ret)
- goto out;
-#endif
devices = up_client_get_devices2 (client);
/* add devices in visually pleasing order */
@@ -1804,24 +1772,14 @@ main (int argc, char *argv[])
device = g_ptr_array_index (devices, i);
g_object_get (device, "kind", &kind, NULL);
if (kind == j)
-#if UP_CHECK_VERSION(0, 99, 0)
/* NULL == do not add it to ptr array */
gpm_stats_add_device (device, NULL);
-#else
- gpm_stats_add_device (device);
-#endif
}
}
/* connect now the coldplug is done */
-#if UP_CHECK_VERSION(0, 99, 0)
g_signal_connect (client, "device-added", G_CALLBACK (gpm_stats_device_added_cb), devices);
g_signal_connect (client, "device-removed", G_CALLBACK (gpm_stats_device_removed_cb), devices);
-#else
- g_signal_connect (client, "device-added", G_CALLBACK (gpm_stats_device_added_cb), NULL);
- g_signal_connect (client, "device-removed", G_CALLBACK (gpm_stats_device_removed_cb), NULL);
- g_signal_connect (client, "device-changed", G_CALLBACK (gpm_stats_device_changed_cb), NULL);
-#endif
/* set current device */
if (devices->len > 0) {
@@ -1858,9 +1816,6 @@ main (int argc, char *argv[])
widget = GTK_WIDGET (gtk_builder_get_object (builder, "dialog_stats"));
status = g_application_run (G_APPLICATION (app), argc, argv);
-#if !UP_CHECK_VERSION(0, 99, 0)
-out:
-#endif
if (devices != NULL)
g_ptr_array_unref (devices);