This commit ports CcApplication to use the modern
code practices and utilities, removing the boilerplate
macros. Namely, this commit introduces:
* G_DECLARE_FINAL_TYPE
* Remove unnecessary private field
* Unifies parameter layout
These were only used by CcApplication, and at this level
of the program we don't need to use any wrapper functions,
since we're certain that the CcWindow is a GtkWindow subclass.
Now that we handle local command line arguments, the 'command_line'
vfunc can no longer get the initial argc/argv passed to the process.
Now, cheese_gtk_init() is called unconditionally from main()
where argc/argv are available.
https://bugzilla.gnome.org/show_bug.cgi?id=751597
It was handled through a callback calling exit(). Now that we have a
handle-local-options callback, we can handle it as a regular argument
from there.
https://bugzilla.gnome.org/show_bug.cgi?id=751597
This is an help-like parameter, so we want its output to show up in the
terminal from which gnome-control-center was just started, not from the
terminal from which the main gnome-control-center instance was started.
https://bugzilla.gnome.org/show_bug.cgi?id=751597
Since we are using g_application_add_main_option, we can remove the
global variable used to parse the arguments into, and get the parsed
arguments from the GVariantDict returned by
g_application_command_line_get_options_dict().
This is in preparation for handling some command line options in the
local gnome-control-center instance, and others in the remote instance.
https://bugzilla.gnome.org/show_bug.cgi?id=751597
Since GApplication provides this API, we can as well use it, this will
be useful in order to correctly split option handling between the local
instance and the main instance.
https://bugzilla.gnome.org/show_bug.cgi?id=751597
GOption can handle --help for us, so we don't need to reimplement this
ourselves. This causes a small regression as starting a main
gnome-control-center instance and then running gnome-control-center
--help will cause the main instance-control-center to exit. This will be
fixed in the following patches, and this fixes the opposite bug:
if gnome-control-center is not running, gnome-control-center --help
would not exit after displaying the help before this commit.
https://bugzilla.gnome.org/show_bug.cgi?id=751597
When a GVariantBuilder is created with g_variant_builder_new(), it must
be unref'ed with g_variant_builder_unref() when no longer needed. In
this case, we can just use a local stack-allocated GVariantBuilder to
avoid the leak.
https://bugzilla.gnome.org/show_bug.cgi?id=751597
This reverts commit 31a8a99440.
This was meant for bgo#695885 which has stalled for a while, so this
feature has no in-tree user. This commit removes it for now, this can be
readded when users for it materialize.
https://bugzilla.gnome.org/show_bug.cgi?id=751597
The control-center may call g_option_context_parse repeatedly,
so we need to reset the static variables used to hold the parsing
results, otherwise things like the search string may leak from
a previous parsing run.
https://bugzilla.gnome.org/show_bug.cgi?id=700362
The name of the file was also changed to calibratorgui.c/h to avoid
it being inconsistent, this way it is no longer dependent on the
the technology.
https://bugzilla.gnome.org/show_bug.cgi?id=667797
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
Add a class method to CcPanel to get a GOptionGroup which will be added
to the main commandline parser. This gives panels the chance to have
commandline "--flags" in addition to the already available parameters.
This changes changes the way parameters are passed to panels: the first
entry in the GVariant array is always the a{sv} dictionary of
commandline flags, followed by the remaining free-form arguments.
https://bugzilla.gnome.org/show_bug.cgi?id=696054
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 promotes better encapsulation and allows us to move
application logic out of main() and rename the confusingly
named control-center.c to main.c
https://bugzilla.gnome.org/show_bug.cgi?id=692174