Bug fix: Info sidebar width in GTK3
authorColin Clark <colin.clark@cclark.uk>
Fri, 8 Sep 2017 10:25:06 +0000 (11:25 +0100)
committerColin Clark <colin.clark@cclark.uk>
Fri, 8 Sep 2017 10:25:06 +0000 (11:25 +0100)
In bar_size_allocate() the width obained is the allocated width. In GTK2
this is the actual width. In GTK3 it is the *minimum* width. This
results in the info sidebar being able to increase, but not decrease.
There does not seem to be a way in GTK3 to get the actual width of a
widget. For GTK3 the only way is to disable it. The width of the sidebar
is therefore not preserved across restarts.

src/bar.c

index d607202..0eb8fdf 100644 (file)
--- a/src/bar.c
+++ b/src/bar.c
@@ -739,7 +739,16 @@ GtkWidget *bar_update_from_config(GtkWidget *bar, const gchar **attribute_names,
                log_printf("unknown attribute %s = %s\n", option, value);
                }
 
+#if !GTK_CHECK_VERSION(3,0,0)
+/* FIXME: In bar_size_allocate() the width obained is the allocated width. In GTK2 this
+ * is the actual width. In GTK3 it is the *minimum* width.
+ * This results in the info sidebar being able to increase, but not
+ * decrease. There does not seem to be a way in GTK3 to get the actual width of
+ * a widget. For GTK3 the only way is to disable it. The width of the sidebar
+ * is therefore not preserved across restarts.
+ */
        gtk_widget_set_size_request(bar, width, -1);
+#endif
        if (enabled)
                {
                gtk_widget_show(bar);