Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#662 hide/append toolbar doesn't expand the menu

closed-fixed
Interface (176)
5
2011-03-10
2011-03-10
Josh
No

When 'Show Toolbar' isn't checked and 'Append to menu' is checked the menu should expand, but it doesn't.

Discussion

  • Josh
    Josh
    2011-03-10

    This fixed it as far as I know

     
    Attachments
    • status: open --> closed-fixed
     
  • Now fixed in SVN, thanks for the report!

    Just a note for posting patches, please use the unified patch format (diff -u), it is a lot easier to use :)

     
    • assigned_to: nobody --> colombanw
     
  • Josh
    Josh
    2011-06-21

    hey it looks like I could've done this easier because of how box packing works in gtk+.. here's how it would be patched (a little easier):

    @@ -479,7 +479,7 @@
    /* we need to adjust the packing flags for the menubar to expand it if it is alone in the
    * hbox and not expand it if the toolbar is appended */
    gtk_box_set_child_packing(GTK_BOX(hbox_menubar), menubar,
    - ! toolbar_prefs.visible || ! toolbar_prefs.append_to_menu, TRUE, 0, GTK_PACK_START);
    + ! toolbar_prefs.append_to_menu, ! toolbar_prefs.append_to_menu, 0, GTK_PACK_START);
    }

    or if it has already been patched...:

    @@ -479,7 +479,7 @@
    /* we need to adjust the packing flags for the menubar to expand it if it is alone in the
    * hbox and not expand it if the toolbar is appended */
    gtk_box_set_child_packing(GTK_BOX(hbox_menubar), menubar,
    - ! toolbar_prefs.visible || ! toolbar_prefs.append_to_menu, TRUE, 0, GTK_PACK_START);
    + ! toolbar_prefs.visible || ! toolbar_prefs.append_to_menu, ! toolbar_prefs.visible || ! toolbar_prefs.append_to_menu, 0, GTK_PACK_START);
    }

     
  • Josh
    Josh
    2011-09-30

    I know this is closed... but I thought of a (very slightly) easier way to do this. If you scroll to see the 'fill' property here http://developer.gnome.org/gtk3/stable/GtkBox.html#gtk-box-set-child-packing you'll see it's dependent on what 'expand' is (Whether the child should receive extra space >when the parent grows.<). I can't attach patches because this is closed... but this should work as well as the last one:

    diff --git a/src/toolbar.c b/src/toolbar.c
    index 00d38a4..658c3bc 100644
    --- a/src/toolbar.c
    +++ b/src/toolbar.c
    @@ -482,8 +482,7 @@ void toolbar_update_ui(void)
    /* we need to adjust the packing flags for the menubar to expand it if it is alone in the
    * hbox and not expand it if the toolbar is appended */
    gtk_box_set_child_packing(GTK_BOX(hbox_menubar), menubar,
    - ! (toolbar_prefs.visible && toolbar_prefs.append_to_menu),
    - ! (toolbar_prefs.visible && toolbar_prefs.append_to_menu), 0, GTK_PACK_START);
    + ! (toolbar_prefs.visible && toolbar_prefs.append_to_menu), TRUE, 0, GTK_PACK_START);
    }