[gnumeric] GUI: Dead kittens.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] GUI: Dead kittens.
- Date: Thu, 10 May 2018 14:43:40 +0000 (UTC)
commit ef72ebbe1936ea97e3d7bc9dbd6f358a48a1127e
Author: Morten Welinder <terra gnome org>
Date: Thu May 10 10:42:54 2018 -0400
GUI: Dead kittens.
link-color as a style property ceased to work.
NEWS | 1 +
src/dialogs/dialog-function-select.c | 7 +++----
src/func.c | 15 ++++++++-------
src/gui-util.c | 7 +++++++
src/gui-util.h | 2 ++
5 files changed, 21 insertions(+), 11 deletions(-)
---
diff --git a/NEWS b/NEWS
index 5f49d78..1d0770d 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@ Gnumeric 1.12.42
Morten:
* Plug leaks.
* Introspection fixes.
+ * Work around gtk+ breakage re. link colors.
--------------------------------------------------------------------------
Gnumeric 1.12.41
diff --git a/src/dialogs/dialog-function-select.c b/src/dialogs/dialog-function-select.c
index 5f74ef6..2429efb 100644
--- a/src/dialogs/dialog-function-select.c
+++ b/src/dialogs/dialog-function-select.c
@@ -577,12 +577,11 @@ make_link (GtkTextBuffer *description, GtkWidget *target, const char *name,
(gtk_text_buffer_get_tag_table (description), name);
if (!link) {
- GdkColor *link_color = NULL;
+ GdkRGBA link_color;
char *link_color_text;
- gtk_widget_style_get (target, "link-color", &link_color, NULL);
- link_color_text = gdk_color_to_string (link_color);
- gdk_color_free (link_color);
+ gnm_get_link_color (target, &link_color);
+ link_color_text = gdk_rgba_to_string (&link_color);
link = gtk_text_buffer_create_tag
(description, name,
diff --git a/src/func.c b/src/func.c
index 1714934..06b86a0 100644
--- a/src/func.c
+++ b/src/func.c
@@ -29,6 +29,7 @@
#include "command-context-stderr.h"
#include "gnm-plugin.h"
#include "gutils.h"
+#include "gui-util.h"
#include <goffice/goffice.h>
#include <glib.h>
@@ -1034,16 +1035,16 @@ gnm_func_convert_markup_to_pango (char const *desc, GtkWidget *target)
{
GString *str;
gchar *markup, *at;
- GdkColor *link_color = NULL;
+ GdkRGBA link_color;
+ PangoColor pg;
char *link_color_text, *span_text;
size_t span_text_len;
- gtk_widget_style_get (target, "link-color", &link_color, NULL);
- if (link_color) {
- link_color_text = gdk_color_to_string (link_color);
- gdk_color_free (link_color);
- } else
- link_color_text = g_strdup ("blue");
+ gnm_get_link_color (target, &link_color);
+ pg.red = 65535 * link_color.red;
+ pg.green = 65535 * link_color.green;
+ pg.blue = 65535 * link_color.blue;
+ link_color_text = pango_color_to_string (&pg);
span_text = g_strdup_printf ("<span foreground=\"%s\">",
link_color_text);
span_text_len = strlen (span_text);
diff --git a/src/gui-util.c b/src/gui-util.c
index f65a5ba..5db82c6 100644
--- a/src/gui-util.c
+++ b/src/gui-util.c
@@ -1359,4 +1359,11 @@ gnm_style_context_get_color (GtkStyleContext *context,
gtk_style_context_restore (context);
}
+void
+gnm_get_link_color (GtkWidget *widget, GdkRGBA *res)
+{
+ GtkStyleContext *ctxt = gtk_widget_get_style_context (widget);
+ gnm_style_context_get_color (ctxt, GTK_STATE_FLAG_LINK, res);
+}
+
// ----------------------------------------------------------------------------
diff --git a/src/gui-util.h b/src/gui-util.h
index a8ad2cb..58f1c4b 100644
--- a/src/gui-util.h
+++ b/src/gui-util.h
@@ -187,6 +187,8 @@ void gnm_style_context_get_color (GtkStyleContext *context,
GtkStateFlags state,
GdkRGBA *color);
+void gnm_get_link_color (GtkWidget *widget, GdkRGBA *res);
+
G_END_DECLS
#endif /* _GNM_GUI_UTIL_H_ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]