Implement --help-execute to list available commands
This commit is contained in:
parent
bcc622c456
commit
2dbce1e327
1 changed files with 27 additions and 0 deletions
|
@ -1527,6 +1527,7 @@ main (int argc,
|
||||||
gboolean run;
|
gboolean run;
|
||||||
gchar* snapshot;
|
gchar* snapshot;
|
||||||
gboolean execute;
|
gboolean execute;
|
||||||
|
gboolean help_execute;
|
||||||
gboolean version;
|
gboolean version;
|
||||||
gchar** uris;
|
gchar** uris;
|
||||||
gchar* block_uris;
|
gchar* block_uris;
|
||||||
|
@ -1552,6 +1553,8 @@ main (int argc,
|
||||||
#endif
|
#endif
|
||||||
{ "execute", 'e', 0, G_OPTION_ARG_NONE, &execute,
|
{ "execute", 'e', 0, G_OPTION_ARG_NONE, &execute,
|
||||||
N_("Execute the specified command"), NULL },
|
N_("Execute the specified command"), NULL },
|
||||||
|
{ "help-execute", 0, 0, G_OPTION_ARG_NONE, &help_execute,
|
||||||
|
N_("List available commands to execute with -e/ --execute"), NULL },
|
||||||
{ "version", 'V', 0, G_OPTION_ARG_NONE, &version,
|
{ "version", 'V', 0, G_OPTION_ARG_NONE, &version,
|
||||||
N_("Display program version"), NULL },
|
N_("Display program version"), NULL },
|
||||||
{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &uris,
|
{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &uris,
|
||||||
|
@ -1636,6 +1639,7 @@ main (int argc,
|
||||||
run = FALSE;
|
run = FALSE;
|
||||||
snapshot = NULL;
|
snapshot = NULL;
|
||||||
execute = FALSE;
|
execute = FALSE;
|
||||||
|
help_execute = FALSE;
|
||||||
version = FALSE;
|
version = FALSE;
|
||||||
uris = NULL;
|
uris = NULL;
|
||||||
block_uris = NULL;
|
block_uris = NULL;
|
||||||
|
@ -1676,6 +1680,29 @@ main (int argc,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (help_execute)
|
||||||
|
{
|
||||||
|
MidoriBrowser* browser = midori_browser_new ();
|
||||||
|
GtkActionGroup* action_group = midori_browser_get_action_group (browser);
|
||||||
|
GList* actions = gtk_action_group_list_actions (action_group);
|
||||||
|
for (; actions; actions = g_list_next (actions))
|
||||||
|
{
|
||||||
|
GtkAction* action = actions->data;
|
||||||
|
const gchar* name = gtk_action_get_name (action);
|
||||||
|
const gchar* space = " ";
|
||||||
|
gchar* padding = g_strndup (space, strlen (space) - strlen (name));
|
||||||
|
gchar* label = katze_strip_mnemonics (gtk_action_get_label (action));
|
||||||
|
const gchar* tooltip = gtk_action_get_tooltip (action);
|
||||||
|
g_print ("%s%s%s%s%s\n", name, padding, label,
|
||||||
|
tooltip ? ": " : "", tooltip ? tooltip : "");
|
||||||
|
g_free (padding);
|
||||||
|
g_free (label);
|
||||||
|
}
|
||||||
|
g_list_free (actions);
|
||||||
|
gtk_widget_destroy (GTK_WIDGET (browser));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
#if WEBKIT_CHECK_VERSION (1, 1, 6)
|
#if WEBKIT_CHECK_VERSION (1, 1, 6)
|
||||||
if (snapshot)
|
if (snapshot)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue