diff options
author | Wolfgang Ulbrich <[email protected]> | 2016-01-12 01:21:41 +0100 |
---|---|---|
committer | Wolfgang Ulbrich <[email protected]> | 2016-01-13 15:07:35 +0100 |
commit | 1befe8ddf08c12b5c926d269b31d270fb94b9c3e (patch) | |
tree | 610589db57c82fb63f5984d28b3009eb2c0cbb5a | |
parent | 4b2d71fef886fbdffd8d1a03a337cf1e794d1252 (diff) | |
download | caja-1befe8ddf08c12b5c926d269b31d270fb94b9c3e.tar.bz2 caja-1befe8ddf08c12b5c926d269b31d270fb94b9c3e.tar.xz |
GTK3 file-conflict-dialog: don't use override_font
Set the PangoAttributeList on the GtkLabel instead.
and 'don't force a size request on the labels'
This is not required anymore in GTK+ 3
taken from:
https://git.gnome.org/browse/nautilus/commit/?id=52b8185
https://git.gnome.org/browse/nautilus/commit/?id=b8077a7
https://git.gnome.org/browse/nautilus/commit/?id=1457f53
-rw-r--r-- | libcaja-private/caja-file-conflict-dialog.c | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/libcaja-private/caja-file-conflict-dialog.c b/libcaja-private/caja-file-conflict-dialog.c index 28887f88..300543b3 100644 --- a/libcaja-private/caja-file-conflict-dialog.c +++ b/libcaja-private/caja-file-conflict-dialog.c @@ -116,8 +116,7 @@ file_list_ready_cb (GList *files, GtkWidget *label; GString *str; #if GTK_CHECK_VERSION(3,0,0) - PangoFontDescription *desc, *old_desc; - GtkStyleContext *style; + PangoAttrList *attr_list; #else PangoFontDescription *desc; #endif @@ -221,25 +220,22 @@ file_list_ready_cb (GList *files, label = gtk_label_new (primary_text); gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); gtk_label_set_line_wrap_mode (GTK_LABEL (label), PANGO_WRAP_WORD_CHAR); - gtk_widget_set_size_request (label, 350, -1); -#if GTK_CHECK_VERSION (3, 14, 0) +#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_halign (label, GTK_ALIGN_START); gtk_box_pack_start (GTK_BOX (details->titles_vbox), label, FALSE, FALSE, 0); + gtk_widget_show (label); - style = gtk_widget_get_style_context (label); - gtk_style_context_get_style (style, - GTK_STYLE_PROPERTY_FONT, &old_desc, - NULL); + attr_list = pango_attr_list_new (); + pango_attr_list_insert (attr_list, pango_attr_weight_new (PANGO_WEIGHT_BOLD)); + pango_attr_list_insert (attr_list, pango_attr_scale_new (PANGO_SCALE_LARGE)); + g_object_set (label, + "attributes", attr_list, + NULL); - desc = pango_font_description_new (); - pango_font_description_set_weight (desc, PANGO_WEIGHT_BOLD); - pango_font_description_set_size (desc, - pango_font_description_get_size (old_desc) * PANGO_SCALE_LARGE); - gtk_widget_override_font (label, desc); - pango_font_description_free (desc); - pango_font_description_free (old_desc); + pango_attr_list_unref (attr_list); #else + gtk_widget_set_size_request (label, 350, -1); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_box_pack_start (GTK_BOX (details->titles_vbox), label, FALSE, FALSE, 0); @@ -252,15 +248,15 @@ file_list_ready_cb (GList *files, pango_font_description_get_size (gtk_widget_get_style (label)->font_desc) * PANGO_SCALE_LARGE); gtk_widget_modify_font (label, desc); pango_font_description_free (desc); -#endif gtk_widget_show (label); +#endif label = gtk_label_new (secondary_text); gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); - gtk_widget_set_size_request (label, 350, -1); -#if GTK_CHECK_VERSION (3, 14, 0) +#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_halign (label, GTK_ALIGN_START); #else + gtk_widget_set_size_request (label, 350, -1); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); #endif gtk_box_pack_start (GTK_BOX (details->titles_vbox), |