summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorGlynn Foster <glynn.foster@sun.com>2003-01-13 16:48:45 +0000
committerGlynn Foster <gman@src.gnome.org>2003-01-13 16:48:45 +0000
commit69636459e1faf1ce41685550cf7aec59acfbac39 (patch)
tree738383852b10b0fcdc7e1d82e4e0e0d1dc301514 /src/main.c
parentcd4e438bfb3ebfd3cc872e203e343a50acc02a15 (diff)
Improve error handling. Make --list actually return something useful,
2003-01-13 Glynn Foster <glynn.foster@sun.com> * src/main.c: Improve error handling. * src/tree.c: Make --list actually return something useful, although I still need to actually seperate things out so it's actually decipherable. * TODO: Update accordingly.
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index 53cfc99..03f6d4c 100644
--- a/src/main.c
+++ b/src/main.c
@@ -842,6 +842,9 @@ void zenity_parse_options_callback (poptContext ctx,
const char *arg,
void *data)
{
+ static gboolean parse_option_text = FALSE;
+ static gboolean parse_option_file = FALSE;
+
if (reason == POPT_CALLBACK_REASON_POST) {
return;
}
@@ -956,6 +959,12 @@ void zenity_parse_options_callback (poptContext ctx,
case OPTION_QUESTIONTEXT:
case OPTION_PROGRESSTEXT:
case OPTION_WARNINGTEXT:
+ if (parse_option_text == TRUE) {
+ g_printerr (_("--text given twice for the same dialog\n"));
+ zenity_free_parsing_options ();
+ exit (-1);
+ }
+
switch (results->mode) {
case MODE_CALENDAR:
results->calendar_data->dialog_text = g_strdup (arg);
@@ -977,6 +986,7 @@ void zenity_parse_options_callback (poptContext ctx,
zenity_free_parsing_options ();
exit (-1);
}
+ parse_option_text = TRUE;
break;
case OPTION_DAY:
if (results->mode != MODE_CALENDAR) {
@@ -1045,6 +1055,12 @@ void zenity_parse_options_callback (poptContext ctx,
break;
case OPTION_FILENAME:
case OPTION_TEXTFILE:
+ if (parse_option_file == TRUE) {
+ g_printerr (_("--filename given twice for the same dialog\n"));
+ zenity_free_parsing_options ();
+ exit (-1);
+ }
+
switch (results->mode) {
case MODE_FILE:
results->file_data->uri = g_strdup (arg);
@@ -1057,6 +1073,7 @@ void zenity_parse_options_callback (poptContext ctx,
zenity_free_parsing_options ();
exit (-1);
}
+ parse_option_file = TRUE;
break;
case OPTION_COLUMN:
if (results->mode != MODE_LIST) {