[gimp/gtk3-port: 228/391] libgimpwidgets, app: use GdkRGBA instead of GdkColor for cell backgrounds



commit 6dc173b968a4e11277fcd0ad326332cc1e6ef783
Author: Michael Natterer <mitch gimp org>
Date:   Tue Nov 1 12:50:10 2016 +0100

    libgimpwidgets, app: use GdkRGBA instead of GdkColor for cell backgrounds

 app/widgets/gimpitemtreeview.c          |   14 ++++----------
 libgimpwidgets/gimpcellrenderertoggle.c |   10 ++++------
 2 files changed, 8 insertions(+), 16 deletions(-)
---
diff --git a/app/widgets/gimpitemtreeview.c b/app/widgets/gimpitemtreeview.c
index e06fae1..c9cfb2b 100644
--- a/app/widgets/gimpitemtreeview.c
+++ b/app/widgets/gimpitemtreeview.c
@@ -332,7 +332,7 @@ gimp_item_tree_view_init (GimpItemTreeView *view)
   view->priv->model_column_color_tag =
     gimp_container_tree_store_columns_add (tree_view->model_columns,
                                            &tree_view->n_model_columns,
-                                           GDK_TYPE_COLOR);
+                                           GDK_TYPE_RGBA);
 
   gimp_container_tree_view_set_dnd_drop_to_empty (tree_view, TRUE);
 
@@ -380,7 +380,7 @@ gimp_item_tree_view_constructed (GObject *object)
                                        item_view->priv->model_column_visible,
                                        "inconsistent",
                                        item_view->priv->model_column_viewable,
-                                       "cell-background-gdk",
+                                       "cell-background-rgba",
                                        item_view->priv->model_column_color_tag,
                                        NULL);
 
@@ -986,7 +986,6 @@ gimp_item_tree_view_insert_item (GimpContainerView *view,
   GimpItem              *item      = GIMP_ITEM (viewable);
   GtkTreeIter           *iter;
   GimpRGB                color;
-  GdkColor               gdk_color;
   gboolean               has_color;
 
   item_view->priv->inserting_item = TRUE;
@@ -1000,8 +999,6 @@ gimp_item_tree_view_insert_item (GimpContainerView *view,
                                         &color,
                                         gimp_item_get_color_tag (item) ==
                                         GIMP_COLOR_TAG_NONE);
-  if (has_color)
-    gimp_rgb_get_gdk_color (&color, &gdk_color);
 
   gtk_tree_store_set (GTK_TREE_STORE (tree_view->model), iter,
                       item_view->priv->model_column_visible,
@@ -1012,7 +1009,7 @@ gimp_item_tree_view_insert_item (GimpContainerView *view,
                       item_view->priv->model_column_linked,
                       gimp_item_get_linked (item),
                       item_view->priv->model_column_color_tag,
-                      has_color ? &gdk_color : NULL,
+                      has_color ? (GdkRGBA *) &color : NULL,
                       -1);
 
   return iter;
@@ -1416,19 +1413,16 @@ gimp_item_tree_view_color_tag_changed (GimpItem         *item,
     {
       GimpContainer *children;
       GimpRGB        color;
-      GdkColor       gdk_color;
       gboolean       has_color;
 
       has_color = gimp_get_color_tag_color (gimp_item_get_merged_color_tag (item),
                                             &color,
                                             gimp_item_get_color_tag (item) ==
                                             GIMP_COLOR_TAG_NONE);
-      if (has_color)
-        gimp_rgb_get_gdk_color (&color, &gdk_color);
 
       gtk_tree_store_set (GTK_TREE_STORE (tree_view->model), iter,
                           view->priv->model_column_color_tag,
-                          has_color ? &gdk_color : NULL,
+                          has_color ? (GdkRGBA *) &color : NULL,
                           -1);
 
       children = gimp_viewable_get_children (GIMP_VIEWABLE (item));
diff --git a/libgimpwidgets/gimpcellrenderertoggle.c b/libgimpwidgets/gimpcellrenderertoggle.c
index 4e510bd..7cdf8c3 100644
--- a/libgimpwidgets/gimpcellrenderertoggle.c
+++ b/libgimpwidgets/gimpcellrenderertoggle.c
@@ -380,19 +380,17 @@ gimp_cell_renderer_toggle_render (GtkCellRenderer      *cell,
 
       if (background_set)
         {
-          cairo_t  *cr = gdk_cairo_create (window);
-          GdkColor *color;
+          GdkRGBA *color;
 
           g_object_get (cell,
-                        "cell-background-gdk", &color,
+                        "cell-background-rgba", &color,
                         NULL);
 
           gdk_cairo_rectangle (cr, background_area);
-          gdk_cairo_set_source_color (cr, color);
+          gdk_cairo_set_source_rgba (cr, color);
           cairo_fill (cr);
 
-          gdk_color_free (color);
-          cairo_destroy (cr);
+          gdk_rgba_free (color);
         }
     }
 


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