[gtk/wip/matthiasc/shortcut-4: 104/149] emojichooser: Stop using ::popup-menu
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/matthiasc/shortcut-4: 104/149] emojichooser: Stop using ::popup-menu
- Date: Wed, 25 Mar 2020 20:39:48 +0000 (UTC)
commit 93a80c23e25261c166e14d167ebf0d76118d0d32
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Mar 18 16:52:52 2020 -0400
emojichooser: Stop using ::popup-menu
This signal is going away. Use an action instead.
gtk/gtkemojichooser.c | 40 +++++++++++++++++++++++++++-------------
1 file 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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]