summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Newman <MikeGTN@src.gnome.org>2003-06-10 21:30:22 +0000
committerMike Newman <MikeGTN@src.gnome.org>2003-06-10 21:30:22 +0000
commitcfe29d9ad04761e7a97964af5e8f20fca7d22cfc (patch)
tree49791765012f5b821c208663320db9a354aaae6f /src
parentCommitting patch to fall back to dialog if DISPLAY not set from (diff)
downloadzenity-cfe29d9ad04761e7a97964af5e8f20fca7d22cfc.tar.gz
zenity-cfe29d9ad04761e7a97964af5e8f20fca7d22cfc.tar.bz2
zenity-cfe29d9ad04761e7a97964af5e8f20fca7d22cfc.zip
Allow /t and /n in dialog text. Some code cleanup.
Diffstat (limited to 'src')
-rw-r--r--src/fileselection.c12
-rw-r--r--src/main.c22
-rw-r--r--src/tree.c6
3 files changed, 13 insertions, 27 deletions
diff --git a/src/fileselection.c b/src/fileselection.c
index 4e87d043..d392b0d0 100644
--- a/src/fileselection.c
+++ b/src/fileselection.c
@@ -87,18 +87,10 @@ zenity_fileselection_dialog_response (GtkWidget *widget, int response, gpointer
selections = gtk_file_selection_get_selections (GTK_FILE_SELECTION (widget));
for (i=0;selections[i] != NULL; i++) {
g_printerr ("%s", g_filename_to_utf8 ((gchar*)selections[i], -1, NULL, NULL, 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
+ if (selections[i+1] != NULL)
g_printerr ("%s",separator);
- } else {
- g_printerr ("\n");
- }
}
+ g_printerr("\n");
g_strfreev(selections);
g_free(separator);
diff --git a/src/main.c b/src/main.c
index 32c98a14..5a111efa 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1125,7 +1125,7 @@ zenity_parse_options_callback (poptContext ctx,
static gint parse_option_text = 0;
static gint parse_option_file = 0;
static gint parse_option_editable = 0;
-
+
if (reason == POPT_CALLBACK_REASON_POST)
return;
else if (reason != POPT_CALLBACK_REASON_OPTION)
@@ -1235,22 +1235,22 @@ zenity_parse_options_callback (poptContext ctx,
if (parse_option_text > 6)
zenity_error ("--text", ERROR_DUPLICATE);
-
+
switch (results->mode) {
case MODE_CALENDAR:
- results->calendar_data->dialog_text = g_strdup (arg);
+ results->calendar_data->dialog_text = g_strdup (g_strcompress (arg));
break;
case MODE_ENTRY:
- results->entry_data->dialog_text = g_strdup (arg);
+ results->entry_data->dialog_text = g_strdup (g_strcompress (arg));
break;
case MODE_ERROR:
case MODE_QUESTION:
case MODE_WARNING:
case MODE_INFO:
- results->msg_data->dialog_text = g_strdup (arg);
+ results->msg_data->dialog_text = g_strdup (g_strcompress (arg));
break;
case MODE_PROGRESS:
- results->progress_data->dialog_text = g_strdup (arg);
+ results->progress_data->dialog_text = g_strdup (g_strcompress (arg));
break;
default:
zenity_error ("--text", ERROR_SUPPORT);
@@ -1388,16 +1388,16 @@ zenity_parse_options_callback (poptContext ctx,
results->tree_data->radiobox = TRUE;
break;
case OPTION_SEPERATOR:
- if (parse_option_separator)
+ if (parse_option_separator > 2)
zenity_error ("--separator", ERROR_DUPLICATE);
switch (results->mode) {
case MODE_LIST:
- results->tree_data->separator = g_strdup (arg);
- parse_option_separator = TRUE;
+ results->tree_data->separator = g_strdup (g_strcompress (arg));
+ parse_option_separator++;
break;
case MODE_FILE:
- results->file_data->separator = g_strdup (arg);
- parse_option_separator = TRUE;
+ results->file_data->separator = g_strdup (g_strcompress (arg));
+ parse_option_separator++;
break;
default:
zenity_error ("--separator", ERROR_SUPPORT);
diff --git a/src/tree.c b/src/tree.c
index 903ef704..80562d86 100644
--- a/src/tree.c
+++ b/src/tree.c
@@ -478,12 +478,6 @@ zenity_tree_dialog_output (void)
for (tmp = selected; tmp; tmp = tmp->next) {
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);
}
else
bgstack15