aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2012-06-05 14:47:02 -0500
committerCharles Kerr <charles.kerr@canonical.com>2012-06-05 14:47:02 -0500
commit4e1238c75f3d4c239c61b5c2b841675823a4053f (patch)
tree77f2391e91f5f170fb74b8da0ea231ac2700a8f1 /src
parentee9720fc918870672c16f3e44e36661010b2faf2 (diff)
downloadayatana-indicator-session-4e1238c75f3d4c239c61b5c2b841675823a4053f.tar.gz
ayatana-indicator-session-4e1238c75f3d4c239c61b5c2b841675823a4053f.tar.bz2
ayatana-indicator-session-4e1238c75f3d4c239c61b5c2b841675823a4053f.zip
make suspend_call and hibernate_call instance variables rather than global ones so that their pointer values won't persist between test sessions
Diffstat (limited to 'src')
-rw-r--r--src/device-menu-mgr.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/device-menu-mgr.c b/src/device-menu-mgr.c
index df63d8d..7821034 100644
--- a/src/device-menu-mgr.c
+++ b/src/device-menu-mgr.c
@@ -57,13 +57,13 @@ struct _DeviceMenuMgr
gboolean can_suspend;
gboolean allow_hibernate;
gboolean allow_suspend;
+
+ DBusGProxyCall * suspend_call;
+ DBusGProxyCall * hibernate_call;
};
static DbusmenuMenuitem *lock_menuitem = NULL;
-static DBusGProxyCall * suspend_call = NULL;
-static DBusGProxyCall * hibernate_call = NULL;
-
static void setup_up (DeviceMenuMgr* self);
static void device_menu_mgr_rebuild_items (DeviceMenuMgr *self);
static void machine_sleep_with_context (DeviceMenuMgr* self,
@@ -195,8 +195,9 @@ machine_sleep_with_context (DeviceMenuMgr* self, gchar* type)
static void
suspend_prop_cb (DBusGProxy * proxy, DBusGProxyCall * call, gpointer userdata)
{
- suspend_call = NULL;
DeviceMenuMgr* self = DEVICE_MENU_MGR (userdata);
+
+ self->suspend_call = NULL;
GValue candoit = {0};
GError * error = NULL;
@@ -223,9 +224,10 @@ suspend_prop_cb (DBusGProxy * proxy, DBusGProxyCall * call, gpointer userdata)
static void
hibernate_prop_cb (DBusGProxy * proxy, DBusGProxyCall * call, gpointer userdata)
{
- hibernate_call = NULL;
DeviceMenuMgr* self = DEVICE_MENU_MGR (userdata);
+ self->hibernate_call = NULL;
+
GValue candoit = {0};
GError * error = NULL;
dbus_g_proxy_end_call(proxy, call, &error, G_TYPE_VALUE, &candoit, G_TYPE_INVALID);
@@ -251,8 +253,8 @@ up_changed_cb (DBusGProxy * proxy, gpointer user_data)
DeviceMenuMgr * self = DEVICE_MENU_MGR(user_data);
/* Start Async call to see if we can hibernate */
- if (suspend_call == NULL) {
- suspend_call = dbus_g_proxy_begin_call(self->up_prop_proxy,
+ if (self->suspend_call == NULL) {
+ self->suspend_call = dbus_g_proxy_begin_call(self->up_prop_proxy,
"Get",
suspend_prop_cb,
user_data,
@@ -267,8 +269,8 @@ up_changed_cb (DBusGProxy * proxy, gpointer user_data)
}
/* Start Async call to see if we can suspend */
- if (hibernate_call == NULL) {
- hibernate_call = dbus_g_proxy_begin_call(self->up_prop_proxy,
+ if (self->hibernate_call == NULL) {
+ self->hibernate_call = dbus_g_proxy_begin_call(self->up_prop_proxy,
"Get",
hibernate_prop_cb,
user_data,