summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorGlynn Foster <glynn.foster@sun.com>2004-07-19 01:01:28 +0000
committerGlynn Foster <gman@src.gnome.org>2004-07-19 01:01:28 +0000
commitffaed088561e8c0a085fd2797543aaef65419f0c (patch)
treef1b9c6773cb568195fd5c9b2384dc20f08b1a2e0 /src/main.c
parentb986224682b864b25125bf73ae38f47e0fe883b1 (diff)
Add new option for --print-column, based on a patch by Paul Bolle. Fixes
2004-07-19 Glynn Foster <glynn.foster@sun.com> * src/main.c, src/tree.c, src/zenity.h, help/C/zenity.xml: Add new option for --print-column, based on a patch by Paul Bolle. Fixes #144496.
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/src/main.c b/src/main.c
index 129dfa5..02a67f3 100644
--- a/src/main.c
+++ b/src/main.c
@@ -105,6 +105,7 @@ enum {
OPTION_PERCENTAGE,
OPTION_PULSATE,
OPTION_AUTOCLOSE,
+ OPTION_PRINTCOLUMN,
OPTION_QUESTIONTEXT,
OPTION_WARNINGTEXT,
OPTION_ABOUT,
@@ -113,10 +114,10 @@ enum {
};
static void zenity_parse_options_callback (poptContext ctx,
- enum poptCallbackReason reason,
- const struct poptOption *opt,
- const char *arg,
- void *data);
+ enum poptCallbackReason reason,
+ const struct poptOption *opt,
+ const char *arg,
+ void *data);
struct poptOption options[] = {
{
@@ -515,6 +516,15 @@ struct poptOption list_options[] = {
N_("Allow changes to text"),
NULL
},
+ {
+ "print-column",
+ '\0',
+ POPT_ARG_STRING,
+ NULL,
+ OPTION_PRINTCOLUMN,
+ N_("Print a specific column (Default is 1. 'ALL' can be used to print all columns)"),
+ NULL
+ },
POPT_TABLEEND
};
@@ -972,6 +982,7 @@ zenity_init_parsing_options (void) {
results->tree_data->checkbox = FALSE;
results->tree_data->radiobox = FALSE;
results->tree_data->editable = FALSE;
+ results->tree_data->print_column = NULL;
}
static void
@@ -1020,6 +1031,8 @@ zenity_free_parsing_options (void) {
g_slist_foreach (results->tree_data->columns, (GFunc) g_free, NULL);
if (results->tree_data->separator)
g_free (results->tree_data->separator);
+ if (results->tree_data->print_column)
+ g_free (results->tree_data->print_column);
break;
default:
break;
@@ -1456,6 +1469,12 @@ zenity_parse_options_callback (poptContext ctx,
results->progress_data->autoclose = TRUE;
break;
+ case OPTION_PRINTCOLUMN:
+ if (results->mode != MODE_LIST)
+ zenity_error ("--print-column", ERROR_SUPPORT);
+
+ results->tree_data->print_column = g_strdup (arg);
+ break;
case OPTION_ABOUT:
if (results->mode != MODE_LAST)
zenity_error (NULL, ERROR_DIALOG);