Merge lp:~ted/indicator-session/gtk-logout-debug-messages into lp:indicator-session/0.1

Proposed by Ted Gould
Status: Merged
Merged at revision: 209
Proposed branch: lp:~ted/indicator-session/gtk-logout-debug-messages
Merge into: lp:indicator-session/0.1
Diff against target: 112 lines (+23/-0)
1 file modified
src/gtk-logout-helper.c (+23/-0)
To merge this branch: bzr merge lp:~ted/indicator-session/gtk-logout-debug-messages
Reviewer Review Type Date Requested Status
Conor Curran (community) Approve
Review via email: mp+74541@code.launchpad.net

Description of the change

Some debug messages, let's route out the bugs!

To post a comment you must log in.
Revision history for this message
Conor Curran (cjcurran) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/gtk-logout-helper.c'
2--- src/gtk-logout-helper.c 2011-08-19 18:13:57 +0000
3+++ src/gtk-logout-helper.c 2011-09-08 03:12:24 +0000
4@@ -31,6 +31,8 @@
5 static void
6 consolekit_fallback (LogoutDialogType action)
7 {
8+ g_debug("Falling back to using ConsoleKit for action");
9+
10 DBusGConnection * sbus = dbus_g_bus_get(DBUS_BUS_SYSTEM, NULL);
11 g_return_if_fail(sbus != NULL); /* worst case */
12 DBusGProxy * proxy = dbus_g_proxy_new_for_name(sbus, "org.freedesktop.ConsoleKit",
13@@ -49,12 +51,14 @@
14 g_warning("Unable to fallback to ConsoleKit for logout as it's a session issue. We need some sort of session handler.");
15 break;
16 case LOGOUT_DIALOG_TYPE_SHUTDOWN:
17+ g_debug("Telling ConsoleKit to 'Stop'");
18 dbus_g_proxy_call(proxy,
19 "Stop",
20 &error,
21 G_TYPE_INVALID);
22 break;
23 case LOGOUT_DIALOG_TYPE_RESTART:
24+ g_debug("Telling ConsoleKit to 'Restart'");
25 dbus_g_proxy_call(proxy,
26 "Restart",
27 &error,
28@@ -104,12 +108,15 @@
29 g_clear_error (&error);
30
31 if (action == LOGOUT_DIALOG_TYPE_LOG_OUT) {
32+ g_debug("Asking Session manager to 'Logout'");
33 res = dbus_g_proxy_call_with_timeout (sm_proxy, "Logout", INT_MAX, &error,
34 G_TYPE_UINT, 1, G_TYPE_INVALID, G_TYPE_INVALID);
35 } else if (action == LOGOUT_DIALOG_TYPE_SHUTDOWN) {
36+ g_debug("Asking Session manager to 'RequestShutdown'");
37 res = dbus_g_proxy_call_with_timeout (sm_proxy, "RequestShutdown", INT_MAX, &error,
38 G_TYPE_INVALID, G_TYPE_INVALID);
39 } else if (action == LOGOUT_DIALOG_TYPE_RESTART) {
40+ g_debug("Asking Session manager to 'RequestReboot'");
41 res = dbus_g_proxy_call_with_timeout (sm_proxy, "RequestReboot", INT_MAX, &error,
42 G_TYPE_INVALID, G_TYPE_INVALID);
43 } else {
44@@ -122,6 +129,8 @@
45 } else {
46 g_warning ("SessionManager action failed: unknown error");
47 }
48+
49+ consolekit_fallback(action);
50 }
51
52 g_object_unref(sm_proxy);
53@@ -139,6 +148,7 @@
54 option_logout (const gchar * arg, const gchar * value, gpointer data, GError * error)
55 {
56 type = LOGOUT_DIALOG_TYPE_LOG_OUT;
57+ g_debug("Dialog type: logout");
58 return TRUE;
59 }
60
61@@ -146,6 +156,7 @@
62 option_shutdown (const gchar * arg, const gchar * value, gpointer data, GError * error)
63 {
64 type = LOGOUT_DIALOG_TYPE_SHUTDOWN;
65+ g_debug("Dialog type: shutdown");
66 return TRUE;
67 }
68
69@@ -153,6 +164,7 @@
70 option_restart (const gchar * arg, const gchar * value, gpointer data, GError * error)
71 {
72 type = LOGOUT_DIALOG_TYPE_RESTART;
73+ g_debug("Dialog type: restart");
74 return TRUE;
75 }
76
77@@ -193,6 +205,7 @@
78
79 GtkWidget * dialog = NULL;
80 if (!supress_confirmations()) {
81+ g_debug("Showing dialog to ask for user confirmation");
82 dialog = GTK_WIDGET(logout_dialog_new(type));
83 }
84
85@@ -200,17 +213,27 @@
86 GtkResponseType response = gtk_dialog_run(GTK_DIALOG(dialog));
87 gtk_widget_hide(dialog);
88
89+ if (response == GTK_RESPONSE_OK) {
90+ g_debug("Dialog return response: 'okay'");
91+ } else if (response == GTK_RESPONSE_HELP) {
92+ g_debug("Dialog return response: 'help'");
93+ } else {
94+ g_debug("Dialog return response: %d", response);
95+ }
96+
97 if (response == GTK_RESPONSE_HELP) {
98 type = LOGOUT_DIALOG_TYPE_RESTART;
99 response = GTK_RESPONSE_OK;
100 }
101
102 if (response != GTK_RESPONSE_OK) {
103+ g_debug("Final response was not okay, quiting");
104 return 0;
105 }
106 }
107
108 session_action(type);
109+ g_debug("Finished action, quiting");
110
111 return 0;
112 }

Subscribers

People subscribed via source and target branches