[Commits] [SCM] claws branch, gtk3, updated. 3.16.0-618-gae353af

ticho at claws-mail.org ticho at claws-mail.org
Thu Mar 21 19:44:48 CET 2019


The branch, gtk3 has been updated
       via  ae353af73a3da8d94eaa4cc09014e80b70e995d8 (commit)
      from  3da473831ccf94bcba536531fd3b994f63c4a920 (commit)

Summary of changes:
 src/folderview.c     |   19 ++++++-------------
 src/gtk/gtkcmctree.c |   24 ++++++++++--------------
 src/gtk/gtkcmctree.h |    4 ++--
 src/summaryview.c    |   18 ++++++++----------
 4 files changed, 26 insertions(+), 39 deletions(-)


- Log -----------------------------------------------------------------
commit ae353af73a3da8d94eaa4cc09014e80b70e995d8
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Thu Mar 21 19:43:27 2019 +0100

    Push GdkRGBA to GdkColor conversion down to GtkCMCTree API, to reduce code duplication

diff --git a/src/folderview.c b/src/folderview.c
index 4c18fb1..b46986d 100644
--- a/src/folderview.c
+++ b/src/folderview.c
@@ -1509,7 +1509,6 @@ static void folderview_update_node(FolderView *folderview, GtkCMCTreeNode *node)
 	GtkCMCTree *ctree = GTK_CMCTREE(folderview->ctree);
 	GtkStyle *style = NULL, *prev_style;
 	FolderItem *item;
-	GdkColor gdk_color;
 	GdkRGBA black = { 0, 0, 0, 1 };
 	GdkPixbuf *xpm, *openxpm;
 	static GdkPixbuf *searchicon;
@@ -1727,24 +1726,18 @@ static void folderview_update_node(FolderView *folderview, GtkCMCTreeNode *node)
 	if (use_bold) {
 		style = bold_style;
 		if (use_color) {
-			GTKUT_GDKRGBA_TO_GDKCOLOR(folderview->color_new, gdk_color);
-			gtk_cmctree_node_set_foreground(ctree, node, &gdk_color);
+			gtk_cmctree_node_set_foreground(ctree, node, &folderview->color_new);
 		} else if (item->op_count > 0) {
-			GTKUT_GDKRGBA_TO_GDKCOLOR(folderview->color_op, gdk_color);
-			gtk_cmctree_node_set_foreground(ctree, node, &gdk_color);
+			gtk_cmctree_node_set_foreground(ctree, node, &folderview->color_op);
 		} else if (!gdk_rgba_equal(&item->prefs->color, &black)) {
-			GTKUT_GDKRGBA_TO_GDKCOLOR(item->prefs->color, gdk_color);
-			gtk_cmctree_node_set_foreground(ctree, node, &gdk_color);
+			gtk_cmctree_node_set_foreground(ctree, node, &item->prefs->color);
 		}
 	} else if (use_color) {
-		GTKUT_GDKRGBA_TO_GDKCOLOR(folderview->color_new, gdk_color);
-		gtk_cmctree_node_set_foreground(ctree, node, &gdk_color);
+		gtk_cmctree_node_set_foreground(ctree, node, &folderview->color_new);
 	} else if (item->op_count > 0) {
-		GTKUT_GDKRGBA_TO_GDKCOLOR(folderview->color_op, gdk_color);
-		gtk_cmctree_node_set_foreground(ctree, node, &gdk_color);
+		gtk_cmctree_node_set_foreground(ctree, node, &folderview->color_op);
 	} else if (!gdk_rgba_equal(&item->prefs->color, &black)) {
-		GTKUT_GDKRGBA_TO_GDKCOLOR(item->prefs->color, gdk_color);
-		gtk_cmctree_node_set_foreground(ctree, node, &gdk_color);
+		gtk_cmctree_node_set_foreground(ctree, node, &item->prefs->color);
 	}
 
 	gtk_cmctree_node_set_row_style(ctree, node, style);
diff --git a/src/gtk/gtkcmctree.c b/src/gtk/gtkcmctree.c
index 7ddf8f8..69580d5 100644
--- a/src/gtk/gtkcmctree.c
+++ b/src/gtk/gtkcmctree.c
@@ -4432,20 +4432,18 @@ gtk_cmctree_node_get_row_style (GtkCMCTree     *ctree,
 void
 gtk_cmctree_node_set_foreground (GtkCMCTree       *ctree,
 			       GtkCMCTreeNode   *node,
-			       const GdkColor *color)
+			       const GdkRGBA *color)
 {
   cm_return_if_fail (GTK_IS_CMCTREE (ctree));
   cm_return_if_fail (node != NULL);
 
   if (color)
     {
-      GTK_CMCTREE_ROW (node)->row.foreground = *color;
+      GdkColor gdk_color;
+
+      GTKUT_GDKRGBA_TO_GDKCOLOR((*color), gdk_color);
+      GTK_CMCTREE_ROW (node)->row.foreground = gdk_color;
       GTK_CMCTREE_ROW (node)->row.fg_set = TRUE;
-#if !GTK_CHECK_VERSION(3, 0, 0)
-      if (gtk_widget_get_realized (GTK_WIDGET(ctree)))
-	gdk_colormap_alloc_color (gtk_widget_get_colormap (GTK_WIDGET (ctree)),
-			 &GTK_CMCTREE_ROW (node)->row.foreground, TRUE, TRUE);
-#endif
     }
   else
     GTK_CMCTREE_ROW (node)->row.fg_set = FALSE;
@@ -4456,20 +4454,18 @@ gtk_cmctree_node_set_foreground (GtkCMCTree       *ctree,
 void
 gtk_cmctree_node_set_background (GtkCMCTree       *ctree,
 			       GtkCMCTreeNode   *node,
-			       const GdkColor *color)
+			       const GdkRGBA *color)
 {
   cm_return_if_fail (GTK_IS_CMCTREE (ctree));
   cm_return_if_fail (node != NULL);
 
   if (color)
     {
-      GTK_CMCTREE_ROW (node)->row.background = *color;
+      GdkColor gdk_color;
+
+      GTKUT_GDKRGBA_TO_GDKCOLOR((*color), gdk_color);
+      GTK_CMCTREE_ROW (node)->row.background = gdk_color;
       GTK_CMCTREE_ROW (node)->row.bg_set = TRUE;
-#if !GTK_CHECK_VERSION(3, 0, 0)
-      if (gtk_widget_get_realized (GTK_WIDGET(ctree)))
-	gdk_colormap_alloc_color (gtk_widget_get_colormap (GTK_WIDGET (ctree)),
-			 &GTK_CMCTREE_ROW (node)->row.background, TRUE, TRUE);
-#endif
     }
   else
     GTK_CMCTREE_ROW (node)->row.bg_set = FALSE;
diff --git a/src/gtk/gtkcmctree.h b/src/gtk/gtkcmctree.h
index 07b8ea1..33d177f 100644
--- a/src/gtk/gtkcmctree.h
+++ b/src/gtk/gtkcmctree.h
@@ -374,10 +374,10 @@ GtkStyle * gtk_cmctree_node_get_cell_style         (GtkCMCTree     *ctree,
 						  gint          column);
 void gtk_cmctree_node_set_foreground               (GtkCMCTree       *ctree,
 						  GtkCMCTreeNode   *node,
-						  const GdkColor *color);
+						  const GdkRGBA *color);
 void gtk_cmctree_node_set_background               (GtkCMCTree       *ctree,
 						  GtkCMCTreeNode   *node,
-						  const GdkColor *color);
+						  const GdkRGBA *color);
 void gtk_cmctree_node_set_row_data                 (GtkCMCTree     *ctree,
 						  GtkCMCTreeNode *node,
 						  gpointer      data);
diff --git a/src/summaryview.c b/src/summaryview.c
index 6fb7f91..3040f8e 100644
--- a/src/summaryview.c
+++ b/src/summaryview.c
@@ -3946,7 +3946,6 @@ static void summary_set_row_marks(SummaryView *summaryview, GtkCMCTreeNode *row)
 	MsgInfo *msginfo;
 	MsgFlags flags;
 	gint *col_pos = summaryview->col_pos;
-	GdkColor gdk_color;
 
 	msginfo = gtk_cmctree_node_get_row_data(ctree, row);
 	if (!msginfo) return;
@@ -4001,9 +4000,8 @@ static void summary_set_row_marks(SummaryView *summaryview, GtkCMCTreeNode *row)
 		else {
 			style = small_deleted_style;
 		}
-		GTKUT_GDKRGBA_TO_GDKCOLOR(summaryview->color_dim, gdk_color);
-			gtk_cmctree_node_set_foreground
-				(ctree, row, &gdk_color);
+		gtk_cmctree_node_set_foreground
+			(ctree, row, &summaryview->color_dim);
 	} else if (MSG_IS_MARKED(flags)) {
 		gtk_cmctree_node_set_pixbuf(ctree, row, col_pos[S_COL_MARK],
 					  markxpm);
@@ -4017,16 +4015,16 @@ static void summary_set_row_marks(SummaryView *summaryview, GtkCMCTreeNode *row)
 			else {
 				style = small_marked_style;
 			}
-			GTKUT_GDKRGBA_TO_GDKCOLOR(summaryview->color_marked, gdk_color);
-			gtk_cmctree_node_set_foreground(ctree, row, &gdk_color);
+			gtk_cmctree_node_set_foreground
+				(ctree, row, &summaryview->color_marked);
 		} else {
 			if (style)
 				style = bold_deleted_style;
 			else {
 				style = small_deleted_style;
 			}
-			GTKUT_GDKRGBA_TO_GDKCOLOR(summaryview->color_dim, gdk_color);
-				gtk_cmctree_node_set_foreground(ctree, row, &gdk_color);
+			gtk_cmctree_node_set_foreground
+				(ctree, row, &summaryview->color_dim);
 		}
 	} else if (MSG_IS_COPY(flags)) {
 		gtk_cmctree_node_set_pixbuf(ctree, row, col_pos[S_COL_MARK],
@@ -4036,8 +4034,8 @@ static void summary_set_row_marks(SummaryView *summaryview, GtkCMCTreeNode *row)
 		else {
 			style = small_marked_style;
 		}
-		GTKUT_GDKRGBA_TO_GDKCOLOR(summaryview->color_marked, gdk_color);
-			gtk_cmctree_node_set_foreground(ctree, row, &gdk_color);
+		gtk_cmctree_node_set_foreground
+			(ctree, row, &summaryview->color_marked);
 	} else {
 		gtk_cmctree_node_set_text(ctree, row, col_pos[S_COL_MARK], "");
 	}

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list