[Xfce4-commits] [apps/xfce4-terminal] 01/01: Make search dialog buttons use menu item accelerators

noreply at xfce.org noreply at xfce.org
Fri Feb 8 03:27:48 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 5093b0831ab8eb7e47d8c1064ec986c615af9dca
Author: Igor <f2404 at yandex.ru>
Date:   Thu Feb 7 21:25:59 2019 -0500

    Make search dialog buttons use menu item accelerators
    
    "Previous"/"Next" buttons will now be activated by accelerators that are set
    for the "Find Previous"/"Find Next" menu items.
    
    Bug #15124
---
 terminal/terminal-search-dialog.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/terminal/terminal-search-dialog.c b/terminal/terminal-search-dialog.c
index a04e8e9..48c1203 100644
--- a/terminal/terminal-search-dialog.c
+++ b/terminal/terminal-search-dialog.c
@@ -82,13 +82,16 @@ terminal_search_dialog_class_init (TerminalSearchDialogClass *klass)
 static void
 terminal_search_dialog_init (TerminalSearchDialog *dialog)
 {
-  GtkWidget *close_button;
-  GtkWidget *hbox;
-  GtkWidget *vbox;
-  GtkWidget *label;
+  GtkWidget     *close_button;
+  GtkWidget     *hbox;
+  GtkWidget     *vbox;
+  GtkWidget     *label;
+  GtkAccelGroup *group = gtk_accel_group_new ();
+  GtkAccelKey    key_prev = {0}, key_next = {0};
 
   gtk_window_set_title (GTK_WINDOW (dialog), _("Find"));
   gtk_window_set_default_size (GTK_WINDOW (dialog), 400, -1);
+  gtk_window_add_accel_group (GTK_WINDOW (dialog), group);
 
   close_button = xfce_gtk_button_new_mixed ("window-close", _("_Close"));
   gtk_dialog_add_action_widget (GTK_DIALOG (dialog), close_button, GTK_RESPONSE_CLOSE);
@@ -101,6 +104,13 @@ terminal_search_dialog_init (TerminalSearchDialog *dialog)
   dialog->button_next = xfce_gtk_button_new_mixed ("go-next", _("_Next"));
   gtk_dialog_add_action_widget (GTK_DIALOG (dialog), dialog->button_next, TERMINAL_RESPONSE_SEARCH_NEXT);
 
+  gtk_accel_map_lookup_entry ("<Actions>/terminal-window/search-prev", &key_prev);
+  if (key_prev.accel_key != 0)
+    gtk_widget_add_accelerator (dialog->button_prev, "activate", group, key_prev.accel_key, key_prev.accel_mods, key_prev.accel_flags);
+  gtk_accel_map_lookup_entry ("<Actions>/terminal-window/search-next", &key_next);
+  if (key_next.accel_key != 0)
+    gtk_widget_add_accelerator (dialog->button_next, "activate", group, key_next.accel_key, key_next.accel_mods, key_next.accel_flags);
+
   vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
   gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), vbox, TRUE, TRUE, 0);
   gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);

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


More information about the Xfce4-commits mailing list