diff options
author | Matthias Clasen <mclasen@redhat.com> | 2020-03-18 16:52:52 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2020-03-18 23:00:51 -0400 |
commit | 48ace1363597eb95128b4649e1dd654677f2a825 (patch) | |
tree | bfe16a4a249756b070cd0f0d9e297db767c4bef1 | |
parent | 908d996b4f0cbfbda3cc8141c64aaf711db78d60 (diff) | |
download | gtk+-48ace1363597eb95128b4649e1dd654677f2a825.tar.gz |
emojichooser: Stop using ::popup-menu
This signal is going away. Use an action instead.
-rw-r--r-- | gtk/gtkemojichooser.c | 40 |
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); } |