[libadwaita] entry-row: Add ::entry-activated



commit 7eeee847d79a393a790ac3c9c5ed55f926408259
Author: Gleb Smirnov <glebsmirnov0708 gmail com>
Date:   Wed Jul 13 09:07:19 2022 +0300

    entry-row: Add ::entry-activated

 src/adw-entry-row.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)
---
diff --git a/src/adw-entry-row.c b/src/adw-entry-row.c
index 39351a66..851446c1 100644
--- a/src/adw-entry-row.c
+++ b/src/adw-entry-row.c
@@ -106,6 +106,7 @@ static GParamSpec *props[PROP_LAST_PROP];
 
 enum {
   SIGNAL_APPLY,
+  SIGNAL_ENTRY_ACTIVATED,
   SIGNAL_LAST_SIGNAL,
 };
 
@@ -242,8 +243,11 @@ text_activated_cb (AdwEntryRow *self)
 {
   AdwEntryRowPrivate *priv = adw_entry_row_get_instance_private (self);
 
-  if (gtk_widget_get_visible (priv->apply_button))
+  if (gtk_widget_get_visible (priv->apply_button)) {
     apply_button_clicked_cb (self);
+  } else {
+    g_signal_emit (self, signals[SIGNAL_ENTRY_ACTIVATED], 0);
+  }
 }
 
 static void
@@ -539,6 +543,22 @@ adw_entry_row_class_init (AdwEntryRowClass *klass)
                   G_TYPE_NONE,
                   0);
 
+  /**
+   * AdwEntryRow::entry-activated:
+   *
+   * Emitted when the embedded entry is activated.
+   *
+   * Since: 1.2
+   */
+  signals[SIGNAL_ENTRY_ACTIVATED] =
+    g_signal_new ("entry-activated",
+                  G_TYPE_FROM_CLASS (klass),
+                  G_SIGNAL_RUN_LAST,
+                  0,
+                  NULL, NULL, NULL,
+                  G_TYPE_NONE,
+                  0);
+
   gtk_widget_class_set_template_from_resource (widget_class,
                                                "/org/gnome/Adwaita/ui/adw-entry-row.ui");
   gtk_widget_class_bind_template_child_private (widget_class, AdwEntryRow, header);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]