diff options
author | Ted Gould <ted@gould.cx> | 2011-09-27 16:55:41 -0500 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2011-09-27 16:55:41 -0500 |
commit | 1e3f1b724bfbb1283b482ddd11db1ee417e4eeb3 (patch) | |
tree | 831776c7d01e111e88cd7767aa3cfc3d9d1f93f6 /src/gtk-logout-helper.c | |
parent | a316c5aac1ea8928f5da7cc916d534ea6eb7ab5e (diff) | |
parent | 18f3158453229388605760aa8e738a9adb65109b (diff) | |
download | ayatana-indicator-session-1e3f1b724bfbb1283b482ddd11db1ee417e4eeb3.tar.gz ayatana-indicator-session-1e3f1b724bfbb1283b482ddd11db1ee417e4eeb3.tar.bz2 ayatana-indicator-session-1e3f1b724bfbb1283b482ddd11db1ee417e4eeb3.zip |
Update to ubuntu-desktop version
Diffstat (limited to 'src/gtk-logout-helper.c')
-rw-r--r-- | src/gtk-logout-helper.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/gtk-logout-helper.c b/src/gtk-logout-helper.c index 33dce3a..9c1e6dd 100644 --- a/src/gtk-logout-helper.c +++ b/src/gtk-logout-helper.c @@ -31,6 +31,8 @@ with this program. If not, see <http://www.gnu.org/licenses/>. static void consolekit_fallback (LogoutDialogType action) { + g_debug("Falling back to using ConsoleKit for action"); + DBusGConnection * sbus = dbus_g_bus_get(DBUS_BUS_SYSTEM, NULL); g_return_if_fail(sbus != NULL); /* worst case */ DBusGProxy * proxy = dbus_g_proxy_new_for_name(sbus, "org.freedesktop.ConsoleKit", @@ -49,12 +51,14 @@ consolekit_fallback (LogoutDialogType action) g_warning("Unable to fallback to ConsoleKit for logout as it's a session issue. We need some sort of session handler."); break; case LOGOUT_DIALOG_TYPE_SHUTDOWN: + g_debug("Telling ConsoleKit to 'Stop'"); dbus_g_proxy_call(proxy, "Stop", &error, G_TYPE_INVALID); break; case LOGOUT_DIALOG_TYPE_RESTART: + g_debug("Telling ConsoleKit to 'Restart'"); dbus_g_proxy_call(proxy, "Restart", &error, @@ -104,12 +108,15 @@ session_action (LogoutDialogType action) g_clear_error (&error); if (action == LOGOUT_DIALOG_TYPE_LOG_OUT) { + g_debug("Asking Session manager to 'Logout'"); res = dbus_g_proxy_call_with_timeout (sm_proxy, "Logout", INT_MAX, &error, G_TYPE_UINT, 1, G_TYPE_INVALID, G_TYPE_INVALID); } else if (action == LOGOUT_DIALOG_TYPE_SHUTDOWN) { + g_debug("Asking Session manager to 'RequestShutdown'"); res = dbus_g_proxy_call_with_timeout (sm_proxy, "RequestShutdown", INT_MAX, &error, G_TYPE_INVALID, G_TYPE_INVALID); } else if (action == LOGOUT_DIALOG_TYPE_RESTART) { + g_debug("Asking Session manager to 'RequestReboot'"); res = dbus_g_proxy_call_with_timeout (sm_proxy, "RequestReboot", INT_MAX, &error, G_TYPE_INVALID, G_TYPE_INVALID); } else { @@ -122,6 +129,8 @@ session_action (LogoutDialogType action) } else { g_warning ("SessionManager action failed: unknown error"); } + + consolekit_fallback(action); } g_object_unref(sm_proxy); @@ -139,6 +148,7 @@ static gboolean option_logout (const gchar * arg, const gchar * value, gpointer data, GError * error) { type = LOGOUT_DIALOG_TYPE_LOG_OUT; + g_debug("Dialog type: logout"); return TRUE; } @@ -146,6 +156,7 @@ static gboolean option_shutdown (const gchar * arg, const gchar * value, gpointer data, GError * error) { type = LOGOUT_DIALOG_TYPE_SHUTDOWN; + g_debug("Dialog type: shutdown"); return TRUE; } @@ -153,6 +164,7 @@ static gboolean option_restart (const gchar * arg, const gchar * value, gpointer data, GError * error) { type = LOGOUT_DIALOG_TYPE_RESTART; + g_debug("Dialog type: restart"); return TRUE; } @@ -193,6 +205,7 @@ main (int argc, char * argv[]) GtkWidget * dialog = NULL; if (!supress_confirmations()) { + g_debug("Showing dialog to ask for user confirmation"); dialog = GTK_WIDGET(logout_dialog_new(type)); } @@ -200,17 +213,27 @@ main (int argc, char * argv[]) GtkResponseType response = gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_hide(dialog); + if (response == GTK_RESPONSE_OK) { + g_debug("Dialog return response: 'okay'"); + } else if (response == GTK_RESPONSE_HELP) { + g_debug("Dialog return response: 'help'"); + } else { + g_debug("Dialog return response: %d", response); + } + if (response == GTK_RESPONSE_HELP) { type = LOGOUT_DIALOG_TYPE_RESTART; response = GTK_RESPONSE_OK; } if (response != GTK_RESPONSE_OK) { + g_debug("Final response was not okay, quiting"); return 0; } } session_action(type); + g_debug("Finished action, quiting"); return 0; } |