[gnome-applets] mini-commander: redo error handling



commit c4a99dbbe36254bfdde86959b20c8bb289e95a5a
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Sun Apr 5 02:37:43 2020 +0300

    mini-commander: redo error handling

 gnome-applets/mini-commander/preferences.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
---
diff --git a/gnome-applets/mini-commander/preferences.c b/gnome-applets/mini-commander/preferences.c
index b8f796fb6..b2a87f601 100644
--- a/gnome-applets/mini-commander/preferences.c
+++ b/gnome-applets/mini-commander/preferences.c
@@ -245,15 +245,13 @@ add_response (GtkWidget *window,
        pattern = gtk_entry_get_text (GTK_ENTRY (dialog->pattern_entry));
        command = gtk_entry_get_text (GTK_ENTRY (dialog->command_entry));
 
-       if (!pattern || !pattern [0])
+       if ((pattern == NULL || *pattern == '\0') && (command == NULL || *command == '\0'))
+               error_message = _("You must specify a pattern and a command");
+       else if (pattern == NULL || *pattern == '\0')
                error_message = _("You must specify a pattern");
-
-       if (!command || !command [0]) 
-               error_message = error_message != NULL ?
-                                       _("You must specify a pattern and a command") :
-                                       _("You must specify a command");
-
-       if (!error_message && duplicate_pattern (mc, pattern))
+       else if (command == NULL || *command == '\0')
+               error_message = _("You must specify a command");
+       else if (duplicate_pattern (mc, pattern))
                error_message = _("You may not specify duplicate patterns");
 
        if (error_message) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]