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
=== modified file 'src/gtk-logout-helper.c'
--- src/gtk-logout-helper.c 2011-08-19 18:13:57 +0000
+++ src/gtk-logout-helper.c 2011-09-08 03:12:24 +0000
@@ -31,6 +31,8 @@
31static void31static void
32consolekit_fallback (LogoutDialogType action)32consolekit_fallback (LogoutDialogType action)
33{33{
34 g_debug("Falling back to using ConsoleKit for action");
35
34 DBusGConnection * sbus = dbus_g_bus_get(DBUS_BUS_SYSTEM, NULL);36 DBusGConnection * sbus = dbus_g_bus_get(DBUS_BUS_SYSTEM, NULL);
35 g_return_if_fail(sbus != NULL); /* worst case */37 g_return_if_fail(sbus != NULL); /* worst case */
36 DBusGProxy * proxy = dbus_g_proxy_new_for_name(sbus, "org.freedesktop.ConsoleKit",38 DBusGProxy * proxy = dbus_g_proxy_new_for_name(sbus, "org.freedesktop.ConsoleKit",
@@ -49,12 +51,14 @@
49 g_warning("Unable to fallback to ConsoleKit for logout as it's a session issue. We need some sort of session handler.");51 g_warning("Unable to fallback to ConsoleKit for logout as it's a session issue. We need some sort of session handler.");
50 break;52 break;
51 case LOGOUT_DIALOG_TYPE_SHUTDOWN:53 case LOGOUT_DIALOG_TYPE_SHUTDOWN:
54 g_debug("Telling ConsoleKit to 'Stop'");
52 dbus_g_proxy_call(proxy,55 dbus_g_proxy_call(proxy,
53 "Stop",56 "Stop",
54 &error,57 &error,
55 G_TYPE_INVALID);58 G_TYPE_INVALID);
56 break;59 break;
57 case LOGOUT_DIALOG_TYPE_RESTART:60 case LOGOUT_DIALOG_TYPE_RESTART:
61 g_debug("Telling ConsoleKit to 'Restart'");
58 dbus_g_proxy_call(proxy,62 dbus_g_proxy_call(proxy,
59 "Restart",63 "Restart",
60 &error,64 &error,
@@ -104,12 +108,15 @@
104 g_clear_error (&error);108 g_clear_error (&error);
105 109
106 if (action == LOGOUT_DIALOG_TYPE_LOG_OUT) {110 if (action == LOGOUT_DIALOG_TYPE_LOG_OUT) {
111 g_debug("Asking Session manager to 'Logout'");
107 res = dbus_g_proxy_call_with_timeout (sm_proxy, "Logout", INT_MAX, &error, 112 res = dbus_g_proxy_call_with_timeout (sm_proxy, "Logout", INT_MAX, &error,
108 G_TYPE_UINT, 1, G_TYPE_INVALID, G_TYPE_INVALID);113 G_TYPE_UINT, 1, G_TYPE_INVALID, G_TYPE_INVALID);
109 } else if (action == LOGOUT_DIALOG_TYPE_SHUTDOWN) {114 } else if (action == LOGOUT_DIALOG_TYPE_SHUTDOWN) {
115 g_debug("Asking Session manager to 'RequestShutdown'");
110 res = dbus_g_proxy_call_with_timeout (sm_proxy, "RequestShutdown", INT_MAX, &error, 116 res = dbus_g_proxy_call_with_timeout (sm_proxy, "RequestShutdown", INT_MAX, &error,
111 G_TYPE_INVALID, G_TYPE_INVALID);117 G_TYPE_INVALID, G_TYPE_INVALID);
112 } else if (action == LOGOUT_DIALOG_TYPE_RESTART) {118 } else if (action == LOGOUT_DIALOG_TYPE_RESTART) {
119 g_debug("Asking Session manager to 'RequestReboot'");
113 res = dbus_g_proxy_call_with_timeout (sm_proxy, "RequestReboot", INT_MAX, &error, 120 res = dbus_g_proxy_call_with_timeout (sm_proxy, "RequestReboot", INT_MAX, &error,
114 G_TYPE_INVALID, G_TYPE_INVALID);121 G_TYPE_INVALID, G_TYPE_INVALID);
115 } else {122 } else {
@@ -122,6 +129,8 @@
122 } else {129 } else {
123 g_warning ("SessionManager action failed: unknown error");130 g_warning ("SessionManager action failed: unknown error");
124 }131 }
132
133 consolekit_fallback(action);
125 }134 }
126 135
127 g_object_unref(sm_proxy);136 g_object_unref(sm_proxy);
@@ -139,6 +148,7 @@
139option_logout (const gchar * arg, const gchar * value, gpointer data, GError * error)148option_logout (const gchar * arg, const gchar * value, gpointer data, GError * error)
140{149{
141 type = LOGOUT_DIALOG_TYPE_LOG_OUT;150 type = LOGOUT_DIALOG_TYPE_LOG_OUT;
151 g_debug("Dialog type: logout");
142 return TRUE;152 return TRUE;
143}153}
144154
@@ -146,6 +156,7 @@
146option_shutdown (const gchar * arg, const gchar * value, gpointer data, GError * error)156option_shutdown (const gchar * arg, const gchar * value, gpointer data, GError * error)
147{157{
148 type = LOGOUT_DIALOG_TYPE_SHUTDOWN;158 type = LOGOUT_DIALOG_TYPE_SHUTDOWN;
159 g_debug("Dialog type: shutdown");
149 return TRUE;160 return TRUE;
150}161}
151162
@@ -153,6 +164,7 @@
153option_restart (const gchar * arg, const gchar * value, gpointer data, GError * error)164option_restart (const gchar * arg, const gchar * value, gpointer data, GError * error)
154{165{
155 type = LOGOUT_DIALOG_TYPE_RESTART;166 type = LOGOUT_DIALOG_TYPE_RESTART;
167 g_debug("Dialog type: restart");
156 return TRUE;168 return TRUE;
157}169}
158170
@@ -193,6 +205,7 @@
193205
194 GtkWidget * dialog = NULL;206 GtkWidget * dialog = NULL;
195 if (!supress_confirmations()) {207 if (!supress_confirmations()) {
208 g_debug("Showing dialog to ask for user confirmation");
196 dialog = GTK_WIDGET(logout_dialog_new(type));209 dialog = GTK_WIDGET(logout_dialog_new(type));
197 }210 }
198211
@@ -200,17 +213,27 @@
200 GtkResponseType response = gtk_dialog_run(GTK_DIALOG(dialog));213 GtkResponseType response = gtk_dialog_run(GTK_DIALOG(dialog));
201 gtk_widget_hide(dialog);214 gtk_widget_hide(dialog);
202215
216 if (response == GTK_RESPONSE_OK) {
217 g_debug("Dialog return response: 'okay'");
218 } else if (response == GTK_RESPONSE_HELP) {
219 g_debug("Dialog return response: 'help'");
220 } else {
221 g_debug("Dialog return response: %d", response);
222 }
223
203 if (response == GTK_RESPONSE_HELP) {224 if (response == GTK_RESPONSE_HELP) {
204 type = LOGOUT_DIALOG_TYPE_RESTART;225 type = LOGOUT_DIALOG_TYPE_RESTART;
205 response = GTK_RESPONSE_OK;226 response = GTK_RESPONSE_OK;
206 }227 }
207228
208 if (response != GTK_RESPONSE_OK) {229 if (response != GTK_RESPONSE_OK) {
230 g_debug("Final response was not okay, quiting");
209 return 0;231 return 0;
210 }232 }
211 }233 }
212234
213 session_action(type);235 session_action(type);
236 g_debug("Finished action, quiting");
214237
215 return 0;238 return 0;
216}239}

Subscribers

People subscribed via source and target branches