shell: Use g_application_add_main_option_entries
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
This commit is contained in:
parent
0db5500232
commit
750bb5158d
1 changed files with 2 additions and 17 deletions
|
@ -123,8 +123,6 @@ cc_application_command_line (GApplication *application,
|
|||
int argc;
|
||||
char **argv;
|
||||
int retval = 0;
|
||||
GOptionContext *context;
|
||||
GError *error = NULL;
|
||||
|
||||
verbose = FALSE;
|
||||
show_overview = FALSE;
|
||||
|
@ -132,26 +130,12 @@ cc_application_command_line (GApplication *application,
|
|||
|
||||
argv = g_application_command_line_get_arguments (command_line, &argc);
|
||||
|
||||
context = g_option_context_new (N_("- Settings"));
|
||||
g_option_context_add_main_entries (context, all_options, GETTEXT_PACKAGE);
|
||||
g_option_context_set_translation_domain(context, GETTEXT_PACKAGE);
|
||||
g_option_context_add_group (context, gtk_get_option_group (TRUE));
|
||||
|
||||
start_panels = NULL;
|
||||
search_str = NULL;
|
||||
show_overview = FALSE;
|
||||
verbose = FALSE;
|
||||
list_panels = FALSE;
|
||||
|
||||
if (g_option_context_parse (context, &argc, &argv, &error) == FALSE)
|
||||
{
|
||||
g_print (_("%s\nRun '%s --help' to see a full list of available command line options.\n"),
|
||||
error->message, argv[0]);
|
||||
g_error_free (error);
|
||||
g_option_context_free (context);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (list_panels)
|
||||
{
|
||||
GList *panels, *l;
|
||||
|
@ -224,7 +208,6 @@ cc_application_command_line (GApplication *application,
|
|||
|
||||
show_overview = FALSE;
|
||||
|
||||
g_option_context_free (context);
|
||||
g_strfreev (argv);
|
||||
|
||||
return retval;
|
||||
|
@ -334,6 +317,8 @@ cc_application_dispose (GObject *object)
|
|||
static void
|
||||
cc_application_init (CcApplication *self)
|
||||
{
|
||||
g_application_add_main_option_entries (G_APPLICATION (self), all_options);
|
||||
|
||||
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
|
||||
CC_TYPE_APPLICATION,
|
||||
CcApplicationPrivate);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue