Commit 68293828 authored by Houmin's avatar Houmin Committed by Stepan Salenikovich

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: default avatarStepan Salenikovich <stepan.salenikovich@savoirfairelinux.com>
parent 8809293c
......@@ -239,7 +239,11 @@ build_tab_view(AccountGeneralTab *view)
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;
......
......@@ -147,7 +147,11 @@ ring_welcome_view_init(RingWelcomeView *self)
/* 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 @@ ring_welcome_view_init(RingWelcomeView *self)
/* 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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment