summaryrefslogtreecommitdiff
path: root/gtk/gtkemojichooser.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-03-18 16:52:52 -0400
committerMatthias Clasen <mclasen@redhat.com>2020-03-25 23:14:44 -0400
commitc94ec4a2040d5a1436a91675193b93491b0aac3c (patch)
tree52f1793ebd6be9152f469a3009bc95bceaf303f5 /gtk/gtkemojichooser.c
parent778d884f70408e3a3852036c1b720da534a59817 (diff)
downloadgtk+-c94ec4a2040d5a1436a91675193b93491b0aac3c.tar.gz
emojichooser: Stop using ::popup-menu
This signal is going away. Use an action instead.
Diffstat (limited to 'gtk/gtkemojichooser.c')
-rw-r--r--gtk/gtkemojichooser.c40
1 files changed, 27 insertions, 13 deletions
diff --git a/gtk/gtkemojichooser.c b/gtk/gtkemojichooser.c
index 66594db645..7d31123bf8 100644
--- a/gtk/gtkemojichooser.c
+++ b/gtk/gtkemojichooser.c
@@ -119,12 +119,39 @@ gtk_emoji_chooser_child_focus (GtkWidget *widget,
return GTK_WIDGET_CLASS (gtk_emoji_chooser_child_parent_class)->focus (widget, direction);
}
+static void show_variations (GtkEmojiChooser *chooser,
+ GtkWidget *child);
+
+static void
+gtk_emoji_chooser_child_popup_menu (GtkWidget *widget,
+ const char *action_name,
+ GVariant *paramters)
+{
+ GtkWidget *chooser;
+
+ chooser = gtk_widget_get_ancestor (widget, GTK_TYPE_EMOJI_CHOOSER);
+
+ show_variations (GTK_EMOJI_CHOOSER (chooser), widget);
+}
+
static void
gtk_emoji_chooser_child_class_init (GtkEmojiChooserChildClass *class)
{
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
widget_class->size_allocate = gtk_emoji_chooser_child_size_allocate;
widget_class->focus = gtk_emoji_chooser_child_focus;
+
+ gtk_widget_class_install_action (widget_class, "menu.popup", NULL, gtk_emoji_chooser_child_popup_menu);
+
+ gtk_widget_class_add_binding_action (widget_class,
+ GDK_KEY_F10, GDK_SHIFT_MASK,
+ "menu.popup",
+ NULL);
+ gtk_widget_class_add_binding_action (widget_class,
+ GDK_KEY_Menu, 0,
+ "menu.popup",
+ NULL);
+
gtk_widget_class_set_css_name (widget_class, "emoji");
}
@@ -421,16 +448,6 @@ pressed_cb (GtkGesture *gesture,
show_variations (chooser, child);
}
-static gboolean
-popup_menu (GtkWidget *widget,
- gpointer data)
-{
- GtkEmojiChooser *chooser = data;
-
- show_variations (chooser, widget);
- return TRUE;
-}
-
static void
add_emoji (GtkWidget *box,
gboolean prepend,
@@ -488,9 +505,6 @@ add_emoji (GtkWidget *box,
if (modifier != 0)
g_object_set_data (G_OBJECT (child), "modifier", GUINT_TO_POINTER (modifier));
- if (chooser)
- g_signal_connect (child, "popup-menu", G_CALLBACK (popup_menu), chooser);
-
gtk_container_add (GTK_CONTAINER (child), label);
gtk_flow_box_insert (GTK_FLOW_BOX (box), child, prepend ? 0 : -1);
}