Merge lp:~gue5t/midori/wide-prefs into lp:midori

Proposed by gue5t gue5t
Status: Merged
Approved by: Cris Dywan
Approved revision: 6599
Merged at revision: 6614
Proposed branch: lp:~gue5t/midori/wide-prefs
Merge into: lp:midori
Diff against target: 53 lines (+20/-2)
1 file modified
katze/katze-preferences.c (+20/-2)
To merge this branch: bzr merge lp:~gue5t/midori/wide-prefs
Reviewer Review Type Date Requested Status
Cris Dywan Approve
Paweł Forysiuk Approve
Review via email: mp+211121@code.launchpad.net

Commit message

Work around GTK3's hard-coded minimum stackswitcher button width

Description of the change

GTK hard-codes a 100px width on stackswitcher buttons, which with the addition of the file-type tab to preferences results in a very wide preferences dialog for no good reason. This patch resets the size-request so themes can control sizing and so we don't unnecessarily waste space.

To post a comment you must log in.
Revision history for this message
gue5t gue5t (gue5t) wrote :

See the bug (<https://bugs.launchpad.net/midori/+bug/1292666>) for before/after pictures.

lp:~gue5t/midori/wide-prefs updated
6598. By gue5t <email address hidden>

Cosmetic cleanups

6599. By gue5t <email address hidden>

Rename workaround function

Revision history for this message
Cody Garver (codygarver) wrote :

The problem is not Gtk's padding, it's that there are way too many options

Revision history for this message
gue5t gue5t (gue5t) wrote :

> The problem is not Gtk's padding, it's that there are way too many options

I'd say they're both problems, but until we design something better we should have our current (flawed) design at least display as intended; gtk_container_set_homogeneous should be used if we want the switcher buttons to be of equal size, and CSS should be used if we want them to be at least a certain width.

In IRC we discussed alternative UI a little bit, ranging from a KDE/Gimp-style list of preference categories on the left to making filetypes a sub-dialog, but there wasn't clear direction or consensus. So I would say a redesign would be nice, but this bug is orthogonal to any redesign we'll do.

Revision history for this message
Paweł Forysiuk (tuxator) wrote :

Maybe use #if HAVE_STACK_SWITCHER instead of #if GTK_CHECK_VERSION (3, 10, 0) & !HAVE_OSX check?

Otherwise looks good to me.

review: Approve
Revision history for this message
Cris Dywan (kalikiana) wrote :

Good catch with the "&" I was confused for a second why it showed up in the diff.

Works well here (actually no visible difference for me).

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'katze/katze-preferences.c'
2--- katze/katze-preferences.c 2014-02-28 21:37:08 +0000
3+++ katze/katze-preferences.c 2014-03-14 19:04:25 +0000
4@@ -144,7 +144,7 @@
5 {
6 KatzePreferencesPrivate* priv = preferences->priv;
7
8- #if GTK_CHECK_VERSION (3, 10, 0) & !HAVE_OSX
9+ #if GTK_CHECK_VERSION (3, 10, 0) && !HAVE_OSX
10 priv->notebook = gtk_stack_new ();
11 #else
12 priv->notebook = gtk_notebook_new ();
13@@ -160,7 +160,7 @@
14 gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (preferences))),
15 priv->toolbar, FALSE, FALSE, 0);
16 #else
17- #if GTK_CHECK_VERSION (3, 10, 0) & !HAVE_OSX
18+ #if GTK_CHECK_VERSION (3, 10, 0) && !HAVE_OSX
19 priv->toolbar = gtk_stack_switcher_new ();
20 gtk_stack_switcher_set_stack (GTK_STACK_SWITCHER (priv->toolbar), GTK_STACK (priv->notebook));
21 gtk_widget_set_halign (priv->toolbar, GTK_ALIGN_CENTER);
22@@ -200,6 +200,23 @@
23 gtk_widget_show_all (gtk_dialog_get_content_area (GTK_DIALOG (preferences)));
24 }
25
26+#if GTK_CHECK_VERSION (3, 10, 0) & !HAVE_OSX
27+/* these functions are used to clear the 100-px width set in GTK3's
28+update_button function in gtk/gtkstackswitcher.c */
29+
30+static void
31+clear_size_request (GtkWidget* widget)
32+{
33+ gtk_widget_set_size_request (widget, -1, -1);
34+}
35+
36+static void
37+workaround_stack_switcher_sizing (GtkStackSwitcher* switcher)
38+{
39+ gtk_container_forall (GTK_CONTAINER (switcher), (GtkCallback)clear_size_request, NULL);
40+}
41+#endif
42+
43 /**
44 * katze_preferences_add_category:
45 * @preferences: a #KatzePreferences instance
46@@ -235,6 +252,7 @@
47 #if GTK_CHECK_VERSION (3, 10, 0) & !HAVE_OSX
48 gtk_stack_add_titled (GTK_STACK (priv->notebook),
49 priv->page, label, label);
50+ workaround_stack_switcher_sizing (GTK_STACK_SWITCHER (priv->toolbar));
51 #else
52 gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook),
53 priv->page, gtk_label_new (label));

Subscribers

People subscribed via source and target branches

to all changes: