window: Use the new action machinery

Change the default.activate action to use the
new action machinery.
This commit is contained in:
Matthias Clasen 2019-06-14 21:43:20 -04:00
parent 04bace1982
commit dafb7054a1

View File

@ -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_activate_default_activate (GtkWidget *widget,
const char *name,
GVariant *parameter)
{
gtk_window_real_activate_default (GTK_WINDOW (data));
}
static void
add_actions (GtkWindow *window)
{
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 *