Add keybinding support to the channel join dialog

Thu, 17 Apr 2025 23:35:53 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Thu, 17 Apr 2025 23:35:53 -0500
changeset 43233
9a9dd3407402
parent 43232
bb2ea3a628c2
child 43234
85be702275e6

Add keybinding support to the channel join dialog

Pressing enter in any of the fields will now attempt to join the channel and
pressing escape anywhere will close the dialog.

Testing Done:
Opened the dialog and used the keyboard to join a channel and to close the dialog. Also called in the turtles.

Reviewed at https://reviews.imfreedom.org/r/3971/

pidgin/pidginchanneljoindialog.c file | annotate | diff | comparison | revisions
pidgin/resources/channeljoindialog.ui file | annotate | diff | comparison | revisions
--- a/pidgin/pidginchanneljoindialog.c	Thu Apr 17 23:33:42 2025 -0500
+++ b/pidgin/pidginchanneljoindialog.c	Thu Apr 17 23:35:53 2025 -0500
@@ -334,6 +334,9 @@
 		"/im/pidgin/Pidgin3/channeljoindialog.ui"
 	);
 
+	gtk_widget_class_add_binding_action(widget_class, GDK_KEY_Escape, 0,
+	                                    "window.close", NULL);
+
 	gtk_widget_class_bind_template_child(widget_class, PidginChannelJoinDialog,
 	                                     account);
 	gtk_widget_class_bind_template_child(widget_class, PidginChannelJoinDialog,
--- a/pidgin/resources/channeljoindialog.ui	Thu Apr 17 23:33:42 2025 -0500
+++ b/pidgin/resources/channeljoindialog.ui	Thu Apr 17 23:35:53 2025 -0500
@@ -21,6 +21,7 @@
   <template class="PidginChannelJoinDialog" parent="GtkWindow">
     <property name="resizable">1</property>
     <property name="title" translatable="yes">Join Channel</property>
+    <property name="default-widget">join</property>
     <child>
       <object class="GtkBox">
         <property name="margin-bottom">24</property>
@@ -54,17 +55,20 @@
             </child>
             <child>
               <object class="AdwEntryRow" id="name">
+                <property name="activates-default">true</property>
                 <property name="title" translatable="yes">Name</property>
                 <signal name="changed" handler="pidgin_channel_join_dialog_join_named_changed_cb"/>
               </object>
             </child>
             <child>
               <object class="AdwEntryRow" id="nickname">
+                <property name="activates-default">true</property>
                 <property name="title" translatable="yes">Custom nickname (optional)</property>
               </object>
             </child>
             <child>
               <object class="AdwEntryRow" id="password">
+                <property name="activates-default">true</property>
                 <property name="title" translatable="yes">Password (optional)</property>
               </object>
             </child>

mercurial