diff --git a/shell/Makefile.am b/shell/Makefile.am index f9f9070de..68b70e91a 100644 --- a/shell/Makefile.am +++ b/shell/Makefile.am @@ -86,6 +86,13 @@ endif AM_CPPFLAGS = -DGNOMELOCALEDIR="\"$(datadir)/locale\"" +# Dbus service file +servicefiledir = $(datadir)/dbus-1/services +servicefile_in_files = org.gnome.ControlCenter.service.in +servicefile_DATA = $(servicefile_in_files:.service.in=.service) +$(servicefile_DATA): $(servicefile_in_files) Makefile + $(AM_V_GEN) sed -e 's|[@]bindir[@]|$(bindir)|' $< > $@ + sysdir = $(datadir)/applications sys_in_files = gnome-control-center.desktop.in sys_DATA = $(sys_in_files:.desktop.in=.desktop) @@ -99,10 +106,11 @@ completions/gnome-control-center: completions/gnome-control-center.in list-panel EXTRA_DIST = \ gnome-control-center.desktop.in.in \ + $(servicefile_in_files) \ $(completion_in_files) \ list-panel.sh -CLEANFILES = $(BUILT_SOURCES) $(completion_DATA) +CLEANFILES = $(BUILT_SOURCES) $(completion_DATA) $(servicefile_DATA) DISTCLEANFILES = gnome-control-center.desktop gnome-control-center.desktop.in noinst_PROGRAMS = test-hostname diff --git a/shell/cc-application.c b/shell/cc-application.c index 172345860..86f1c2d5c 100644 --- a/shell/cc-application.c +++ b/shell/cc-application.c @@ -95,6 +95,27 @@ help_activated (GSimpleAction *action, GDK_CURRENT_TIME, NULL); } +static void +launch_panel_activated (GSimpleAction *action, + GVariant *parameter, + gpointer user_data) +{ + CcApplication *self = CC_APPLICATION (user_data); + GError *error = NULL; + gchar *panel_id; + GVariant *parameters; + + g_variant_get (parameter, "(&s@av)", &panel_id, ¶meters); + g_debug ("gnome-control-center: 'launch-panel' activated for panel '%s' with %"G_GSIZE_FORMAT" arguments", + panel_id, g_variant_n_children (parameters)); + if (!cc_shell_set_active_panel_from_id (CC_SHELL (self->priv->window), panel_id, parameters, &error)) + { + g_warning ("Failed to activate the '%s' panel: %s", panel_id, error->message); + g_error_free (error); + } + g_variant_unref (parameters); +} + static int cc_application_command_line (GApplication *application, GApplicationCommandLine *command_line) @@ -280,6 +301,15 @@ cc_application_startup (GApplication *application) 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 (); diff --git a/shell/org.gnome.ControlCenter.service.in b/shell/org.gnome.ControlCenter.service.in new file mode 100644 index 000000000..a51512957 --- /dev/null +++ b/shell/org.gnome.ControlCenter.service.in @@ -0,0 +1,3 @@ +[D-BUS Service] +Name=org.gnome.ControlCenter +Exec=@bindir@/gnome-control-center