summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorGlynn Foster <glynn.foster@sun.com>2003-01-14 01:52:23 +0000
committerGlynn Foster <gman@src.gnome.org>2003-01-14 01:52:23 +0000
commitf00eb34c0604dcf68457ab09278295f647c622b8 (patch)
tree1d4d1058e57a367061b9f8d82603261205c528e8 /src/main.c
parent275dafc66e27aa179d09886f17635bda857038e0 (diff)
Add support to separate the selected rows output with a character with '/'
2003-01-14 Glynn Foster <glynn.foster@sun.com> * src/tree.c, src/zenity.h, src/main.c: Add support to separate the selected rows output with a character with '/' used by default.
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index 3e58bd4..2623232 100644
--- a/src/main.c
+++ b/src/main.c
@@ -78,6 +78,7 @@ enum {
OPTION_INFOTEXT,
OPTION_FILENAME,
OPTION_COLUMN,
+ OPTION_SEPERATOR,
OPTION_CHECKLIST,
OPTION_RADIOLIST,
OPTION_PROGRESSTEXT,
@@ -431,6 +432,15 @@ struct poptOption list_options[] = {
N_("Use radio buttons for first column"),
NULL
},
+ {
+ "separator",
+ '\0',
+ POPT_ARG_STRING,
+ NULL,
+ OPTION_SEPERATOR,
+ N_("Set output separator character"),
+ NULL
+ },
POPT_TABLEEND
};
@@ -716,6 +726,7 @@ zenity_init_parsing_options (void) {
results->calendar_data->month = 0;
results->calendar_data->year = 0;
results->calendar_data->dialog_text = NULL;
+ results->tree_data->separator = g_strdup ("/");
results->progress_data->percentage = -1;
results->progress_data->pulsate = FALSE;
results->entry_data->visible = TRUE;
@@ -764,6 +775,8 @@ zenity_free_parsing_options (void) {
case MODE_LIST:
if (results->tree_data->columns)
g_slist_foreach (results->tree_data->columns, (GFunc) g_free, NULL);
+ if (results->tree_data->separator)
+ g_free (results->tree_data->separator);
break;
default:
break;
@@ -856,6 +869,7 @@ void zenity_parse_options_callback (poptContext ctx,
void *data)
{
static gboolean parse_option_dateformat = FALSE;
+ static gboolean parse_option_separator = FALSE;
static gint parse_option_text = 0;
static gint parse_option_file = 0;
@@ -1149,6 +1163,20 @@ void zenity_parse_options_callback (poptContext ctx,
}
results->tree_data->radiobox = TRUE;
break;
+ case OPTION_SEPERATOR:
+ if (results->mode != MODE_LIST) {
+ g_printerr (_("--separator is not supported for this dialog\n"));
+ zenity_free_parsing_options ();
+ exit (-1);
+ }
+ if (parse_option_separator == TRUE) {
+ g_printerr (_("--separator given twice for the same dialog\n"));
+ zenity_free_parsing_options ();
+ exit (-1);
+ }
+ results->tree_data->separator = g_strdup (arg);
+ parse_option_separator = TRUE;
+ break;
case OPTION_PERCENTAGE:
if (results->mode != MODE_PROGRESS) {
g_printerr (_("--percentage is not supported for this dialog\n"));