summaryrefslogtreecommitdiff
path: root/gtk/gtkwindow.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2019-06-14 21:43:20 -0400
committerMatthias Clasen <mclasen@redhat.com>2019-06-18 14:47:33 -0400
commitdafb7054a15aa612e44a7fbda3cf41ce06e1c306 (patch)
treeb102114e62b47fee229d610b24b83968f31f0a94 /gtk/gtkwindow.c
parent04bace198211ce34cb05b30ab999e5f82d7dc905 (diff)
downloadgtk+-dafb7054a15aa612e44a7fbda3cf41ce06e1c306.tar.gz
window: Use the new action machinery
Change the default.activate action to use the new action machinery.
Diffstat (limited to 'gtk/gtkwindow.c')
-rw-r--r--gtk/gtkwindow.c34
1 files changed, 11 insertions, 23 deletions
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 7d9a8f803c..7f67062061 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -492,6 +492,10 @@ static void gtk_window_on_theme_variant_changed (GtkSettings *settings,
#endif
static void gtk_window_set_theme_variant (GtkWindow *window);
+static void gtk_window_activate_default_activate (GtkWidget *widget,
+ const char *action_name,
+ GVariant *parameter);
+
static void gtk_window_do_popup (GtkWindow *window,
GdkEventButton *event);
static void gtk_window_style_updated (GtkWidget *widget);
@@ -1163,6 +1167,9 @@ gtk_window_class_init (GtkWindowClass *klass)
* Key bindings
*/
+ gtk_widget_class_install_action (widget_class, "default.activate",
+ gtk_window_activate_default_activate);
+
binding_set = gtk_binding_set_by_class (klass);
gtk_binding_entry_add_signal (binding_set, GDK_KEY_space, 0,
@@ -1766,28 +1773,11 @@ gtk_window_capture_motion (GtkWidget *widget,
}
static void
-activate_default_cb (GSimpleAction *action,
- GVariant *parameter,
- gpointer data)
-{
- gtk_window_real_activate_default (GTK_WINDOW (data));
-}
-
-static void
-add_actions (GtkWindow *window)
+gtk_window_activate_default_activate (GtkWidget *widget,
+ const char *name,
+ GVariant *parameter)
{
- GActionEntry entries[] = {
- { "activate", activate_default_cb, NULL, NULL, NULL },
- };
-
- GActionGroup *actions;
-
- actions = G_ACTION_GROUP (g_simple_action_group_new ());
- g_action_map_add_action_entries (G_ACTION_MAP (actions),
- entries, G_N_ELEMENTS (entries),
- window);
- gtk_widget_insert_action_group (GTK_WIDGET (window), "default", actions);
- g_object_unref (actions);
+ gtk_window_real_activate_default (GTK_WINDOW (widget));
}
static void
@@ -1879,8 +1869,6 @@ gtk_window_init (GtkWindow *window)
g_signal_connect_swapped (priv->key_controller, "focus-out",
G_CALLBACK (gtk_window_focus_out), window);
gtk_widget_add_controller (widget, priv->key_controller);
-
- add_actions (window);
}
static GtkGesture *