[Commits] [SCM] claws branch, gtk3, updated. 3.16.0-434-ga1c1838
ticho at claws-mail.org
ticho at claws-mail.org
Sun Oct 28 13:35:57 CET 2018
The branch, gtk3 has been updated
via a1c18383eec22739453b947a5660b6bc5367e1f5 (commit)
from 9ad2c0be37218fe61b8bac55331b67d159706c71 (commit)
Summary of changes:
src/gtk/gtkutils.c | 21 +++++++++++++++++++++
src/gtk/gtkutils.h | 5 ++++-
2 files changed, 25 insertions(+), 1 deletion(-)
- Log -----------------------------------------------------------------
commit a1c18383eec22739453b947a5660b6bc5367e1f5
Author: Andrej Kacian <ticho at claws-mail.org>
Date: Sun Oct 28 13:30:29 2018 +0100
A new, non-deprecated way to set color of pref color buttons.
We use Pango markup to set the button label background color,
instead of changing widget-level background color, which doesn't
work anymore in GTK3.
diff --git a/src/gtk/gtkutils.c b/src/gtk/gtkutils.c
index bf8f369..7c8c0cb 100644
--- a/src/gtk/gtkutils.c
+++ b/src/gtk/gtkutils.c
@@ -2133,3 +2133,24 @@ gchar *gtkut_gdk_rgba_to_string(GdkRGBA *rgba)
return str;
}
#undef RGBA_ELEMENT_TO_BYTE
+
+void gtkut_set_button_color(GtkWidget *button,
+ GdkRGBA *rgba)
+{
+ gchar *str, *markup;
+ GtkWidget *label;
+
+ cm_return_if_fail(button != NULL);
+ cm_return_if_fail(rgba != NULL);
+
+ label = gtk_bin_get_child(GTK_BIN(button));
+ cm_return_if_fail(label != NULL);
+
+ str = gtkut_gdk_rgba_to_string(rgba);
+
+ markup = g_strdup_printf("<span bgcolor=\"%s\">" GTKUT_COLOR_BUTTON_LABEL "</span>", str);
+ g_free(str);
+
+ gtk_label_set_markup(GTK_LABEL(label), markup);
+ g_free(markup);
+}
diff --git a/src/gtk/gtkutils.h b/src/gtk/gtkutils.h
index 38ffe95..f81831f 100644
--- a/src/gtk/gtkutils.h
+++ b/src/gtk/gtkutils.h
@@ -56,8 +56,9 @@
#define GTKUT_CTREE_REFRESH(clist) \
GTK_CMCLIST_GET_CLASS(clist)->refresh(clist)
+#define GTKUT_COLOR_BUTTON_LABEL "\x20\xE2\x80\x83\x20"
#define GTKUT_COLOR_BUTTON() \
- gtk_button_new_with_label("\x20\xE2\x80\x83\x20")
+ gtk_button_new_with_label(GTKUT_COLOR_BUTTON_LABEL)
/* Set "color" to the same color as "rgba" */
#define GTKUT_GDKRGBA_TO_GDKCOLOR(rgba, color) { \
@@ -165,6 +166,8 @@ GtkWidget *gtkut_account_menu_new (GList *ac_list,
void gtkut_set_widget_bgcolor_rgb (GtkWidget *widget,
GdkRGBA rgbvalue);
+void gtkut_set_button_color(GtkWidget *button,
+ GdkRGBA *rgbvalue);
void gtkut_widget_set_small_font_size(GtkWidget *widget);
GtkWidget *gtkut_get_focused_child (GtkContainer *parent);
-----------------------------------------------------------------------
hooks/post-receive
--
Claws Mail
More information about the Commits
mailing list