[gtk] filechooserwidget: Pick reasonable default sidebar width
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk] filechooserwidget: Pick reasonable default sidebar width
- Date: Tue, 30 Apr 2019 04:02:18 +0000 (UTC)
commit 1d81a58cf145a9bc413ecff5086ee2df3413a4e3
Author: Timm Bäder <tbaeder redhat com>
Date: Mon Apr 29 08:40:58 2019 +0200
filechooserwidget: Pick reasonable default sidebar width
The old default of 148px doesn't work everywhere. Instead, pick a
default value of -1 and measure() the sidebar widget in the
filechooserwidget in that case. Other values >= 0 are still handled as
before.
gtk/gtkfilechooserwidget.c | 8 ++++++++
gtk/org.gtk.gtk4.Settings.FileChooser.gschema.xml | 2 +-
2 files changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c
index aa3d9ef54a..3347ede9ca 100644
--- a/gtk/gtkfilechooserwidget.c
+++ b/gtk/gtkfilechooserwidget.c
@@ -3750,6 +3750,14 @@ settings_load (GtkFileChooserWidget *impl)
*/
update_time_renderer_visible (impl);
+ if (sidebar_width < 0)
+ {
+ GtkWidget *sidebar = gtk_paned_get_child1 (GTK_PANED (priv->browse_widgets_hpaned));
+
+ gtk_widget_measure (sidebar, GTK_ORIENTATION_HORIZONTAL, -1,
+ NULL, &sidebar_width, NULL, NULL);
+ }
+
gtk_paned_set_position (GTK_PANED (priv->browse_widgets_hpaned), sidebar_width);
}
diff --git a/gtk/org.gtk.gtk4.Settings.FileChooser.gschema.xml
b/gtk/org.gtk.gtk4.Settings.FileChooser.gschema.xml
index 713597a633..2db786b236 100644
--- a/gtk/org.gtk.gtk4.Settings.FileChooser.gschema.xml
+++ b/gtk/org.gtk.gtk4.Settings.FileChooser.gschema.xml
@@ -128,7 +128,7 @@
</description>
</key>
<key name='sidebar-width' type='i'>
- <default>148</default>
+ <default>-1</default>
<summary>Sidebar width</summary>
<description>
Width in pixels of the file chooser's places sidebar.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]