gnome-control-center/shell/org.gnome.ControlCenter.service.in
Emanuele Aina ab0576f1f0 shell: Expose panel launching with DBus-activation
Turn Control Center in a DBus-activable service and export a
'launch-panel' GAction which accepts a tuple containing the id of the
desired panel and its parameters as a GVariant array.

The snippet below show how the custom shortcuts section of the keyboard
panel can be invoked by a external programs through DBus:

GVariantBuilder *flags = g_variant_builder_new (G_VARIANT_TYPE_VARDICT);
GVariantBuilder *params = g_variant_builder_new (G_VARIANT_TYPE ("av"));
g_variant_builder_add (params, "v", g_variant_builder_end (flags));
g_variant_builder_add (params, "v", g_variant_new_string ("shortcuts"));
g_variant_builder_add (params, "v", g_variant_new_string ("custom"));
GVariant *v = g_variant_new ("(s@av)", "keyboard", g_variant_builder_end (params));

GApplication *gnomecc = g_application_new (id, G_APPLICATION_IS_LAUNCHER);
if (!g_application_register (gnomecc, NULL, &error))
  g_error ("Failed to register launcher for %s: %s", id, error->message);
g_action_group_activate_action (G_ACTION_GROUP (gnomecc), "launch-panel", v);

https://bugzilla.gnome.org/show_bug.cgi?id=696054
2013-04-03 18:09:15 +02:00

3 lines
80 B
SYSTEMD

[D-BUS Service]
Name=org.gnome.ControlCenter
Exec=@bindir@/gnome-control-center