[balsa/gtk3] Deprecation cleanup
- From: Peter Bloomfield <peterb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa/gtk3] Deprecation cleanup
- Date: Tue, 10 Feb 2015 22:23:11 +0000 (UTC)
commit 4bdb85db1892ac038830634ffbb3e7331a15fa04
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Tue Feb 10 17:22:47 2015 -0500
Deprecation cleanup
* libbalsa/source-viewer.c (libbalsa_show_message_source):
gtk_widget_override_font is deprecated, use CSS instead.
ChangeLog | 7 +++++++
libbalsa/source-viewer.c | 19 +++++++++++++++----
2 files changed, 22 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 8f146a0..bfa1974 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2015-02-10 Peter Bloomfield <pbloomfield bellsouth net>
+
+ Deprecation cleanup
+
+ * libbalsa/source-viewer.c (libbalsa_show_message_source):
+ gtk_widget_override_font is deprecated, use CSS instead.
+
2015-02-08 Peter Bloomfield <pbloomfield bellsouth net>
* src/main-window.c (balsa_window_new): vertically center the
diff --git a/libbalsa/source-viewer.c b/libbalsa/source-viewer.c
index 7c3bf2b..9b85892 100644
--- a/libbalsa/source-viewer.c
+++ b/libbalsa/source-viewer.c
@@ -184,6 +184,8 @@ lsv_size_allocate_cb(GtkWindow * window, GtkAllocation * alloc,
}
}
+#define BALSA_SOURCE_VIEWER "balsa-source-viewer"
+
void
libbalsa_show_message_source(GtkApplication * application,
LibBalsaMessage * msg,
@@ -193,7 +195,8 @@ libbalsa_show_message_source(GtkApplication * application,
gint * height)
{
GtkWidget *text;
- PangoFontDescription *desc;
+ gchar *css;
+ GtkCssProvider *css_provider;
GtkWidget *vbox, *interior;
GtkWidget *window;
gchar *ui_file;
@@ -207,9 +210,17 @@ libbalsa_show_message_source(GtkApplication * application,
text = gtk_text_view_new();
- desc = pango_font_description_from_string(font);
- gtk_widget_override_font(text, desc);
- pango_font_description_free(desc);
+ gtk_widget_set_name(text, BALSA_SOURCE_VIEWER);
+ css = g_strconcat("#" BALSA_SOURCE_VIEWER " {font:", font, "}", NULL);
+
+ css_provider = gtk_css_provider_new();
+ gtk_css_provider_load_from_data(css_provider, css, -1, NULL);
+ g_free(css);
+
+ gtk_style_context_add_provider(gtk_widget_get_style_context(text) ,
+ GTK_STYLE_PROVIDER(css_provider),
+ GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+ g_object_unref(css_provider);
gtk_text_view_set_editable(GTK_TEXT_VIEW(text), FALSE);
gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(text), GTK_WRAP_WORD_CHAR);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]