[gimp] app: color widget updated properly when editing colors.



commit 7cf06c3f60546bb0d71ff7ab85009181138536ea
Author: Jehan <jehan girinstud io>
Date:   Wed Mar 20 11:21:46 2019 +0100

    app: color widget updated properly when editing colors.
    
    Also note that GimpColorPanel doesn't need to react differently whether
    GimpColorDialog returned OK or CANCEL, as the dialog keep track and
    return the appropriate color to set in the end of the process.

 app/tools/gimptextoptions.c  |  1 +
 app/widgets/gimpcolorpanel.c | 14 ++++----------
 2 files changed, 5 insertions(+), 10 deletions(-)
---
diff --git a/app/tools/gimptextoptions.c b/app/tools/gimptextoptions.c
index d9019880dc..f51beffe7f 100644
--- a/app/tools/gimptextoptions.c
+++ b/app/tools/gimptextoptions.c
@@ -603,6 +603,7 @@ gimp_text_options_gui (GimpToolOptions *tool_options)
 
   button = gimp_prop_color_button_new (config, "foreground", _("Text Color"),
                                        40, 24, GIMP_COLOR_AREA_FLAT);
+  gimp_color_button_set_update (GIMP_COLOR_BUTTON (button), TRUE);
   gimp_color_panel_set_context (GIMP_COLOR_PANEL (button),
                                 GIMP_CONTEXT (options));
   gtk_widget_set_halign (button, GTK_ALIGN_START);
diff --git a/app/widgets/gimpcolorpanel.c b/app/widgets/gimpcolorpanel.c
index f76f8a346a..1aeaae3ac4 100644
--- a/app/widgets/gimpcolorpanel.c
+++ b/app/widgets/gimpcolorpanel.c
@@ -309,17 +309,11 @@ gimp_color_panel_dialog_update (GimpColorDialog      *dialog,
       break;
 
     case GIMP_COLOR_DIALOG_OK:
-      if (! gimp_color_button_get_update (GIMP_COLOR_BUTTON (panel)))
-        gimp_color_button_set_color (GIMP_COLOR_BUTTON (panel), color);
-      gtk_widget_hide (panel->color_dialog);
-
-      g_signal_emit (panel, color_panel_signals[RESPONSE], 0,
-                     state);
-      break;
-
     case GIMP_COLOR_DIALOG_CANCEL:
-      if (gimp_color_button_get_update (GIMP_COLOR_BUTTON (panel)))
-        gimp_color_button_set_color (GIMP_COLOR_BUTTON (panel), color);
+      /* GimpColorDialog returns the appropriate color (new one or
+       * original one if process cancelled.
+       */
+      gimp_color_button_set_color (GIMP_COLOR_BUTTON (panel), color);
       gtk_widget_hide (panel->color_dialog);
 
       g_signal_emit (panel, color_panel_signals[RESPONSE], 0,


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