[Xfce4-commits] [xfce/xfce4-settings] 01/01: keyboard-settings: Fix log flood (bug #16521)

noreply at xfce.org noreply at xfce.org
Sat Mar 28 21:05:42 CET 2020


This is an automated email from the git hooks/post-receive script.

b   l   u   e   s   a   b   r   e       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       x   f   c   e   -   4   .   1   4   
   in repository xfce/xfce4-settings.

commit 3269d5fd8a251434fd2dea9aa234e665288fdc84
Author: Theo Linkspfeifer <lastonestanding at tutanota.com>
Date:   Sat Mar 28 16:04:37 2020 -0400

    keyboard-settings: Fix log flood (bug #16521)
    
    Signed-off-by: Sean Davis <smd.seandavis at gmail.com>
---
 dialogs/keyboard-settings/command-dialog.c         |  2 +-
 dialogs/keyboard-settings/xfce-keyboard-settings.c | 34 +++-------------------
 2 files changed, 5 insertions(+), 31 deletions(-)

diff --git a/dialogs/keyboard-settings/command-dialog.c b/dialogs/keyboard-settings/command-dialog.c
index 539a68a..b294f20 100644
--- a/dialogs/keyboard-settings/command-dialog.c
+++ b/dialogs/keyboard-settings/command-dialog.c
@@ -235,7 +235,7 @@ command_dialog_run (CommandDialog *dialog,
     {
       response = gtk_dialog_run (GTK_DIALOG (dialog));
 
-      if (G_UNLIKELY (response != GTK_RESPONSE_CANCEL && g_utf8_strlen (command_dialog_get_command (dialog), -1) == 0))
+      if (G_UNLIKELY (response == GTK_RESPONSE_OK && g_utf8_strlen (command_dialog_get_command (dialog), -1) == 0))
         xfce_dialog_show_error (GTK_WINDOW (dialog), NULL, _("The command may not be empty."));
       else
         finished = TRUE;
diff --git a/dialogs/keyboard-settings/xfce-keyboard-settings.c b/dialogs/keyboard-settings/xfce-keyboard-settings.c
index 76169ad..e7010a8 100644
--- a/dialogs/keyboard-settings/xfce-keyboard-settings.c
+++ b/dialogs/keyboard-settings/xfce-keyboard-settings.c
@@ -983,27 +983,14 @@ xfce_keyboard_settings_add_button_clicked (XfceKeyboardSettings *settings,
   GObject      *parent;
   const gchar *shortcut;
   const gchar *command;
-  gboolean     finished = FALSE;
   gint         response;
   gboolean     snotify;
 
   g_return_if_fail (XFCE_IS_KEYBOARD_SETTINGS (settings));
 
-  /* Create command dialog */
+  /* Request a command from the user */
   command_dialog = command_dialog_new (NULL, NULL, FALSE);
-
-  /* Run command dialog until a valid (non-empty) command is entered or the dialog is cancelled */
-  do
-    {
-      response = command_dialog_run (COMMAND_DIALOG (command_dialog), GTK_WIDGET (button));
-
-      if (G_UNLIKELY (response == GTK_RESPONSE_OK &&
-                      g_utf8_strlen (command_dialog_get_command (COMMAND_DIALOG (command_dialog)), -1) == 0))
-        xfce_dialog_show_error (GTK_WINDOW (command_dialog), NULL, _("Shortcut command may not be empty."));
-      else
-        finished = TRUE;
-    }
-  while (!finished);
+  response = command_dialog_run (COMMAND_DIALOG (command_dialog), GTK_WIDGET (button));
 
   /* Abort if the dialog was cancelled */
   if (G_UNLIKELY (response == GTK_RESPONSE_OK))
@@ -1076,7 +1063,6 @@ xfce_keyboard_settings_edit_button_clicked (XfceKeyboardSettings *settings)
       if (G_LIKELY (gtk_tree_model_get_iter (model, &iter, path)))
         {
           GtkWidget *command_dialog;
-          gboolean  finished = FALSE;
           gboolean  snotify;
           gchar    *shortcut_label;
           gchar    *shortcut;
@@ -1093,21 +1079,9 @@ xfce_keyboard_settings_edit_button_clicked (XfceKeyboardSettings *settings)
 
           DBG ("Edit shortcut %s / command %s", shortcut, command);
 
-          /* Create command dialog */
+          /* Request a new command from the user */
           command_dialog = command_dialog_new (shortcut_label, command, snotify);
-
-          /* Run command dialog until a valid (non-empty) command is entered or the dialog is cancelled */
-          do
-            {
-              response = command_dialog_run (COMMAND_DIALOG (command_dialog), GTK_WIDGET (view));
-
-              if (G_UNLIKELY (response == GTK_RESPONSE_OK &&
-                              g_utf8_strlen (command_dialog_get_command (COMMAND_DIALOG (command_dialog)), -1) == 0))
-                xfce_dialog_show_error (GTK_WINDOW (command_dialog), NULL, _("Shortcut command may not be empty."));
-              else
-                finished = TRUE;
-            }
-          while (!finished);
+          response = command_dialog_run (COMMAND_DIALOG (command_dialog), GTK_WIDGET (view));
 
           /* Abort if the dialog was cancelled */
           if (G_UNLIKELY (response == GTK_RESPONSE_OK))

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list