[Xfce4-commits] [apps/xfce4-terminal] 01/02: Refine the previous commit

noreply at xfce.org noreply at xfce.org
Fri Mar 8 20:26:14 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 8d17a93853ff07e16595528a4cadeb68de2eb2a7
Author: Igor <f2404 at yandex.ru>
Date:   Fri Mar 8 14:24:17 2019 -0500

    Refine the previous commit
---
 terminal/terminal-screen.c | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/terminal/terminal-screen.c b/terminal/terminal-screen.c
index 811140d..1fff34e 100644
--- a/terminal/terminal-screen.c
+++ b/terminal/terminal-screen.c
@@ -1783,22 +1783,16 @@ 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     *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);
+  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);
 
   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);
@@ -1814,8 +1808,6 @@ terminal_screen_unsafe_paste_dialog_new (TerminalScreen *screen,
 
   gtk_text_buffer_set_text (buffer, text, -1);
 
-  gtk_window_set_focus (GTK_WINDOW (dialog), paste_button);
-
   return dialog;
 }
 
@@ -1828,6 +1820,8 @@ terminal_screen_paste_unsafe_text (TerminalScreen *screen,
   GtkWidget *dialog = terminal_screen_unsafe_paste_dialog_new (screen, text);
 
   gtk_widget_show_all (dialog);
+  /* set focus to the Paste button */
+  gtk_widget_grab_focus (gtk_dialog_get_widget_for_response (GTK_DIALOG (dialog), GTK_RESPONSE_YES));
 
   if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_YES)
     {

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


More information about the Xfce4-commits mailing list