shell: Make --help-all and --help-gtk work
https://bugzilla.gnome.org/show_bug.cgi?id=652165
This commit is contained in:
parent
0402e73b8f
commit
8473ed33eb
1 changed files with 13 additions and 3 deletions
|
@ -45,12 +45,16 @@ static char **start_panels = NULL;
|
||||||
static gboolean show_overview = FALSE;
|
static gboolean show_overview = FALSE;
|
||||||
static gboolean verbose = FALSE;
|
static gboolean verbose = FALSE;
|
||||||
static gboolean show_help = FALSE;
|
static gboolean show_help = FALSE;
|
||||||
|
static gboolean show_help_gtk = FALSE;
|
||||||
|
static gboolean show_help_all = FALSE;
|
||||||
|
|
||||||
const GOptionEntry all_options[] = {
|
const GOptionEntry all_options[] = {
|
||||||
{ "version", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, option_version_cb, NULL, NULL },
|
{ "version", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, option_version_cb, NULL, NULL },
|
||||||
{ "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose, N_("Enable verbose mode"), NULL },
|
{ "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose, N_("Enable verbose mode"), NULL },
|
||||||
{ "overview", 'o', 0, G_OPTION_ARG_NONE, &show_overview, N_("Show the overview"), NULL },
|
{ "overview", 'o', 0, G_OPTION_ARG_NONE, &show_overview, N_("Show the overview"), NULL },
|
||||||
{ "help", '?', 0, G_OPTION_ARG_NONE, &show_help, N_("Show help options"), NULL },
|
{ "help", 'h', G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE, &show_help, N_("Show help options"), NULL },
|
||||||
|
{ "help-all", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE, &show_help_all, N_("Show help options"), NULL },
|
||||||
|
{ "help-gtk", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE, &show_help_gtk, N_("Show help options"), NULL },
|
||||||
{ G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_FILENAME_ARRAY, &start_panels, N_("Panel to display"), NULL },
|
{ G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_FILENAME_ARRAY, &start_panels, N_("Panel to display"), NULL },
|
||||||
{ NULL } /* end the list */
|
{ NULL } /* end the list */
|
||||||
};
|
};
|
||||||
|
@ -88,11 +92,17 @@ application_command_line_cb (GApplication *application,
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (show_help)
|
if (show_help || show_help_all || show_help_gtk)
|
||||||
{
|
{
|
||||||
gchar *help;
|
gchar *help;
|
||||||
|
GOptionGroup *group;
|
||||||
|
|
||||||
help = g_option_context_get_help (context, FALSE, NULL);
|
if (show_help || show_help_all)
|
||||||
|
group = NULL;
|
||||||
|
else
|
||||||
|
group = gtk_get_option_group (FALSE);
|
||||||
|
|
||||||
|
help = g_option_context_get_help (context, FALSE, group);
|
||||||
g_print ("%s", help);
|
g_print ("%s", help);
|
||||||
g_free (help);
|
g_free (help);
|
||||||
g_option_context_free (context);
|
g_option_context_free (context);
|
||||||
|
|
Loading…
Add table
Reference in a new issue