automount: port from CK to systemd-logind
ConsoleKit is being obsoleted by systemd. Accordingly port the CK logic in the gnome-shell automount manager to systemd-logind APIs. This makes use of systemd-logind's native C APIs which are much easier to use than the D-Bus APIs in this case, and much faster too (since they are synchronous and directly query the kernel for the information we need). The dependency is compile time optional, and in order to be nice to the Debian folks g-s compiled with this enabled fill automatically fall back to CK support on systems lacking systemd.
This commit is contained in:
@ -81,6 +81,7 @@ include Makefile-hotplug-sniffer.am
|
||||
|
||||
gnome_shell_cflags = \
|
||||
$(GNOME_SHELL_CFLAGS) \
|
||||
$(SYSTEMD_CFLAGS) \
|
||||
-I$(srcdir)/tray \
|
||||
-DVERSION=\"$(VERSION)\" \
|
||||
-DLOCALEDIR=\"$(datadir)/locale\" \
|
||||
@ -279,6 +280,7 @@ libgnome_shell_la_LDFLAGS = -avoid-version
|
||||
libgnome_shell_la_LIBADD = \
|
||||
-lm \
|
||||
$(GNOME_SHELL_LIBS) \
|
||||
$(SYSTEMD_LIBS) \
|
||||
$(BLUETOOTH_LIBS) \
|
||||
libst-1.0.la \
|
||||
libtray.la \
|
||||
|
@ -14,6 +14,11 @@
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/xmlmemory.h>
|
||||
|
||||
#ifdef WITH_SYSTEMD
|
||||
#include <systemd/sd-daemon.h>
|
||||
#include <systemd/sd-login.h>
|
||||
#endif
|
||||
|
||||
/* Some code in this file adapted under the GPLv2+ from:
|
||||
*
|
||||
* GNOME panel utils: gnome-panel/gnome-panel/panel-util.c
|
||||
@ -833,3 +838,26 @@ shell_shader_effect_set_double_uniform (ClutterShaderEffect *effect,
|
||||
name,
|
||||
&gvalue);
|
||||
}
|
||||
|
||||
/**
|
||||
* shell_session_is_active_for_systemd:
|
||||
*
|
||||
* Checks whether the session we are running in is currently active,
|
||||
* i.e. in the foreground and ready for user input.
|
||||
*
|
||||
* Returns: TRUE if session is active
|
||||
*/
|
||||
gboolean
|
||||
shell_session_is_active_for_systemd (void)
|
||||
{
|
||||
/* If this isn't systemd, let's assume the session is active. */
|
||||
|
||||
#ifdef WITH_SYSTEMD
|
||||
if (sd_booted () <= 0)
|
||||
return TRUE;
|
||||
|
||||
return sd_session_is_active (NULL) != 0;
|
||||
#else
|
||||
return TRUE;
|
||||
#endif
|
||||
}
|
||||
|
@ -50,6 +50,8 @@ void shell_shader_effect_set_double_uniform (ClutterShaderEffect *effect,
|
||||
const gchar *name,
|
||||
gdouble value);
|
||||
|
||||
gboolean shell_session_is_active_for_systemd (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __SHELL_UTIL_H__ */
|
||||
|
Reference in New Issue
Block a user