mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 03:16:17 +01:00
Don't use deprecated GApplication api in examples
This commit is contained in:
parent
13e084437b
commit
39bebbed82
@ -45,24 +45,18 @@ activate_toggle_action (GSimpleAction *action,
|
||||
static void
|
||||
add_actions (GApplication *app)
|
||||
{
|
||||
GSimpleActionGroup *actions;
|
||||
GSimpleAction *action;
|
||||
|
||||
actions = g_simple_action_group_new ();
|
||||
|
||||
action = g_simple_action_new ("simple-action", NULL);
|
||||
g_signal_connect (action, "activate", G_CALLBACK (activate_action), app);
|
||||
g_simple_action_group_insert (actions, G_ACTION (action));
|
||||
g_action_map_add_action (G_ACTION_MAP (app), G_ACTION (action));
|
||||
g_object_unref (action);
|
||||
|
||||
action = g_simple_action_new_stateful ("toggle-action", NULL,
|
||||
g_variant_new_boolean (FALSE));
|
||||
g_signal_connect (action, "activate", G_CALLBACK (activate_toggle_action), app);
|
||||
g_simple_action_group_insert (actions, G_ACTION (action));
|
||||
g_action_map_add_action (G_ACTION_MAP (app), G_ACTION (action));
|
||||
g_object_unref (action);
|
||||
|
||||
g_application_set_action_group (app, G_ACTION_GROUP (actions));
|
||||
g_object_unref (actions);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -44,17 +44,9 @@ static GActionEntry entries[] = {
|
||||
static void
|
||||
add_actions (GApplication *app)
|
||||
{
|
||||
GSimpleActionGroup *actions;
|
||||
|
||||
actions = g_simple_action_group_new ();
|
||||
|
||||
g_simple_action_group_add_entries (actions,
|
||||
entries, G_N_ELEMENTS (entries),
|
||||
NULL);
|
||||
|
||||
g_application_set_action_group (app, G_ACTION_GROUP (actions));
|
||||
|
||||
g_object_unref (actions);
|
||||
g_action_map_add_action_entries (G_ACTION_MAP (app),
|
||||
entries, G_N_ELEMENTS (entries),
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user