shell: Use GVariant to convey panel arguments instead of a string array

By using a GVariant of type "av" we can potentially pass more structured
data to panels, which will become relevant with the ability to invoke
them by GAction-based DBus-activation introduced in the following patch.

https://bugzilla.gnome.org/show_bug.cgi?id=696054
This commit is contained in:
Emanuele Aina 2013-03-01 11:18:08 +01:00
parent 397181e5d2
commit 9977bb200e
11 changed files with 127 additions and 60 deletions

View file

@ -180,6 +180,9 @@ cc_application_command_line (GApplication *application,
{
const char *start_id;
GError *err = NULL;
GVariant *parameters;
GVariantBuilder *builder;
int i;
start_id = start_panels[0];
@ -188,7 +191,11 @@ cc_application_command_line (GApplication *application,
else
g_debug ("No extra argument");
if (!cc_shell_set_active_panel_from_id (CC_SHELL (self->priv->window), start_id, (const gchar**)start_panels+1, &err))
builder = g_variant_builder_new (G_VARIANT_TYPE ("av"));
for (i = 1; start_panels[i] != NULL; i++)
g_variant_builder_add (builder, "v", g_variant_new_string (start_panels[i]));
parameters = g_variant_builder_end (builder);
if (!cc_shell_set_active_panel_from_id (CC_SHELL (self->priv->window), start_id, parameters, &err))
{
g_warning ("Could not load setting panel \"%s\": %s", start_id,
(err) ? err->message : "Unknown error");