From f00eb34c0604dcf68457ab09278295f647c622b8 Mon Sep 17 00:00:00 2001 From: Glynn Foster Date: Tue, 14 Jan 2003 01:52:23 +0000 Subject: Add support to separate the selected rows output with a character with '/' 2003-01-14 Glynn Foster * src/tree.c, src/zenity.h, src/main.c: Add support to separate the selected rows output with a character with '/' used by default. --- src/main.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index 3e58bd49..26232327 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")); -- cgit