summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorlukefromdc <[email protected]>2016-09-05 23:44:09 -0400
committerlukefromdc <[email protected]>2016-09-05 23:44:09 -0400
commitadabb4340bdcd1fe4dc58614690631bc69937fc5 (patch)
tree6ee40d5e7bacd4be9cb7231f488aecd56a6574d1 /src
parentb6dc8005f32c50bb3eb37f8fe17bdebf2f296e81 (diff)
downloadcaja-adabb4340bdcd1fe4dc58614690631bc69937fc5.tar.bz2
caja-adabb4340bdcd1fe4dc58614690631bc69937fc5.tar.xz
GTK3: fix pathbar pango warnings
Fix gtk_widget_create_pango_layout: assertion 'GTK_IS_WIDGET (widget)' failed warning and those descending from it. This does NOT fix the gtk_widget_set_size_request: assertion 'GTK_IS_WIDGET (widget)' failed, which occurs because recent GTK3 versions warn that button_data is not a GtkWidget but still succeed in setting the size. Since GTK 3.22 will be the LAST version of GTK3 this won't break until GTK4 if ever. Taking this out caused the pathbar buttons to jump on bold text so it had to be retained
Diffstat (limited to 'src')
-rw-r--r--src/caja-pathbar.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/caja-pathbar.c b/src/caja-pathbar.c
index b8adb57b..39903f6e 100644
--- a/src/caja-pathbar.c
+++ b/src/caja-pathbar.c
@@ -1603,8 +1603,11 @@ set_label_size_request (ButtonData *button_data)
PangoLayout *layout;
gint width, height, bold_width, bold_height;
gchar *markup;
+ GtkWidget *label;
- layout = gtk_widget_create_pango_layout (button_data->label, dir_name);
+ /*This is needed because button_data->label is not a GtkWidget*/
+ label = gtk_label_new(dir_name);
+ layout = gtk_widget_create_pango_layout (label, dir_name);
pango_layout_get_pixel_size (layout, &width, &height);
markup = g_markup_printf_escaped ("<b>%s</b>", dir_name);
@@ -1613,11 +1616,16 @@ set_label_size_request (ButtonData *button_data)
pango_layout_get_pixel_size (layout, &bold_width, &bold_height);
+ /*Fixme-this works but throws runtime warnings about not being a GtkWidget*/
gtk_widget_set_size_request (button_data->label,
MAX (width, bold_width),
MAX (height, bold_height));
g_object_unref (layout);
+ /*recommended approach to freeing a never-packed GtkWidget*/
+ g_object_ref_sink(G_OBJECT(label));
+ gtk_widget_destroy (label);
+ g_object_unref (label);
}
#else /* GTK_CHECK_VERSION(3,0,0) */