diff options
-rw-r--r-- | src/session-menu-mgr.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/src/session-menu-mgr.c b/src/session-menu-mgr.c index f5b5bcf..394110c 100644 --- a/src/session-menu-mgr.c +++ b/src/session-menu-mgr.c @@ -247,23 +247,27 @@ session_menu_mgr_class_init (SessionMenuMgrClass * klass) static void on_upower_properties_changed (SessionMenuMgr * mgr) { - gboolean b; gboolean need_refresh = FALSE; - /* suspend */ - b = dbus_upower_get_can_suspend (mgr->upower_proxy); - if (mgr->can_suspend != b) + if (mgr->upower_proxy != NULL) { - mgr->can_suspend = b; - need_refresh = TRUE; - } + gboolean b; - /* hibernate */ - b = dbus_upower_get_can_hibernate (mgr->upower_proxy); - if (mgr->can_hibernate != b) - { - mgr->can_hibernate = b; - need_refresh = TRUE; + /* suspend */ + b = dbus_upower_get_can_suspend (mgr->upower_proxy); + if (mgr->can_suspend != b) + { + mgr->can_suspend = b; + need_refresh = TRUE; + } + + /* hibernate */ + b = dbus_upower_get_can_hibernate (mgr->upower_proxy); + if (mgr->can_hibernate != b) + { + mgr->can_hibernate = b; + need_refresh = TRUE; + } } if (need_refresh) |