summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2013-10-14 09:16:06 +0200
committerBastien Nocera <hadess@hadess.net>2013-10-14 11:06:53 +0200
commitac1708e86e0f87c25e5cf7e11a82324c5d002fba (patch)
treebe716d62b8eee8a6ae21597eb2f4015bea2941a0
parentd2484d4ec143348628f7129f21ad1fce23050b22 (diff)
downloadupower-ac1708e86e0f87c25e5cf7e11a82324c5d002fba.tar.gz
daemon: Require newer GLib
And remove ifdef's.
-rw-r--r--configure.ac2
-rw-r--r--src/dummy/up-backend.c2
-rw-r--r--src/freebsd/up-backend.c2
-rw-r--r--src/linux/up-device-csr.c2
-rw-r--r--src/linux/up-device-hid.c2
-rw-r--r--src/linux/up-device-idevice.c2
-rw-r--r--src/linux/up-device-supply.c5
-rw-r--r--src/linux/up-device-wup.c2
-rw-r--r--src/up-daemon.c2
-rw-r--r--src/up-history.c2
-rw-r--r--src/up-main.c32
-rw-r--r--src/up-wakeups.c7
12 files changed, 4 insertions, 58 deletions
diff --git a/configure.ac b/configure.ac
index d5f6426..d5835a9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -152,7 +152,7 @@ AX_CHECK_LINK_FLAG([-Wl,-z,relro,-z,now],
[RELRO_LDFLAGS="-Wl,-z,relro,-z,now"])
AC_SUBST([RELRO_LDFLAGS])
-PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.21.5])
+PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.29.19])
PKG_CHECK_MODULES(DBUS, [dbus-1 >= 1.0])
PKG_CHECK_MODULES(DBUS_GLIB, [dbus-glib-1 >= 0.76])
PKG_CHECK_MODULES(POLKIT, polkit-gobject-1 >= 0.97)
diff --git a/src/dummy/up-backend.c b/src/dummy/up-backend.c
index d9d4a59..adc3bbb 100644
--- a/src/dummy/up-backend.c
+++ b/src/dummy/up-backend.c
@@ -100,9 +100,7 @@ up_backend_add_cb (UpBackend *backend)
/* setup poll */
timer_id = g_timeout_add_seconds (2, (GSourceFunc) up_backend_changed_time_cb, backend);
-#if GLIB_CHECK_VERSION(2,25,8)
g_source_set_name_by_id (timer_id, "[UpBackend] changed");
-#endif
out:
return FALSE;
}
diff --git a/src/freebsd/up-backend.c b/src/freebsd/up-backend.c
index 1466bbf..949f3cd 100644
--- a/src/freebsd/up-backend.c
+++ b/src/freebsd/up-backend.c
@@ -288,9 +288,7 @@ up_backend_coldplug (UpBackend *backend, UpDaemon *daemon)
g_timeout_add_seconds (UP_BACKEND_REFRESH_TIMEOUT,
(GSourceFunc) up_backend_refresh_devices,
backend);
-#if GLIB_CHECK_VERSION(2,25,8)
g_source_set_name_by_id (backend->priv->poll_timer_id, "[FreeBSD:UpBackend] poll");
-#endif
return TRUE;
}
diff --git a/src/linux/up-device-csr.c b/src/linux/up-device-csr.c
index 545d5b2..ca6eb3d 100644
--- a/src/linux/up-device-csr.c
+++ b/src/linux/up-device-csr.c
@@ -209,9 +209,7 @@ up_device_csr_coldplug (UpDevice *device)
csr->priv->poll_timer_id = g_timeout_add_seconds (UP_DEVICE_CSR_REFRESH_TIMEOUT,
(GSourceFunc) up_device_csr_poll_cb, csr);
-#if GLIB_CHECK_VERSION(2,25,8)
g_source_set_name_by_id (csr->priv->poll_timer_id, "[UpDeviceCsr] poll");
-#endif
out:
return ret;
}
diff --git a/src/linux/up-device-hid.c b/src/linux/up-device-hid.c
index a7bb07c..5babd8d 100644
--- a/src/linux/up-device-hid.c
+++ b/src/linux/up-device-hid.c
@@ -475,9 +475,7 @@ up_device_hid_init (UpDeviceHid *hid)
hid->priv->fd = -1;
hid->priv->poll_timer_id = g_timeout_add_seconds (UP_DEVICE_HID_REFRESH_TIMEOUT,
(GSourceFunc) up_device_hid_poll, hid);
-#if GLIB_CHECK_VERSION(2,25,8)
g_source_set_name_by_id (hid->priv->poll_timer_id, "[UpDeviceHid] poll");
-#endif
}
/**
diff --git a/src/linux/up-device-idevice.c b/src/linux/up-device-idevice.c
index 2903c2f..8e31e11 100644
--- a/src/linux/up-device-idevice.c
+++ b/src/linux/up-device-idevice.c
@@ -153,9 +153,7 @@ up_device_idevice_coldplug (UpDevice *device)
idevice->priv->poll_timer_id = g_timeout_add_seconds (poll_seconds,
(GSourceFunc) up_device_idevice_poll_cb, idevice);
-#if GLIB_CHECK_VERSION(2,25,8)
g_source_set_name_by_id (idevice->priv->poll_timer_id, "[UpDeviceIdevice] poll");
-#endif
return TRUE;
out:
diff --git a/src/linux/up-device-supply.c b/src/linux/up-device-supply.c
index 48bf786..ff9449f 100644
--- a/src/linux/up-device-supply.c
+++ b/src/linux/up-device-supply.c
@@ -960,9 +960,8 @@ up_device_supply_setup_poll (UpDevice *device)
supply->priv->poll_timer_id =
g_timeout_add_seconds (UP_DEVICE_SUPPLY_UNKNOWN_TIMEOUT,
(GSourceFunc) up_device_supply_poll_battery, supply);
-#if GLIB_CHECK_VERSION(2,25,8)
g_source_set_name_by_id (supply->priv->poll_timer_id, "[UpDeviceSupply] unknown poll");
-#endif
+
/* increase count, we don't want to poll at 0.5Hz forever */
supply->priv->unknown_retries++;
goto out;
@@ -972,9 +971,7 @@ up_device_supply_setup_poll (UpDevice *device)
supply->priv->poll_timer_id =
g_timeout_add_seconds (UP_DEVICE_SUPPLY_REFRESH_TIMEOUT,
(GSourceFunc) up_device_supply_poll_battery, supply);
-#if GLIB_CHECK_VERSION(2,25,8)
g_source_set_name_by_id (supply->priv->poll_timer_id, "[UpDeviceSupply] normal poll");
-#endif
out:
return (supply->priv->poll_timer_id != 0);
}
diff --git a/src/linux/up-device-wup.c b/src/linux/up-device-wup.c
index f093ee3..6f1d3f7 100644
--- a/src/linux/up-device-wup.c
+++ b/src/linux/up-device-wup.c
@@ -426,9 +426,7 @@ up_device_wup_init (UpDeviceWup *wup)
wup->priv->fd = -1;
wup->priv->poll_timer_id = g_timeout_add_seconds (UP_DEVICE_WUP_REFRESH_TIMEOUT,
(GSourceFunc) up_device_wup_poll_cb, wup);
-#if GLIB_CHECK_VERSION(2,25,8)
g_source_set_name_by_id (wup->priv->poll_timer_id, "[UpDeviceWup] poll");
-#endif
}
/**
diff --git a/src/up-daemon.c b/src/up-daemon.c
index 1edfdee..9651999 100644
--- a/src/up-daemon.c
+++ b/src/up-daemon.c
@@ -624,9 +624,7 @@ up_daemon_poll_battery_devices_for_a_little_bit (UpDaemon *daemon)
priv->battery_poll_id =
g_timeout_add_seconds (UP_DAEMON_ON_BATTERY_REFRESH_DEVICES_DELAY,
(GSourceFunc) up_daemon_refresh_battery_devices_cb, daemon);
-#if GLIB_CHECK_VERSION(2,25,8)
g_source_set_name_by_id (priv->battery_poll_id, "[UpDaemon] poll batteries for AC event");
-#endif
}
/**
diff --git a/src/up-history.c b/src/up-history.c
index b73f6a0..1751948 100644
--- a/src/up-history.c
+++ b/src/up-history.c
@@ -652,9 +652,7 @@ up_history_schedule_save (UpHistory *history)
g_debug ("saving in %i seconds", UP_HISTORY_SAVE_INTERVAL);
history->priv->save_id = g_timeout_add_seconds (UP_HISTORY_SAVE_INTERVAL,
(GSourceFunc) up_history_schedule_save_cb, history);
-#if GLIB_CHECK_VERSION(2,25,8)
g_source_set_name_by_id (history->priv->save_id, "[UpHistory] save");
-#endif
return TRUE;
}
diff --git a/src/up-main.c b/src/up-main.c
index ff9fbaf..de6dc12 100644
--- a/src/up-main.c
+++ b/src/up-main.c
@@ -30,6 +30,7 @@
#include <unistd.h>
#include <glib.h>
+#include <glib-unix.h>
#include <glib/gi18n-lib.h>
#include <glib-object.h>
#include <locale.h>
@@ -41,10 +42,6 @@
#include "up-kbd-backlight.h"
#include "up-wakeups.h"
-#if GLIB_CHECK_VERSION(2,29,19)
- #include <glib-unix.h>
-#endif
-
#define DEVKIT_POWER_SERVICE_NAME "org.freedesktop.UPower"
static GMainLoop *loop = NULL;
@@ -92,8 +89,6 @@ out:
return ret;
}
-#if GLIB_CHECK_VERSION(2,29,19)
-
/**
* up_main_sigint_cb:
**/
@@ -105,25 +100,6 @@ up_main_sigint_cb (gpointer user_data)
return FALSE;
}
-#else
-
-/**
- * up_main_sigint_handler:
- **/
-static void
-up_main_sigint_handler (gint sig)
-{
- g_debug ("Handling SIGINT");
-
- /* restore default */
- signal (SIGINT, SIG_DFL);
-
- /* cleanup */
- g_main_loop_quit (loop);
-}
-
-#endif
-
/**
* up_main_timed_exit_cb:
*
@@ -269,16 +245,12 @@ main (gint argc, gchar **argv)
goto out;
}
-#if GLIB_CHECK_VERSION(2,29,19)
/* do stuff on ctrl-c */
g_unix_signal_add_full (G_PRIORITY_DEFAULT,
SIGINT,
up_main_sigint_cb,
loop,
NULL);
-#else
- signal (SIGINT, up_main_sigint_handler);
-#endif
g_debug ("Starting upowerd version %s", PACKAGE_VERSION);
@@ -295,9 +267,7 @@ main (gint argc, gchar **argv)
/* only timeout and close the mainloop if we have specified it on the command line */
if (timed_exit) {
timer_id = g_timeout_add_seconds (30, (GSourceFunc) up_main_timed_exit_cb, loop);
-#if GLIB_CHECK_VERSION(2,25,8)
g_source_set_name_by_id (timer_id, "[UpMain] idle");
-#endif
}
/* immediatly exit */
diff --git a/src/up-wakeups.c b/src/up-wakeups.c
index 6a883db..ee7368a 100644
--- a/src/up-wakeups.c
+++ b/src/up-wakeups.c
@@ -634,9 +634,7 @@ up_wakeups_timerstats_enable (UpWakeups *wakeups)
wakeups->priv->disable_id =
g_timeout_add_seconds (UP_WAKEUPS_DISABLE_INTERVAL,
(GSourceFunc) up_wakeups_disable_cb, wakeups);
-#if GLIB_CHECK_VERSION(2,25,8)
g_source_set_name_by_id (wakeups->priv->disable_id, "[UpWakeups] disable");
-#endif
/* already same state */
if (wakeups->priv->polling_enabled)
@@ -648,15 +646,12 @@ up_wakeups_timerstats_enable (UpWakeups *wakeups)
wakeups->priv->poll_kernel_id =
g_timeout_add_seconds (UP_WAKEUPS_POLL_INTERVAL_KERNEL,
(GSourceFunc) up_wakeups_poll_kernel_cb, wakeups);
-#if GLIB_CHECK_VERSION(2,25,8)
g_source_set_name_by_id (wakeups->priv->poll_kernel_id, "[UpWakeups] kernel");
-#endif
+
wakeups->priv->poll_userspace_id =
g_timeout_add_seconds (UP_WAKEUPS_POLL_INTERVAL_USERSPACE,
(GSourceFunc) up_wakeups_poll_userspace_cb, wakeups);
-#if GLIB_CHECK_VERSION(2,25,8)
g_source_set_name_by_id (wakeups->priv->poll_userspace_id, "[UpWakeups] userspace");
-#endif
file = fopen (UP_WAKEUPS_SOURCE_USERSPACE, "w");
if (file == NULL)