[gimp/gtk3-port] app: remove GimpHighlightableButton



commit d3dab7ec30837b20af9f25afe295becefbead6a1
Author: Michael Natterer <mitch gimp org>
Date:   Thu May 17 12:56:29 2018 +0200

    app: remove GimpHighlightableButton
    
    and use gimp_button_set_suggested() and _set_destructive() instead.

 app/widgets/Makefile.am               |    2 -
 app/widgets/gimpeditor.c              |    5 +-
 app/widgets/gimphighlightablebutton.c |  356 ---------------------------------
 app/widgets/gimphighlightablebutton.h |   63 ------
 app/widgets/gimplayertreeview.c       |   41 ++---
 5 files changed, 17 insertions(+), 450 deletions(-)
---
diff --git a/app/widgets/Makefile.am b/app/widgets/Makefile.am
index b5630b1..cc8b84b 100644
--- a/app/widgets/Makefile.am
+++ b/app/widgets/Makefile.am
@@ -224,8 +224,6 @@ libappwidgets_a_sources = \
        gimphelp.c                      \
        gimphelp.h                      \
        gimphelp-ids.h                  \
-       gimphighlightablebutton.c       \
-       gimphighlightablebutton.h       \
        gimphistogrambox.c              \
        gimphistogrambox.h              \
        gimphistogrameditor.c           \
diff --git a/app/widgets/gimpeditor.c b/app/widgets/gimpeditor.c
index b7548b6..11d86a9 100644
--- a/app/widgets/gimpeditor.c
+++ b/app/widgets/gimpeditor.c
@@ -34,7 +34,6 @@
 #include "gimpdocked.h"
 #include "gimpeditor.h"
 #include "gimpdnd.h"
-#include "gimphighlightablebutton.h"
 #include "gimpmenufactory.h"
 #include "gimpuimanager.h"
 #include "gimpwidgets-utils.h"
@@ -503,7 +502,7 @@ gimp_editor_add_button (GimpEditor  *editor,
 
   button_icon_size = gimp_editor_ensure_button_box (editor, &button_relief);
 
-  button = gimp_highlightable_button_new ();
+  button = gimp_button_new ();
   gtk_button_set_relief (GTK_BUTTON (button), button_relief);
   gtk_box_pack_start (GTK_BOX (editor->priv->button_box), button, TRUE, TRUE, 0);
   gtk_widget_show (button);
@@ -654,7 +653,7 @@ gimp_editor_add_action_button (GimpEditor  *editor,
   if (GTK_IS_TOGGLE_ACTION (action))
     button = gtk_toggle_button_new ();
   else
-    button = gimp_highlightable_button_new ();
+    button = gimp_button_new ();
 
   gtk_button_set_relief (GTK_BUTTON (button), button_relief);
 
diff --git a/app/widgets/gimplayertreeview.c b/app/widgets/gimplayertreeview.c
index 04d3f5e..bf5c482 100644
--- a/app/widgets/gimplayertreeview.c
+++ b/app/widgets/gimplayertreeview.c
@@ -53,7 +53,6 @@
 #include "gimpcontainerview.h"
 #include "gimpdnd.h"
 #include "gimphelp-ids.h"
-#include "gimphighlightablebutton.h"
 #include "gimplayermodebox.h"
 #include "gimplayertreeview.h"
 #include "gimpspinscale.h"
@@ -64,10 +63,6 @@
 #include "gimp-intl.h"
 
 
-#define HIGHLIGHT_COLOR_GREEN {0.20, 0.70, 0.20, 0.65}
-#define HIGHLIGHT_COLOR_RED   {0.80, 0.20, 0.20, 0.65}
-
-
 struct _GimpLayerTreeViewPriv
 {
   GtkWidget       *layer_mode_box;
@@ -344,19 +339,11 @@ static void
 gimp_layer_tree_view_constructed (GObject *object)
 {
   GimpContainerTreeView *tree_view  = GIMP_CONTAINER_TREE_VIEW (object);
-  GimpItemTreeView      *item_view  = GIMP_ITEM_TREE_VIEW (object);
   GimpLayerTreeView     *layer_view = GIMP_LAYER_TREE_VIEW (object);
   GtkWidget             *button;
 
   G_OBJECT_CLASS (parent_class)->constructed (object);
 
-  gimp_highlightable_button_set_highlight_color (
-    GIMP_HIGHLIGHTABLE_BUTTON (gimp_item_tree_view_get_new_button (item_view)),
-    &(GimpRGB) HIGHLIGHT_COLOR_GREEN);
-  gimp_highlightable_button_set_highlight_color (
-    GIMP_HIGHLIGHTABLE_BUTTON (gimp_item_tree_view_get_delete_button (item_view)),
-    &(GimpRGB) HIGHLIGHT_COLOR_RED);
-
   layer_view->priv->mask_cell = gimp_cell_renderer_viewable_new ();
   gtk_tree_view_column_pack_start (tree_view->main_column,
                                    layer_view->priv->mask_cell,
@@ -398,9 +385,6 @@ gimp_layer_tree_view_constructed (GObject *object)
   button = gimp_editor_add_action_button (GIMP_EDITOR (layer_view), "layers",
                                           "layers-anchor", NULL);
   layer_view->priv->anchor_button = button;
-  gimp_highlightable_button_set_highlight_color (
-    GIMP_HIGHLIGHTABLE_BUTTON (button),
-    &(GimpRGB) HIGHLIGHT_COLOR_GREEN);
   gimp_container_view_enable_dnd (GIMP_CONTAINER_VIEW (layer_view),
                                   GTK_BUTTON (button),
                                   GIMP_TYPE_LAYER);
@@ -1194,22 +1178,27 @@ gimp_layer_tree_view_update_highlight (GimpLayerTreeView *layer_view)
   GimpItemTreeView *item_view    = GIMP_ITEM_TREE_VIEW (layer_view);
   GimpImage        *image        = gimp_item_tree_view_get_image (item_view);
   GimpLayer        *floating_sel = NULL;
+  GtkReliefStyle    default_relief;
 
   if (image)
     floating_sel = gimp_image_get_floating_selection (image);
 
-  gimp_highlightable_button_set_highlight (
-    GIMP_HIGHLIGHTABLE_BUTTON (gimp_item_tree_view_get_new_button (item_view)),
-    floating_sel != NULL &&
-    ! GIMP_IS_CHANNEL (gimp_layer_get_floating_sel_drawable (floating_sel)));
+  gtk_widget_style_get (GTK_WIDGET (layer_view),
+                        "button-relief", &default_relief,
+                        NULL);
+
+  gimp_button_set_suggested (gimp_item_tree_view_get_new_button (item_view),
+                             floating_sel &&
+                             ! GIMP_IS_CHANNEL (gimp_layer_get_floating_sel_drawable (floating_sel)),
+                             default_relief);
 
-  gimp_highlightable_button_set_highlight (
-    GIMP_HIGHLIGHTABLE_BUTTON (gimp_item_tree_view_get_delete_button (item_view)),
-    floating_sel != NULL);
+  gimp_button_set_destructive (gimp_item_tree_view_get_delete_button (item_view),
+                               floating_sel != NULL,
+                               default_relief);
 
-  gimp_highlightable_button_set_highlight (
-    GIMP_HIGHLIGHTABLE_BUTTON (layer_view->priv->anchor_button),
-    floating_sel != NULL);
+  gimp_button_set_suggested (layer_view->priv->anchor_button,
+                             floating_sel != NULL,
+                             default_relief);
 }
 
 


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