[gnome-panel/wip/gnome-3.10+] panel-session-manager: don't make sync calls for Logout and Shutdown
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-panel/wip/gnome-3.10+] panel-session-manager: don't make sync calls for Logout and Shutdown
- Date: Wed, 13 Aug 2014 23:05:15 +0000 (UTC)
commit 1ecf19289f9850474d6a94eecb58e38c9cf9eef1
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Thu Aug 14 02:03:42 2014 +0300
panel-session-manager: don't make sync calls for Logout and Shutdown
gnome-panel/libpanel-util/panel-session-manager.c | 84 ++++++++++++--------
1 files changed, 50 insertions(+), 34 deletions(-)
---
diff --git a/gnome-panel/libpanel-util/panel-session-manager.c
b/gnome-panel/libpanel-util/panel-session-manager.c
index f988ed0..bd12a82 100644
--- a/gnome-panel/libpanel-util/panel-session-manager.c
+++ b/gnome-panel/libpanel-util/panel-session-manager.c
@@ -189,13 +189,30 @@ panel_session_manager_get_presence (PanelSessionManager *manager)
return ret;
}
+static void
+logout_ready_callback (GObject *source_object,
+ GAsyncResult *res,
+ gpointer user_data)
+{
+ PanelSessionManager *manager = (PanelSessionManager *) user_data;
+ GError *error = NULL;
+ GVariant *ret;
+
+ ret = g_dbus_proxy_call_finish (manager->priv->session_proxy, res, &error);
+ if (ret) {
+ g_variant_unref (ret);
+ }
+
+ if (error) {
+ g_warning ("Could not ask session manager to log out: %s", error->message);
+ g_error_free (error);
+ }
+}
+
void
panel_session_manager_request_logout (PanelSessionManager *manager,
PanelSessionManagerLogoutType mode)
{
- GVariant *ret;
- GError *error;
-
g_return_if_fail (PANEL_IS_SESSION_MANAGER (manager));
if (!manager->priv->session_proxy) {
@@ -203,21 +220,32 @@ panel_session_manager_request_logout (PanelSessionManager *manager,
return;
}
- error = NULL;
- ret = g_dbus_proxy_call_sync (manager->priv->session_proxy,
- "Logout",
- g_variant_new ("(u)", mode),
- G_DBUS_CALL_FLAGS_NONE,
- -1,
- NULL,
- &error);
+ g_dbus_proxy_call (manager->priv->session_proxy,
+ "Logout",
+ g_variant_new ("(u)", mode),
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ NULL,
+ (GAsyncReadyCallback) logout_ready_callback,
+ manager);
+}
- if (ret)
+static void
+shutdown_ready_callback (GObject *source_object,
+ GAsyncResult *res,
+ gpointer user_data)
+{
+ PanelSessionManager *manager = (PanelSessionManager *) user_data;
+ GError *error = NULL;
+ GVariant *ret;
+
+ ret = g_dbus_proxy_call_finish (manager->priv->session_proxy, res, &error);
+ if (ret) {
g_variant_unref (ret);
+ }
if (error) {
- g_warning ("Could not ask session manager to log out: %s",
- error->message);
+ g_warning ("Could not ask session manager to shut down: %s", error->message);
g_error_free (error);
}
}
@@ -225,9 +253,6 @@ panel_session_manager_request_logout (PanelSessionManager *manager,
void
panel_session_manager_request_shutdown (PanelSessionManager *manager)
{
- GVariant *ret;
- GError *error;
-
g_return_if_fail (PANEL_IS_SESSION_MANAGER (manager));
if (!manager->priv->session_proxy) {
@@ -235,23 +260,14 @@ panel_session_manager_request_shutdown (PanelSessionManager *manager)
return;
}
- error = NULL;
- ret = g_dbus_proxy_call_sync (manager->priv->session_proxy,
- "Shutdown",
- NULL,
- G_DBUS_CALL_FLAGS_NONE,
- -1,
- NULL,
- &error);
-
- if (ret)
- g_variant_unref (ret);
-
- if (error) {
- g_warning ("Could not ask session manager to shut down: %s",
- error->message);
- g_error_free (error);
- }
+ g_dbus_proxy_call (manager->priv->session_proxy,
+ "Shutdown",
+ NULL,
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ NULL,
+ (GAsyncReadyCallback) shutdown_ready_callback,
+ manager);
}
gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]