[gnome-session] [capplet] Add help button to the capplet



commit 20e6c0d459351926261b232cfbaf4d704bf997da
Author: Vincent Untz <vuntz gnome org>
Date:   Mon Jun 22 01:16:02 2009 +0200

    [capplet] Add help button to the capplet

 capplet/gsm-properties-dialog.c |    1 +
 capplet/main.c                  |   30 +++++++++++++++++++++++++++++-
 2 files changed, 30 insertions(+), 1 deletions(-)
---
diff --git a/capplet/gsm-properties-dialog.c b/capplet/gsm-properties-dialog.c
index 7256fad..874ccdf 100644
--- a/capplet/gsm-properties-dialog.c
+++ b/capplet/gsm-properties-dialog.c
@@ -443,6 +443,7 @@ setup_dialog (GsmPropertiesDialog *dialog)
         static const GtkTargetEntry drag_targets[] = { { "text/uri-list", 0, 0 } };
 
         gtk_dialog_add_buttons (GTK_DIALOG (dialog),
+                                GTK_STOCK_HELP, GTK_RESPONSE_HELP,
                                 GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
                                 NULL);
 
diff --git a/capplet/main.c b/capplet/main.c
index a881442..410cf6d 100644
--- a/capplet/main.c
+++ b/capplet/main.c
@@ -43,7 +43,35 @@ dialog_response (GsmPropertiesDialog *dialog,
                  guint                response_id,
                  gpointer             data)
 {
-        gtk_main_quit ();
+        GdkScreen *screen;
+        GError    *error;
+
+        if (response_id == GTK_RESPONSE_HELP) {
+                screen = gtk_widget_get_screen (GTK_WIDGET (dialog));
+
+                error = NULL;
+                gtk_show_uri (screen, "ghelp:user-guide?gosstartsession-2",
+                              gtk_get_current_event_time (), &error);
+
+                if (error != NULL) {
+                        GtkWidget *d;
+                        d = gtk_message_dialog_new (GTK_WINDOW (dialog),
+                                                    GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+                                                    GTK_MESSAGE_ERROR,
+                                                    GTK_BUTTONS_CLOSE,
+                                                    "%s",
+                                                    _("Could not display help document"));
+                        gtk_message_dialog_format_secondary_text (
+                                                GTK_MESSAGE_DIALOG (d),
+                                                "%s", error->message);
+                        g_error_free (error);
+
+                        gtk_dialog_run (GTK_DIALOG (d));
+                        gtk_widget_destroy (d);
+                }
+        } else {
+                gtk_main_quit ();
+        }
 }
 
 int



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]