diff options
author | Corey Berla <corey@berla.me> | 2022-08-07 21:17:43 -0700 |
---|---|---|
committer | Corey Berla <corey@berla.me> | 2022-08-08 21:37:53 +0000 |
commit | 39066e8a4ea09d0f37a88b5a702c135ef4acde91 (patch) | |
tree | e02cc959cf63ba2fdd0dfae381a159ec02fedeff | |
parent | 68c9710c8475567034c9d7daaffd395ded3df89b (diff) | |
download | nautilus-39066e8a4ea09d0f37a88b5a702c135ef4acde91.tar.gz |
app-chooser: Connect application-activated signal
The app chooser doesn't work correctly when user the <Enter> key.
Connect to the application-activated signal to properly handle this
and other situations where it's activated.
Related: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2390
-rw-r--r-- | src/nautilus-app-chooser.c | 13 | ||||
-rw-r--r-- | src/resources/ui/nautilus-app-chooser.ui | 2 |
2 files changed, 11 insertions, 4 deletions
diff --git a/src/nautilus-app-chooser.c b/src/nautilus-app-chooser.c index 00af912a7..3c9367f78 100644 --- a/src/nautilus-app-chooser.c +++ b/src/nautilus-app-chooser.c @@ -41,8 +41,7 @@ enum }; static void -open_button_clicked_cb (GtkButton *button, - NautilusAppChooser *self) +open_cb (NautilusAppChooser *self) { gboolean set_new_default = FALSE; g_autoptr (GAppInfo) info = NULL; @@ -81,7 +80,13 @@ open_button_clicked_cb (GtkButton *button, adw_message_dialog_add_response (ADW_MESSAGE_DIALOG (message_dialog), "close", _("OK")); gtk_window_present (GTK_WINDOW (message_dialog)); } +} +static void +on_application_activated (NautilusAppChooser *self) +{ + open_cb (self); + gtk_dialog_response (GTK_DIALOG (self), GTK_RESPONSE_OK); } static void @@ -182,6 +187,8 @@ nautilus_app_chooser_constructed (GObject *object) g_signal_connect_object (self->app_chooser_widget, "application-selected", G_CALLBACK (on_application_selected), self, 0); + g_signal_connect_object (self->app_chooser_widget, "application-activated", + G_CALLBACK (on_application_activated), self, G_CONNECT_SWAPPED); if (self->file_name != NULL) { @@ -246,7 +253,7 @@ nautilus_app_chooser_class_init (NautilusAppChooserClass *klass) gtk_widget_class_bind_template_child (widget_class, NautilusAppChooser, label_content_type_description); gtk_widget_class_bind_template_child (widget_class, NautilusAppChooser, set_default_box); - gtk_widget_class_bind_template_callback (widget_class, open_button_clicked_cb); + gtk_widget_class_bind_template_callback (widget_class, open_cb); g_object_class_install_property (object_class, PROP_CONTENT_TYPE, diff --git a/src/resources/ui/nautilus-app-chooser.ui b/src/resources/ui/nautilus-app-chooser.ui index 721006920..5d1b838e5 100644 --- a/src/resources/ui/nautilus-app-chooser.ui +++ b/src/resources/ui/nautilus-app-chooser.ui @@ -129,7 +129,7 @@ <property name="label" translatable="yes">_Open</property> <property name="use-underline">True</property> <property name="sensitive">False</property> - <signal name="clicked" object="NautilusAppChooser" handler="open_button_clicked_cb" swapped="no"/> + <signal name="clicked" object="NautilusAppChooser" handler="open_cb" swapped="yes"/> </object> </child> <action-widgets> |