do not use deprecated gtk_widget_override_font
gtk_widget_override_font has been deprecated since GTK 3.16
and should not be used in newly-wrriten code. They suggest using
a CSS style class using application-specific GtkStyleProvider
and a CSS style class.
However, considering that in the case of a GtkLabel we could also
use gtk_label_set_attributes.In this patch, all deprecated
gtk_widget_override_font was replaced using GtkLabel scheme.
Change-Id: I799bd2e07168a8f9adde9057bbdef9d03a16231c
Reviewed-by: Stepan Salenikovich <stepan.salenikovich@savoirfairelinux.com>
diff --git a/src/accountgeneraltab.cpp b/src/accountgeneraltab.cpp
index c6df291..08ac4e4 100644
--- a/src/accountgeneraltab.cpp
+++ b/src/accountgeneraltab.cpp
@@ -239,7 +239,11 @@
gtk_entry_set_text(GTK_ENTRY(entry_username), priv->account->username().toLocal8Bit().constData());
g_object_set(G_OBJECT(entry_username), "editable", FALSE, NULL);
g_object_set(G_OBJECT(entry_username), "max-width-chars", 50, NULL);
- gtk_widget_override_font(entry_username, pango_font_description_from_string("monospace"));
+ PangoAttrList *attrs = pango_attr_list_new();
+ PangoAttribute *font_desc = pango_attr_font_desc_new(pango_font_description_from_string("monospace"));
+ pango_attr_list_insert(attrs, font_desc);
+ gtk_entry_set_attributes(GTK_ENTRY(entry_username), attrs);
+ pango_attr_list_unref(attrs);
gtk_entry_set_alignment(GTK_ENTRY(entry_username), 0.5);
gtk_grid_attach(GTK_GRID(priv->grid_account), entry_username, 1, grid_row, 1, 1);
++grid_row;
diff --git a/src/ringwelcomeview.cpp b/src/ringwelcomeview.cpp
index e8d00bc..cd47f7b 100644
--- a/src/ringwelcomeview.cpp
+++ b/src/ringwelcomeview.cpp
@@ -147,7 +147,11 @@
/* welcome text */
auto label_welcome_text = gtk_label_new(_("Ring is free software for universal communication which respects the freedoms and privacy of its users."));
gtk_label_set_justify(GTK_LABEL(label_welcome_text), GTK_JUSTIFY_CENTER);
- gtk_widget_override_font(label_welcome_text, pango_font_description_from_string("12"));
+ PangoAttrList *attrs_welcome_text = pango_attr_list_new();
+ PangoAttribute *font_desc_welcome_text = pango_attr_font_desc_new(pango_font_description_from_string("12"));
+ pango_attr_list_insert(attrs_welcome_text, font_desc_welcome_text);
+ gtk_label_set_attributes(GTK_LABEL(label_welcome_text), attrs_welcome_text);
+ pango_attr_list_unref(attrs_welcome_text);
gtk_label_set_line_wrap(GTK_LABEL(label_welcome_text), TRUE);
/* the max width chars is to limit how much the text expands */
gtk_label_set_max_width_chars(GTK_LABEL(label_welcome_text), 50);
@@ -168,7 +172,11 @@
/* RingID label */
priv->label_ringid = gtk_label_new(NULL);
gtk_label_set_selectable(GTK_LABEL(priv->label_ringid), TRUE);
- gtk_widget_override_font(priv->label_ringid, pango_font_description_from_string("monospace 12"));
+ PangoAttrList *attrs_ringid = pango_attr_list_new();
+ PangoAttribute *font_desc_ringid = pango_attr_font_desc_new(pango_font_description_from_string("monospace 12"));
+ pango_attr_list_insert(attrs_ringid, font_desc_ringid);
+ gtk_label_set_attributes(GTK_LABEL(priv->label_ringid), attrs_ringid);
+ pango_attr_list_unref(attrs_ringid);
gtk_widget_set_no_show_all(priv->label_ringid, TRUE);
gtk_box_pack_start(GTK_BOX(box_main), priv->label_ringid, FALSE, TRUE, 0);
gtk_label_set_ellipsize(GTK_LABEL(priv->label_ringid), PANGO_ELLIPSIZE_END);