Allow /t and /n in dialog text. Some code cleanup.

This commit is contained in:
Mike Newman 2003-06-10 21:30:22 +00:00
parent 98772744e9
commit cfe29d9ad0
5 changed files with 28 additions and 37 deletions

View File

@ -1,3 +1,16 @@
2003-06-10 Mike Newman <mikegtn@gnome.org>
* src/fileselection.c, src/main.c, src/tree.c, TODO: Allow the use
of '\t' and '\n' in dialog text. Also, g_strcompress the separator
strings in --list and --file-selection so code declared as 'arse'
by Glynn can be removed :)
Also removed some completed tasks from TODO.
2003-06-10 Mike Newman <mikegtn@gnome.org>
* src/main.c: allow use of /t and /n in dialog text.
2003-06-09 Kevin C. Krinke <kckrinke@opendoorsoftware.com> 2003-06-09 Kevin C. Krinke <kckrinke@opendoorsoftware.com>
* src/gdialog.in: wrap gdialog.real/dialog when not in X-Window * src/gdialog.in: wrap gdialog.real/dialog when not in X-Window

12
TODO
View File

@ -1,20 +1,12 @@
* Canceling progress dialog should kill off process and close the dialog * Canceling progress dialog should kill off process and close the dialog
- Current it does a Hangup, I'm not sure how to solve this - Current it does a Hangup, I'm not sure how to solve this
* Support extra buttons, help buttons with the ability to change the label on the * Support extra buttons, help buttons with the ability to change the label on the button
button
- Suggested by Kevin Krinke <kckrinke@opendoorsoftware.com> - Suggested by Kevin Krinke <kckrinke@opendoorsoftware.com>
* Text markup - bold, italic, underline, colours, etc.. * Text markup - bold, italic, underline, colours, etc..
- Suggested by Kevin Krinke <kckrinke@opendoorsoftware.com> - Suggested by Kevin Krinke <kckrinke@opendoorsoftware.com>
* Text arguments support '\t' and '\n'
- Suggested by Kevin Krinke <kckrinke@opendoorsoftware.com>
* List dialogs should all support --text * List dialogs should all support --text
- Suggested by Kevin Krinke <kckrinke@opendoorsoftware.com> - Suggested by Kevin Krinke <kckrinke@opendoorsoftware.com>
* Would be nice to have an option to use your own icon in the info/warning/message/question * Would be nice to have an option to use your own icon in the info/warning/message/question dialogs
dialogs
- Suggested by Kevin Krinke <kckrinke@opendoorsoftware.com>
* gdialog used to have env vars to specify the return values of some of the dialogs
- Suggested by Kevin Krinke <kckrinke@opendoorsoftware.com>
* Add multiple file selection support
- Suggested by Kevin Krinke <kckrinke@opendoorsoftware.com> - Suggested by Kevin Krinke <kckrinke@opendoorsoftware.com>
* Add pixmap support to list dialog * Add pixmap support to list dialog
- Suggested by Dani Brody <brodydani@hotmail.com> - Suggested by Dani Brody <brodydani@hotmail.com>

View File

@ -87,18 +87,10 @@ zenity_fileselection_dialog_response (GtkWidget *widget, int response, gpointer
selections = gtk_file_selection_get_selections (GTK_FILE_SELECTION (widget)); selections = gtk_file_selection_get_selections (GTK_FILE_SELECTION (widget));
for (i=0;selections[i] != NULL; i++) { for (i=0;selections[i] != NULL; i++) {
g_printerr ("%s", g_filename_to_utf8 ((gchar*)selections[i], -1, NULL, NULL, NULL)); g_printerr ("%s", g_filename_to_utf8 ((gchar*)selections[i], -1, NULL, NULL, NULL));
if (selections[i+1] != NULL) { if (selections[i+1] != NULL)
/* FIXME: This is a blatant copy of Gman's arse in tree.c */
if (strstr ((const gchar *) separator, (const gchar *) "\\n") != NULL)
g_printerr ("\n");
else if (strstr ((const gchar *) separator, (const gchar *) "\\t") != NULL)
g_printerr ("\t");
else
g_printerr ("%s",separator); g_printerr ("%s",separator);
} else {
g_printerr ("\n");
}
} }
g_printerr("\n");
g_strfreev(selections); g_strfreev(selections);
g_free(separator); g_free(separator);

View File

@ -1238,19 +1238,19 @@ zenity_parse_options_callback (poptContext ctx,
switch (results->mode) { switch (results->mode) {
case MODE_CALENDAR: case MODE_CALENDAR:
results->calendar_data->dialog_text = g_strdup (arg); results->calendar_data->dialog_text = g_strdup (g_strcompress (arg));
break; break;
case MODE_ENTRY: case MODE_ENTRY:
results->entry_data->dialog_text = g_strdup (arg); results->entry_data->dialog_text = g_strdup (g_strcompress (arg));
break; break;
case MODE_ERROR: case MODE_ERROR:
case MODE_QUESTION: case MODE_QUESTION:
case MODE_WARNING: case MODE_WARNING:
case MODE_INFO: case MODE_INFO:
results->msg_data->dialog_text = g_strdup (arg); results->msg_data->dialog_text = g_strdup (g_strcompress (arg));
break; break;
case MODE_PROGRESS: case MODE_PROGRESS:
results->progress_data->dialog_text = g_strdup (arg); results->progress_data->dialog_text = g_strdup (g_strcompress (arg));
break; break;
default: default:
zenity_error ("--text", ERROR_SUPPORT); zenity_error ("--text", ERROR_SUPPORT);
@ -1388,16 +1388,16 @@ zenity_parse_options_callback (poptContext ctx,
results->tree_data->radiobox = TRUE; results->tree_data->radiobox = TRUE;
break; break;
case OPTION_SEPERATOR: case OPTION_SEPERATOR:
if (parse_option_separator) if (parse_option_separator > 2)
zenity_error ("--separator", ERROR_DUPLICATE); zenity_error ("--separator", ERROR_DUPLICATE);
switch (results->mode) { switch (results->mode) {
case MODE_LIST: case MODE_LIST:
results->tree_data->separator = g_strdup (arg); results->tree_data->separator = g_strdup (g_strcompress (arg));
parse_option_separator = TRUE; parse_option_separator++;
break; break;
case MODE_FILE: case MODE_FILE:
results->file_data->separator = g_strdup (arg); results->file_data->separator = g_strdup (g_strcompress (arg));
parse_option_separator = TRUE; parse_option_separator++;
break; break;
default: default:
zenity_error ("--separator", ERROR_SUPPORT); zenity_error ("--separator", ERROR_SUPPORT);

View File

@ -478,12 +478,6 @@ zenity_tree_dialog_output (void)
for (tmp = selected; tmp; tmp = tmp->next) { for (tmp = selected; tmp; tmp = tmp->next) {
if (tmp->next != NULL) { if (tmp->next != NULL) {
/* FIXME: There must be a nicer way to do this. This is just arse */
if (strstr ((const gchar *) separator, (const gchar *) "\\n") != NULL)
g_printerr ("%s\n", (gchar *) tmp->data);
else if (strstr ((const gchar *) separator, (const gchar *) "\\t") != NULL)
g_printerr ("%s\t", (gchar *) tmp->data);
else
g_printerr ("%s%s", (gchar *) tmp->data, separator); g_printerr ("%s%s", (gchar *) tmp->data, separator);
} }
else else