[Pkg-privacy-commits] [nautilus-wipe] 94/224: Add help button to the confirm/configuration dialog

Ulrike Uhlig u-guest at moszumanska.debian.org
Thu Jul 7 19:45:38 UTC 2016


This is an automated email from the git hooks/post-receive script.

u-guest pushed a commit to branch master
in repository nautilus-wipe.

commit bb6ec6c2876fc4a228ed357ede3932b54aac7797
Author: Colomban Wendling <ban at herbesfolles.org>
Date:   Mon Apr 12 19:30:04 2010 +0200

    Add help button to the confirm/configuration dialog
---
 nautilus-srm/compat.h            | 24 ++++++++++++++++++++++++
 nautilus-srm/operation-manager.c | 37 +++++++++++++++++++++++++++++++++++++
 2 files changed, 61 insertions(+)

diff --git a/nautilus-srm/compat.h b/nautilus-srm/compat.h
index a9f6949..6508a24 100644
--- a/nautilus-srm/compat.h
+++ b/nautilus-srm/compat.h
@@ -30,6 +30,7 @@
 
 #include <glib.h>
 #include <gtk/gtk.h>
+#include <gdk/gdk.h>
 
 G_BEGIN_DECLS
 
@@ -45,6 +46,29 @@ G_BEGIN_DECLS
 # define gtk_widget_get_sensitive(w) (GTK_WIDGET_SENSITIVE (w))
 #endif /* ! GTK_CHECK_VERSION (2, 18, 0) */
 
+#if ! GTK_CHECK_VERSION (2, 13, 1)
+
+static gboolean
+gtk_show_uri (GdkScreen    *screen,
+              const gchar  *uri,
+              guint32       timestamp,
+              GError      **error)
+{
+  gboolean  success;
+  gchar    *quoted_uri;
+  gchar    *cmd;
+  
+  quoted_uri = g_shell_quote (uri);
+  cmd = g_strconcat ("xdg-open", " ", quoted_uri, NULL);
+  g_free (quoted_uri);
+  success = gdk_spawn_command_line_on_screen (screen, cmd, error);
+  g_free (cmd);
+  
+  return success;
+}
+
+#endif
+
 
 /* Nautilus stuff */
 
diff --git a/nautilus-srm/operation-manager.c b/nautilus-srm/operation-manager.c
index cc6809c..8e25e03 100644
--- a/nautilus-srm/operation-manager.c
+++ b/nautilus-srm/operation-manager.c
@@ -276,6 +276,30 @@ pref_enum_combo_changed_handler (GtkComboBox *combo,
   }
 }
 
+static void
+help_button_clicked_handler (GtkWidget *widget,
+                             gpointer   data)
+{
+  GtkWindow  *parent = data;
+  GError     *err = NULL;
+  
+  if (! gtk_show_uri (gtk_widget_get_screen (widget),
+                      "ghelp:nautilus-srm?nautilus-secure-delete-config",
+                      gtk_get_current_event_time (),
+                      &err)) {
+    /* display the error.
+     * here we cannot use non-blocking dialog since we are called from a
+     * dialog ran by gtk_dialog_run(), then the dialog must be ran the same way
+     * to get events */
+    display_dialog (parent, GTK_MESSAGE_ERROR, TRUE,
+                    _("Failed to open help"),
+                    err->message,
+                    GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
+                    NULL);
+    g_error_free (err);
+  }
+}
+
 /*
  * operation_confirm_dialog:
  * @parent: Parent window, or %NULL for none
@@ -306,17 +330,30 @@ operation_confirm_dialog (GtkWindow                    *parent,
   GtkResponseType response = GTK_RESPONSE_NONE;
   GtkWidget      *button;
   GtkWidget      *dialog;
+  GtkWidget      *action_area;
   
   dialog = gtk_message_dialog_new (parent,
                                    GTK_DIALOG_DESTROY_WITH_PARENT,
                                    GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE,
                                    "%s", primary_text);
+  action_area = gtk_dialog_get_action_area (GTK_DIALOG (dialog));
   if (secondary_text) {
     gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
                                               "%s", secondary_text);
   }
+  /* help button. don't use response not to close the dialog on click */
+  button = gtk_button_new_from_stock (GTK_STOCK_HELP);
+  g_signal_connect (button, "clicked",
+                    G_CALLBACK (help_button_clicked_handler), dialog);
+  gtk_box_pack_start (GTK_BOX (action_area), button, FALSE, TRUE, 0);
+  if (GTK_IS_BUTTON_BOX (action_area)) {
+    gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (action_area), button, TRUE);
+  }
+  gtk_widget_show (button);
+  /* cancel button */
   gtk_dialog_add_button (GTK_DIALOG (dialog),
                          GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT);
+  /* launch button */
   button = gtk_dialog_add_button (GTK_DIALOG (dialog),
                                   confirm_button_text, GTK_RESPONSE_ACCEPT);
   if (confirm_button_icon) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/nautilus-wipe.git



More information about the Pkg-privacy-commits mailing list