[Pkg-wmaker-commits] [wmshutdown] 127/173: wmshutdown.c: Use dialog to communicate dbus errors.
Doug Torrance
dtorrance-guest at moszumanska.debian.org
Tue Aug 25 02:46:44 UTC 2015
This is an automated email from the git hooks/post-receive script.
dtorrance-guest pushed a commit to branch master
in repository wmshutdown.
commit e578d1a0656683e1621018fcfbaa09daaa642bf9
Author: Doug Torrance <dtorrance at monmouthcollege.edu>
Date: Sun Aug 17 12:38:40 2014 -0500
wmshutdown.c: Use dialog to communicate dbus errors.
---
wmshutdown.c | 28 +++++++++++++++++-----------
1 file changed, 17 insertions(+), 11 deletions(-)
diff --git a/wmshutdown.c b/wmshutdown.c
index 964bf8d..5864604 100644
--- a/wmshutdown.c
+++ b/wmshutdown.c
@@ -109,27 +109,33 @@ void handle_click(GtkWidget *widget, gpointer data) {
DBUS_PATH,
DBUS_INTERFACE,
method);
-
#ifndef CONSOLEKIT
g_dbus_message_set_body(message, g_variant_new("(b)", TRUE));
#endif
- gchar *status = g_dbus_message_print(message, 0);
- g_printerr("sending following message:\n%s", status);
- g_free(status);
-
g_dbus_message_set_destination(message, DBUS_DESTINATION);
-
reply = g_dbus_connection_send_message_with_reply_sync(
connection, message, 0, -1, NULL, NULL, &error);
- status = g_dbus_message_print(reply, 0);
- g_printerr("got response:\n%s", status);
- g_free(status);
-
+ if (g_dbus_message_get_message_type(reply) ==
+ G_DBUS_MESSAGE_TYPE_ERROR) {
+ GtkWidget *dialog;
+
+ dialog = gtk_message_dialog_new(
+ GTK_WINDOW(gtk_widget_get_toplevel(widget)),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_CLOSE,
+ "%s",
+ g_strcompress(g_variant_print(
+ g_dbus_message_get_body(reply),
+ TRUE)));
+ gtk_dialog_run(GTK_DIALOG(dialog));
+ gtk_widget_destroy(dialog);
+ }
g_object_unref(message);
+ g_object_unref(reply);
g_object_unref(connection);
- gtk_main_quit();
}
void button_press(GtkWidget *widget, GdkEvent *event) {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmshutdown.git
More information about the Pkg-wmaker-commits
mailing list