Fix regression on Logout button placement
authorMarty Jack <martyj@linux.local>
Thu, 18 Mar 2010 16:30:04 +0000 (12:30 -0400)
committerMarty Jack <martyj@linux.local>
Thu, 18 Mar 2010 16:30:04 +0000 (12:30 -0400)
Check in supporting routine for D-Bus read with no reply, thought to be needed for Suspend/Hibernate
- Latent until UPower support is implemented and checked out

lxsession-logout/dbus-interface.c
lxsession-logout/lxsession-logout.c

index df77a1f..f05b752 100644 (file)
@@ -74,6 +74,22 @@ static DBusMessage * dbus_send_message(DBusMessage * message)
     return reply;
 }
 
+/* Send a message with no reply expected. */
+static gboolean dbus_send_message_without_reply(DBusMessage * message)
+{
+    /* Get a connection handle. */
+    DBusConnection * connection = dbus_connect();
+    if (connection == NULL)
+        return FALSE;
+
+    /* Send the message in the blind. */
+    dbus_bool_t status = dbus_connection_send(connection, message, NULL);
+    dbus_message_unref(message);
+    if ( ! status)
+       g_warning(G_STRLOC ": DBUS: dbus_connection_send failed\n");
+    return status;
+}
+       
 /* Read a result for a method that returns void. */
 static gboolean dbus_read_result_void(DBusMessage * reply)
 {
@@ -226,6 +242,7 @@ static gboolean dbus_DeviceKit_command(const char * const command)
 {
 #ifdef HAVE_DBUS
     return dbus_read_result_void(dbus_send_message(dbus_DeviceKit_formulate_command(command)));
+//    return dbus_send_message_without_reply(dbus_DeviceKit_formulate_command(command));       It seems they don't send a reply; to be checked out
 #else
     return FALSE;
 #endif
index fd5d63a..3424b10 100644 (file)
@@ -389,13 +389,6 @@ int main(int argc, char * argv[])
     gtk_label_set_markup(GTK_LABEL(label), prompt);
     gtk_box_pack_start(GTK_BOX(controls), label, FALSE, FALSE, 4);
 
-    /* Create the Logout button. */
-    GtkWidget * logout_button = gtk_button_new_with_mnemonic(_("_Logout"));
-    GtkWidget * image = gtk_image_new_from_icon_name("system-log-out", GTK_ICON_SIZE_BUTTON);
-    gtk_button_set_image(GTK_BUTTON(logout_button), image);
-    g_signal_connect(G_OBJECT(logout_button), "clicked", G_CALLBACK(logout_clicked), &handler_context);
-    gtk_box_pack_start(GTK_BOX(controls), logout_button, FALSE, FALSE, 4);
-
     /* Create the Shutdown button. */
     if (handler_context.shutdown_available)
     {
@@ -446,6 +439,13 @@ int main(int argc, char * argv[])
         gtk_box_pack_start(GTK_BOX(controls), switch_user_button, FALSE, FALSE, 4);
     }
 
+    /* Create the Logout button. */
+    GtkWidget * logout_button = gtk_button_new_with_mnemonic(_("_Logout"));
+    GtkWidget * image = gtk_image_new_from_icon_name("system-log-out", GTK_ICON_SIZE_BUTTON);
+    gtk_button_set_image(GTK_BUTTON(logout_button), image);
+    g_signal_connect(G_OBJECT(logout_button), "clicked", G_CALLBACK(logout_clicked), &handler_context);
+    gtk_box_pack_start(GTK_BOX(controls), logout_button, FALSE, FALSE, 4);
+
     /* Create the Cancel button. */
     GtkWidget * cancel_button = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
     g_signal_connect(G_OBJECT(cancel_button), "clicked", G_CALLBACK(cancel_clicked), NULL);