summaryrefslogtreecommitdiff
path: root/shell/cc-application.c
diff options
context:
space:
mode:
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>2018-03-06 22:35:06 -0300
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>2018-03-06 22:35:06 -0300
commitb5f7875be4576f92e8bdd3cee260f2b83e23fb6e (patch)
treeb044a482d9873221ea9e7ac0da8fa1c9480d7687 /shell/cc-application.c
parentde5d1a2417e1e1026726ff2ec630d16c5a00424a (diff)
downloadgnome-control-center-b5f7875be4576f92e8bdd3cee260f2b83e23fb6e.tar.gz
application: Initialize action using a GActionEntry table
Instead of manually instanciating each action.
Diffstat (limited to 'shell/cc-application.c')
-rw-r--r--shell/cc-application.c34
1 files changed, 13 insertions, 21 deletions
diff --git a/shell/cc-application.c b/shell/cc-application.c
index ae386c710..79212f6d9 100644
--- a/shell/cc-application.c
+++ b/shell/cc-application.c
@@ -209,11 +209,22 @@ static void
cc_application_startup (GApplication *application)
{
CcApplication *self = CC_APPLICATION (application);
- GMenu *menu;
GMenu *section;
- GSimpleAction *action;
+ GMenu *menu;
+
+ const GActionEntry cc_app_actions[] = {
+ { "launch-panel", launch_panel_activated, "(sav)", NULL, NULL, { 0 } },
+ { "help", help_activated, NULL, NULL, NULL, { 0 } },
+ { "quit", cc_application_quit, NULL, NULL, NULL, { 0 } }
+ };
+
const gchar *help_accels[] = { "F1", NULL };
+ g_action_map_add_action_entries (G_ACTION_MAP (self),
+ cc_app_actions,
+ G_N_ELEMENTS (cc_app_actions),
+ self);
+
G_APPLICATION_CLASS (cc_application_parent_class)->startup (application);
#if defined(HAVE_WACOM) || defined(HAVE_CHEESE)
@@ -224,25 +235,6 @@ cc_application_startup (GApplication *application)
}
#endif /* HAVE_WACOM || HAVE_CHEESE */
- action = g_simple_action_new ("help", NULL);
- g_action_map_add_action (G_ACTION_MAP (application), G_ACTION (action));
- g_signal_connect (action, "activate", G_CALLBACK (help_activated), self);
- g_object_unref (action);
-
- action = g_simple_action_new ("quit", NULL);
- g_action_map_add_action (G_ACTION_MAP (application), G_ACTION (action));
- g_signal_connect (action, "activate", G_CALLBACK (cc_application_quit), self);
- g_object_unref (action);
-
- /* Launch panel by id. The parameter is a (panel_id, array_of_panel_parameters)
- * tuple. The GVariant-containing array usually is just the same array of
- * strings that would be generated by passing panel-specific arguments on
- * the command line. */
- action = g_simple_action_new ("launch-panel", G_VARIANT_TYPE ("(sav)"));
- g_action_map_add_action (G_ACTION_MAP (application), G_ACTION (action));
- g_signal_connect (action, "activate", G_CALLBACK (launch_panel_activated), self);
- g_object_unref (action);
-
menu = g_menu_new ();
section = g_menu_new ();