mirror of
https://gitlab.freedesktop.org/upower/upower.git
synced 2026-05-08 13:38:01 +02:00
daemon: Require newer GLib
And remove ifdef's.
This commit is contained in:
parent
d2484d4ec1
commit
ac1708e86e
12 changed files with 4 additions and 58 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue