diff options
author | Matthias Clasen <mclasen@redhat.com> | 2020-03-15 22:25:09 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2020-03-18 23:00:51 -0400 |
commit | 908d996b4f0cbfbda3cc8141c64aaf711db78d60 (patch) | |
tree | 00b038c9d326e14eb7f9b184f9649586bb0cc27d /gtk/gtklinkbutton.c | |
parent | 4e263b4042b273f26602fa65b3398af7ab56e86f (diff) | |
download | gtk+-908d996b4f0cbfbda3cc8141c64aaf711db78d60.tar.gz |
Use an action for the context menu keybinding
The ::popup-menu signal is going away.
Diffstat (limited to 'gtk/gtklinkbutton.c')
-rw-r--r-- | gtk/gtklinkbutton.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/gtk/gtklinkbutton.c b/gtk/gtklinkbutton.c index d64c3f3a83..96831ec083 100644 --- a/gtk/gtklinkbutton.c +++ b/gtk/gtklinkbutton.c @@ -123,7 +123,9 @@ static void gtk_link_button_set_property (GObject *object, const GValue *value, GParamSpec *pspec); static void gtk_link_button_clicked (GtkButton *button); -static gboolean gtk_link_button_popup_menu (GtkWidget *widget); +static void gtk_link_button_popup_menu (GtkWidget *widget, + const char *action_name, + GVariant *parameters); static gboolean gtk_link_button_query_tooltip_cb (GtkWidget *widget, gint x, gint y, @@ -169,8 +171,6 @@ gtk_link_button_class_init (GtkLinkButtonClass *klass) gobject_class->get_property = gtk_link_button_get_property; gobject_class->finalize = gtk_link_button_finalize; - widget_class->popup_menu = gtk_link_button_popup_menu; - button_class->clicked = gtk_link_button_clicked; klass->activate_link = gtk_link_button_activate_link; @@ -230,6 +230,17 @@ gtk_link_button_class_init (GtkLinkButtonClass *klass) gtk_widget_class_install_action (widget_class, "clipboard.copy", NULL, gtk_link_button_activate_clipboard_copy); + + gtk_widget_class_install_action (widget_class, "menu.popup", NULL, gtk_link_button_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); } static GMenuModel * @@ -503,11 +514,12 @@ gtk_link_button_clicked (GtkButton *button) g_signal_emit (button, link_signals[ACTIVATE_LINK], 0, &retval); } -static gboolean -gtk_link_button_popup_menu (GtkWidget *widget) +static void +gtk_link_button_popup_menu (GtkWidget *widget, + const char *action_name, + GVariant *parameters) { gtk_link_button_do_popup (GTK_LINK_BUTTON (widget), -1, -1); - return TRUE; } /** |