[gnome-settings-daemon/docking-stations] Add gnome_settings_session_get_upower_client()
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon/docking-stations] Add gnome_settings_session_get_upower_client()
- Date: Wed, 7 Dec 2011 19:11:30 +0000 (UTC)
commit a6d232b4696542ff221413dd15343e78a9e79556
Author: Federico Mena Quintero <federico gnome org>
Date: Wed Dec 7 11:11:34 2011 -0600
Add gnome_settings_session_get_upower_client()
Similar to how gnome_settings_session_get_screen() is used to share a single
GnomeRRScreen across the plugins, we now share a single UpClient for power-related
plugins. In particular, this will let us simplify the code that deals
with closing the laptop's lid in the power and xrandr plugins.
Signed-off-by: Federico Mena Quintero <federico gnome org>
gnome-settings-daemon/Makefile.am | 2 ++
gnome-settings-daemon/gnome-settings-session.c | 14 ++++++++++++++
gnome-settings-daemon/gnome-settings-session.h | 6 ++++++
3 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/gnome-settings-daemon/Makefile.am b/gnome-settings-daemon/Makefile.am
index 7e0e092..37734a7 100644
--- a/gnome-settings-daemon/Makefile.am
+++ b/gnome-settings-daemon/Makefile.am
@@ -9,6 +9,7 @@ INCLUDES = \
$(DISABLE_DEPRECATED_CFLAGS) \
$(SETTINGS_DAEMON_CFLAGS) \
$(LIBNOTIFY_CFLAGS) \
+ $(UPOWER_CFLAGS) \
$(GNOME_DESKTOP_CFLAGS) \
$(NULL)
@@ -75,6 +76,7 @@ gnome_settings_daemon_LDADD = \
libgsd-profile.la \
$(SETTINGS_DAEMON_LIBS) \
$(LIBNOTIFY_LIBS) \
+ $(UPOWER_LIBS) \
$(GNOME_DESKTOP_LIBS) \
$(NULL)
diff --git a/gnome-settings-daemon/gnome-settings-session.c b/gnome-settings-daemon/gnome-settings-session.c
index d32490a..d7c90ed 100644
--- a/gnome-settings-daemon/gnome-settings-session.c
+++ b/gnome-settings-daemon/gnome-settings-session.c
@@ -322,3 +322,17 @@ gnome_settings_session_get_screen (GError **error)
return screen;
}
+
+UpClient *
+gnome_settings_session_get_upower_client (void)
+{
+ static UpClient *client;
+
+ if (client != NULL)
+ return g_object_ref (client);
+
+ client = up_client_new ();
+ g_object_add_weak_pointer (G_OBJECT (client), (gpointer *) &client);
+
+ return client;
+}
diff --git a/gnome-settings-daemon/gnome-settings-session.h b/gnome-settings-daemon/gnome-settings-session.h
index ba93cf2..9105d75 100644
--- a/gnome-settings-daemon/gnome-settings-session.h
+++ b/gnome-settings-daemon/gnome-settings-session.h
@@ -27,6 +27,8 @@
#define GNOME_DESKTOP_USE_UNSTABLE_API
#include <libgnome-desktop/gnome-rr.h>
+#include <libupower-glib/upower.h>
+
G_BEGIN_DECLS
#define GNOME_TYPE_SETTINGS_SESSION (gnome_settings_session_get_type ())
@@ -63,6 +65,10 @@ GnomeSettingsSessionState gnome_settings_session_get_state (GnomeSettingsSession
GnomeRRScreen *gnome_settings_session_get_screen (GError **error);
+UpClient *gnome_settings_session_get_upower_client (void);
+
+
+
G_END_DECLS
#endif /* __GNOME_SETTINGS_SESSION_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]