[Xfce4-commits] [apps/xfce4-terminal] 01/01: Unsafe Paste: Set focus to the "Paste" button

noreply at xfce.org noreply at xfce.org
Wed Mar 6 23:34:39 CET 2019


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

f   2   4   0   4       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository apps/xfce4-terminal.

commit 588165571ace4d7dd0368c907cde2db97b3637c4
Author: Igor <f2404 at yandex.ru>
Date:   Wed Mar 6 17:33:59 2019 -0500

    Unsafe Paste: Set focus to the "Paste" button
---
 terminal/terminal-screen.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/terminal/terminal-screen.c b/terminal/terminal-screen.c
index 49f6ea3..811140d 100644
--- a/terminal/terminal-screen.c
+++ b/terminal/terminal-screen.c
@@ -1783,16 +1783,22 @@ terminal_screen_unsafe_paste_dialog_new (TerminalScreen *screen,
   GtkTextBuffer *buffer = gtk_text_buffer_new (gtk_text_tag_table_new ());
   GtkWidget     *tv = gtk_text_view_new_with_buffer (buffer);
   GtkWidget     *sw = gtk_scrolled_window_new (NULL, NULL);
-  GtkWidget     *dialog = xfce_titled_dialog_new_with_buttons (_("Warning: Unsafe Paste"), parent,
-                                                               GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                               _("_Cancel"), GTK_RESPONSE_CANCEL,
-                                                               _("_Paste"), GTK_RESPONSE_YES,
-                                                               NULL);
+  GtkWidget     *cancel_button = gtk_button_new_with_mnemonic (_("_Cancel"));
+  GtkWidget     *paste_button = gtk_button_new_with_mnemonic (_("_Paste"));
+  GtkWidget     *dialog = g_object_new (XFCE_TYPE_TITLED_DIALOG,
+                                        "transient-for", parent,
+                                        "destroy-with-parent", TRUE,
+                                        "title", _("Warning: Unsafe Paste"),
+                                        NULL);
 
   xfce_titled_dialog_set_subtitle (XFCE_TITLED_DIALOG (dialog),
                                    _("Pasting this text to the terminal may be dangerous as it looks like\n"
                                      "some commands may be executed, potentially involving root access ('sudo')."));
 
+  gtk_dialog_add_action_widget (GTK_DIALOG (dialog), cancel_button, GTK_RESPONSE_CANCEL);
+  gtk_dialog_add_action_widget (GTK_DIALOG (dialog), paste_button, GTK_RESPONSE_YES);
+  gtk_widget_set_can_default (paste_button, TRUE);
+
   gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (tv), TRUE);
   gtk_text_view_set_monospace (GTK_TEXT_VIEW (tv), TRUE);
   gtk_text_view_set_top_margin (GTK_TEXT_VIEW (tv), 6);
@@ -1808,7 +1814,7 @@ terminal_screen_unsafe_paste_dialog_new (TerminalScreen *screen,
 
   gtk_text_buffer_set_text (buffer, text, -1);
 
-  gtk_window_set_focus (GTK_WINDOW (dialog), tv);
+  gtk_window_set_focus (GTK_WINDOW (dialog), paste_button);
 
   return dialog;
 }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list