[nautilus/wip/coreyberla/app-chooser-fixes: 3/3] app-chooser: Connect application-activated signal
- From: Corey Berla <coreyberla src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/coreyberla/app-chooser-fixes: 3/3] app-chooser: Connect application-activated signal
- Date: Mon, 8 Aug 2022 04:35:27 +0000 (UTC)
commit a146e3e5707ccd1cbbdc8a69c9b714ff0998deaa
Author: Corey Berla <corey berla me>
Date: Sun Aug 7 21:17:43 2022 -0700
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
src/nautilus-app-chooser.c | 13 ++++++++++---
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 a1523d74c..0426a15e6 100644
--- a/src/nautilus-app-chooser.c
+++ b/src/nautilus-app-chooser.c
@@ -42,8 +42,7 @@ enum
};
static void
-open_button_clicked_cb (GtkButton *button,
- NautilusAppChooser *self)
+open_cb (NautilusAppChooser *self)
{
gboolean state;
g_autoptr (GAppInfo) info = NULL;
@@ -83,7 +82,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
@@ -197,6 +202,8 @@ nautilus_app_chooser_constructed (GObject *object)
G_CALLBACK (on_switch_state_set), self, 0);
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)
{
@@ -261,7 +268,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>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]