[gtk/wip/matthiasc/popup4: 129/140] text, label: Handle default activation via action
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/matthiasc/popup4: 129/140] text, label: Handle default activation via action
- Date: Mon, 29 Apr 2019 02:52:32 +0000 (UTC)
commit 6120eb19d44d96060daff4f0e84920cbdf0b18c8
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Apr 27 03:14:36 2019 +0000
text, label: Handle default activation via action
We can now activate the default widget via
the gtk.activate-default action. This makes
it unnecessary to have a GtkRoot or GtkBud
api for this.
gtk/gtklabel.c | 8 +++++++-
gtk/gtktext.c | 8 +++++++-
2 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
index 16ef24e076..6e9f200fcf 100644
--- a/gtk/gtklabel.c
+++ b/gtk/gtklabel.c
@@ -6202,7 +6202,13 @@ gtk_label_activate_current_link (GtkLabel *label)
if (link)
emit_activate_link (label, link);
else
- gtk_root_activate_default (gtk_widget_get_root (widget));
+ {
+ GActionGroup *group;
+
+ group = gtk_widget_get_action_group (widget, "gtk");
+ if (group)
+ g_action_group_activate_action (group, "activate-default", NULL);
+ }
}
static GtkLabelLink *
diff --git a/gtk/gtktext.c b/gtk/gtktext.c
index aba651b8fd..016050f338 100644
--- a/gtk/gtktext.c
+++ b/gtk/gtktext.c
@@ -3845,7 +3845,13 @@ gtk_text_real_activate (GtkText *self)
GtkTextPrivate *priv = gtk_text_get_instance_private (self);
if (priv->activates_default)
- gtk_root_activate_default (gtk_widget_get_root (GTK_WIDGET (self)));
+ {
+ GActionGroup *group;
+
+ group = gtk_widget_get_action_group (GTK_WIDGET (self), "gtk");
+ if (group)
+ g_action_group_activate_action (group, "activate-default", NULL);
+ }
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]