<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im"><br>
</div>Why not? Lets migrate all our gtk3 components to GtkGrid!<br>
<div class="im"><br></div></blockquote><div><br></div><div>We should check if the move to GtkGrid is really "free of charge".</div><div>There are a lot to change right now, and if changing the boxes</div><div>break (or change visuals) in subtle ways, will be a headache.</div>
<div> </div><div>Then, should be good test it, before doing a massive search and replace.</div><div><br></div><div>Gonzalo</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">
> So the first question that arises is: should we switch directly to GtkGrid<br>
> [2]? Best would be to do a simple test program and compare the different<br>
> containers. If GtkGrid can be used in the same way and it is the intended<br>
> way forward we should switch directly to that. The migrating guide is<br>
> interesting as well [3].<br>
</div>Your articles say the ways to do it with GtkGrid are very different<br>
than with GtkBox, but it's similar than the GtkTable.<br>
<br>
I can make another patch with the migration from GtkBox and GtkTable<br>
to GtkGrid and add the information to the Wiki [1], but this patch<br>
hasn't got only corrections of boxes. You decide if I have to make<br>
from this patch a version 2, or make a new patch only with boxes and<br>
tables corrections.<br>
<br>
Cheers.<br>
<br>
[1] <a href="http://wiki.sugarlabs.org/go/Features/GTK3/Porting" target="_blank">http://wiki.sugarlabs.org/go/Features/GTK3/Porting</a><br>
<div class="HOEnZb"><div class="h5"><br>
> Regards,<br>
>   Simon<br>
><br>
> [1] <a href="http://developer.gnome.org/gtk3/3.4/GtkHBox.html" target="_blank">http://developer.gnome.org/gtk3/3.4/GtkHBox.html</a><br>
> [2] <a href="http://developer.gnome.org/gtk3/3.4/GtkGrid.html" target="_blank">http://developer.gnome.org/gtk3/3.4/GtkGrid.html</a><br>
> [3] <a href="http://developer.gnome.org/gtk3/3.4/gtk-migrating-GtkGrid.html" target="_blank">http://developer.gnome.org/gtk3/3.4/gtk-migrating-GtkGrid.html</a><br>
><br>
><br>
><br>
> On 06/27/2012 04:56 AM, Daniel Francis wrote:<br>
>><br>
>> ---<br>
>>  src/sugar3/activity/widgets.py      |    3 ++-<br>
>>  src/sugar3/graphics/alert.py        |    9 ++++++---<br>
>>  src/sugar3/graphics/notebook.py     |    6 ++++--<br>
>>  src/sugar3/graphics/palette.py      |   27 +++++++++++++++++++--------<br>
>>  src/sugar3/graphics/panel.py        |    3 ++-<br>
>>  src/sugar3/graphics/radiopalette.py |    3 ++-<br>
>>  src/sugar3/graphics/toolbarbox.py   |    3 ++-<br>
>>  src/sugar3/graphics/toolbox.py      |    6 ++++--<br>
>>  src/sugar3/graphics/toolcombobox.py |    3 ++-<br>
>>  src/sugar3/graphics/tray.py         |    6 ++++--<br>
>>  src/sugar3/graphics/window.py       |    6 ++++--<br>
>>  11 files changed, 51 insertions(+), 24 deletions(-)<br>
>><br>
>> diff --git a/src/sugar3/activity/widgets.py<br>
>> b/src/sugar3/activity/widgets.py<br>
>> index c4015ce..ffb3503 100644<br>
>> --- a/src/sugar3/activity/widgets.py<br>
>> +++ b/src/sugar3/activity/widgets.py<br>
>> @@ -226,7 +226,8 @@ class DescriptionItem(Gtk.ToolItem):<br>
>>          description_button.set_tooltip(_('Description'))<br>
>>          self._palette = description_button.get_palette()<br>
>><br>
>> -        description_box = Gtk.HBox()<br>
>> +        description_box = Gtk.Box()<br>
>> +        description_box.set_orientation(Gtk.Orientation.HORIZONTAL)<br>
>>          sw = Gtk.ScrolledWindow()<br>
>>          sw.set_size_request(int(Gdk.Screen.width() / 2),<br>
>>                              2 * style.GRID_CELL_SIZE)<br>
>> diff --git a/src/sugar3/graphics/alert.py b/src/sugar3/graphics/alert.py<br>
>> index 16392cd..358fea4 100644<br>
>> --- a/src/sugar3/graphics/alert.py<br>
>> +++ b/src/sugar3/graphics/alert.py<br>
>> @@ -97,11 +97,13 @@ class Alert(Gtk.EventBox):<br>
>>          self._icon = None<br>
>>          self._buttons = {}<br>
>><br>
>> -        self._hbox = Gtk.HBox()<br>
>> +        self._hbox = Gtk.Box()<br>
>> +        self._hbox.set_orientation(Gtk.Orientation.HORIZONTAL)<br>
>>          self._hbox.set_border_width(style.DEFAULT_SPACING)<br>
>>          self._hbox.set_spacing(style.DEFAULT_SPACING)<br>
>><br>
>> -        self._msg_box = Gtk.VBox()<br>
>> +        self._msg_box = Gtk.Box()<br>
>> +        self._msg_box.set_orientation(Gtk.Orientation.VERTICAL)<br>
>>          self._title_label = Gtk.Label()<br>
>>          self._title_label.set_alignment(0, 0.5)<br>
>>          self._msg_box.pack_start(self._title_label, False, False, 0)<br>
>> @@ -111,7 +113,8 @@ class Alert(Gtk.EventBox):<br>
>>          self._msg_box.pack_start(self._msg_label, False, False, 0)<br>
>>          self._hbox.pack_start(self._msg_box, False, False, 0)<br>
>><br>
>> -        self._buttons_box = Gtk.HButtonBox()<br>
>> +        self._buttons_box = Gtk.ButtonBox()<br>
>> +        self._buttons_box.set_orientation(Gtk.Orientation.HORIZONTAL)<br>
>>          self._buttons_box.set_layout(Gtk.ButtonBoxStyle.END)<br>
>>          self._buttons_box.set_spacing(style.DEFAULT_SPACING)<br>
>>          self._hbox.pack_start(self._buttons_box, True, True, 0)<br>
>> diff --git a/src/sugar3/graphics/notebook.py<br>
>> b/src/sugar3/graphics/notebook.py<br>
>> index e14bf0e..0f3e858 100644<br>
>> --- a/src/sugar3/graphics/notebook.py<br>
>> +++ b/src/sugar3/graphics/notebook.py<br>
>> @@ -74,7 +74,8 @@ class Notebook(Gtk.Notebook):<br>
>>              raise AssertionError<br>
>><br>
>>      def _add_icon_to_button(self, button):<br>
>> -        icon_box = Gtk.HBox()<br>
>> +        icon_box = Gtk.Box()<br>
>> +        icon_box.set_orientation(Gtk.Orientation.HORIZONTAL)<br>
>>          image = Gtk.Image()<br>
>>          image.set_from_stock(Gtk.STOCK_CLOSE, Gtk.IconSize.MENU)<br>
>>          Gtk.Button.set_relief(button, Gtk.ReliefStyle.NONE)<br>
>> @@ -91,7 +92,8 @@ class Notebook(Gtk.Notebook):<br>
>>      def _create_custom_tab(self, text, child):<br>
>>          event_box = Gtk.EventBox()<br>
>><br>
>> -        tab_box = Gtk.HBox(False, 2)<br>
>> +        tab_box = Gtk.Box(False, 2)<br>
>> +        tab_box.set_orientation(Gtk.Orientation.HORIZONTAL)<br>
>>          tab_label = Gtk.Label(label=text)<br>
>><br>
>>          tab_button = Gtk.Button()<br>
>> diff --git a/src/sugar3/graphics/palette.py<br>
>> b/src/sugar3/graphics/palette.py<br>
>> index 4bb72ce..b389896 100644<br>
>> --- a/src/sugar3/graphics/palette.py<br>
>> +++ b/src/sugar3/graphics/palette.py<br>
>> @@ -79,14 +79,17 @@ class Palette(PaletteWindow):<br>
>>          self._icon_visible = True<br>
>>          self._palette_state = self.PRIMARY<br>
>><br>
>> -        self._primary_box = Gtk.HBox()<br>
>> +        self._primary_box = Gtk.Box()<br>
>> +        self._primary_box.set_orientation(Gtk.Orientation.HORIZONTAL)<br>
>>          self._primary_box.show()<br>
>><br>
>> -        self._icon_box = Gtk.HBox()<br>
>> +        self._icon_box = Gtk.Box()<br>
>> +        self._icon_box.set_orientation(Gtk.Orientation.HORIZONTAL)<br>
>>          self._icon_box.set_size_request(style.GRID_CELL_SIZE, -1)<br>
>>          self._primary_box.pack_start(self._icon_box, False, True, 0)<br>
>><br>
>> -        labels_box = Gtk.VBox()<br>
>> +        labels_box = Gtk.Box()<br>
>> +        labels_box.set_orientation(Gtk.Orientation.VERTICAL)<br>
>>          self._label_alignment = Gtk.Alignment(xalign=0, yalign=0.5,<br>
>> xscale=1,<br>
>>                                                yscale=0.33)<br>
>>          self._label_alignment.set_padding(0, 0, style.DEFAULT_SPACING,<br>
>> @@ -113,9 +116,11 @@ class Palette(PaletteWindow):<br>
>><br>
>>          labels_box.pack_start(self._secondary_label, True, True, 0)<br>
>><br>
>> -        self._secondary_box = Gtk.VBox()<br>
>> +        self._secondary_box = Gtk.Box()<br>
>> +        self._secondary_box.set_orientation(Gtk.Orientation.VERTICAL)<br>
>><br>
>> -        self._separator = Gtk.HSeparator()<br>
>> +        self._separator = Gtk.Separator()<br>
>> +        self._separator.set_orientation(Gtk.Orientation.HORIZONTAL)<br>
>>          self._secondary_box.pack_start(self._separator, True, True, 0)<br>
>><br>
>>          self._secondary_anim = animator.Animator(2.0, 10)<br>
>> @@ -204,7 +209,8 @@ class Palette(PaletteWindow):<br>
>><br>
>>      def _add_content(self):<br>
>>          # The content is not shown until a widget is added<br>
>> -        self._content = Gtk.VBox()<br>
>> +        self._content = Gtk.Box()<br>
>> +        self._content.set_orientation(Gtk.Orientation.VERTICAL)<br>
>>          self._content.set_border_width(style.DEFAULT_SPACING)<br>
>>          self._secondary_box.pack_start(self._content, True, True, 0)<br>
>><br>
>> @@ -304,7 +310,8 @@ class Palette(PaletteWindow):<br>
>>              self._widget = _PaletteWindowWidget(self)<br>
>>              self._setup_widget()<br>
>><br>
>> -            self._palette_box = Gtk.VBox()<br>
>> +            self._palette_box = Gtk.Box()<br>
>> +            self._palette_box.set_orientation(Gtk.Orientation.VERTICAL)<br>
>>              self._palette_box.pack_start(self._primary_box, False, True,<br>
>> 0)<br>
>>              self._palette_box.pack_start(self._secondary_box, True, True,<br>
>> 0)<br>
>><br>
>> @@ -396,7 +403,7 @@ class Palette(PaletteWindow):<br>
>>      menu = GObject.property(type=object, getter=get_menu)<br>
>><br>
>><br>
>> -class PaletteActionBar(Gtk.HButtonBox):<br>
>> +class PaletteActionBar(Gtk.ButtonBox):<br>
>><br>
>>      def add_action(self, label, icon_name=None):<br>
>>          button = Gtk.Button(label)<br>
>> @@ -409,6 +416,10 @@ class PaletteActionBar(Gtk.HButtonBox):<br>
>>          self.pack_start(button, True, True, 0)<br>
>>          button.show()<br>
>><br>
>> +    def __init__(self):<br>
>> +        GObject.GObject.__init__(self)<br>
>> +        self.set_orientation(Gtk.Orientation.HORIZONTAL)<br>
>> +<br>
>><br>
>>  class _SecondaryAnimation(animator.Animation):<br>
>><br>
>> diff --git a/src/sugar3/graphics/panel.py b/src/sugar3/graphics/panel.py<br>
>> index c254c21..8b7126d 100644<br>
>> --- a/src/sugar3/graphics/panel.py<br>
>> +++ b/src/sugar3/graphics/panel.py<br>
>> @@ -23,9 +23,10 @@ from gi.repository import Gtk<br>
>>  from gi.repository import GObject<br>
>><br>
>><br>
>> -class Panel(Gtk.VBox):<br>
>> +class Panel(Gtk.Box):<br>
>><br>
>>      __gtype_name__ = 'SugarPanel'<br>
>><br>
>>      def __init__(self):<br>
>>          GObject.GObject.__init__(self)<br>
>> +        self.set_orientation(Gtk.Orientation.VERTICAL)<br>
>> diff --git a/src/sugar3/graphics/radiopalette.py<br>
>> b/src/sugar3/graphics/radiopalette.py<br>
>> index c2ff4f6..beae120 100644<br>
>> --- a/src/sugar3/graphics/radiopalette.py<br>
>> +++ b/src/sugar3/graphics/radiopalette.py<br>
>> @@ -63,7 +63,8 @@ class RadioPalette(Palette):<br>
>>      def __init__(self, **kwargs):<br>
>>          Palette.__init__(self, **kwargs)<br>
>><br>
>> -        self.button_box = Gtk.HBox()<br>
>> +        self.button_box = Gtk.Box()<br>
>> +        self.button_box.set_orientation(Gtk.Orientation.HORIZONTAL)<br>
>>          self.button_box.show()<br>
>>          self.set_content(self.button_box)<br>
>><br>
>> diff --git a/src/sugar3/graphics/toolbarbox.py<br>
>> b/src/sugar3/graphics/toolbarbox.py<br>
>> index 7e317f7..8ff63b8 100644<br>
>> --- a/src/sugar3/graphics/toolbarbox.py<br>
>> +++ b/src/sugar3/graphics/toolbarbox.py<br>
>> @@ -140,10 +140,11 @@ class ToolbarButton(ToolButton):<br>
>>          return False<br>
>><br>
>><br>
>> -class ToolbarBox(Gtk.VBox):<br>
>> +class ToolbarBox(Gtk.Box):<br>
>><br>
>>      def __init__(self, padding=style.TOOLBOX_HORIZONTAL_PADDING):<br>
>>          GObject.GObject.__init__(self)<br>
>> +        self.set_orientation(Gtk.Orientation.VERTICAL)<br>
>>          self._expanded_button_index = -1<br>
>>          self.background = None<br>
>><br>
>> diff --git a/src/sugar3/graphics/toolbox.py<br>
>> b/src/sugar3/graphics/toolbox.py<br>
>> index fedca0b..60700ce 100644<br>
>> --- a/src/sugar3/graphics/toolbox.py<br>
>> +++ b/src/sugar3/graphics/toolbox.py<br>
>> @@ -25,7 +25,7 @@ from gi.repository import GObject<br>
>>  from sugar3.graphics import style<br>
>><br>
>><br>
>> -class Toolbox(Gtk.VBox):<br>
>> +class Toolbox(Gtk.Box):<br>
>><br>
>>      __gtype_name__ = 'SugarToolbox'<br>
>><br>
>> @@ -36,6 +36,7 @@ class Toolbox(Gtk.VBox):<br>
>><br>
>>      def __init__(self):<br>
>>          GObject.GObject.__init__(self)<br>
>> +        self.set_orientation(Gtk.Orientation.VERTICAL)<br>
>><br>
>>          self._notebook = Gtk.Notebook()<br>
>>          self._notebook.set_tab_pos(Gtk.PositionType.BOTTOM)<br>
>> @@ -46,7 +47,8 @@ class Toolbox(Gtk.VBox):<br>
>>          self.pack_start(self._notebook, True, True, 0)<br>
>>          self._notebook.show()<br>
>><br>
>> -        self._separator = Gtk.HSeparator()<br>
>> +        self._separator = Gtk.Separator()<br>
>> +        self._separator.set_orientation(Gtk.Orientation.HORIZONTAL)<br>
>>          self._separator.modify_bg(Gtk.StateType.NORMAL,<br>
>>                                    style.COLOR_PANEL_GREY.get_gdk_color())<br>
>>          self._separator.set_size_request(1,<br>
>> style.TOOLBOX_SEPARATOR_HEIGHT)<br>
>> diff --git a/src/sugar3/graphics/toolcombobox.py<br>
>> b/src/sugar3/graphics/toolcombobox.py<br>
>> index 90bd1f4..798726c 100644<br>
>> --- a/src/sugar3/graphics/toolcombobox.py<br>
>> +++ b/src/sugar3/graphics/toolcombobox.py<br>
>> @@ -40,7 +40,8 @@ class ToolComboBox(Gtk.ToolItem):<br>
>><br>
>>          self.set_border_width(style.DEFAULT_PADDING)<br>
>><br>
>> -        hbox = Gtk.HBox(False, style.DEFAULT_SPACING)<br>
>> +        hbox = Gtk.Box(False, style.DEFAULT_SPACING)<br>
>> +        hbox.set_orientation(Gtk.Orientation.HORIZONTAL)<br>
>><br>
>>          self.label = Gtk.Label(label=self._label_text)<br>
>>          hbox.pack_start(self.label, False, False, 0)<br>
>> diff --git a/src/sugar3/graphics/tray.py b/src/sugar3/graphics/tray.py<br>
>> index d1c0cfd..a9d6d79 100644<br>
>> --- a/src/sugar3/graphics/tray.py<br>
>> +++ b/src/sugar3/graphics/tray.py<br>
>> @@ -223,7 +223,7 @@ ALIGN_TO_START = 0<br>
>>  ALIGN_TO_END = 1<br>
>><br>
>><br>
>> -class HTray(Gtk.HBox):<br>
>> +class HTray(Gtk.Box):<br>
>><br>
>>      __gtype_name__ = 'SugarHTray'<br>
>><br>
>> @@ -238,6 +238,7 @@ class HTray(Gtk.HBox):<br>
>>          self.align = ALIGN_TO_START<br>
>><br>
>>          GObject.GObject.__init__(self, **kwargs)<br>
>> +        self.set_orientation(Gtk.Orientation.HORIZONTAL)<br>
>><br>
>>          scroll_left = _TrayScrollButton('go-left', _PREVIOUS_PAGE)<br>
>>          self.pack_start(scroll_left, False, False, 0)<br>
>> @@ -309,7 +310,7 @@ class HTray(Gtk.HBox):<br>
>>          self._viewport.scroll_to_item(item)<br>
>><br>
>><br>
>> -class VTray(Gtk.VBox):<br>
>> +class VTray(Gtk.Box):<br>
>><br>
>>      __gtype_name__ = 'SugarVTray'<br>
>><br>
>> @@ -324,6 +325,7 @@ class VTray(Gtk.VBox):<br>
>>          self.align = ALIGN_TO_START<br>
>><br>
>>          GObject.GObject.__init__(self, **kwargs)<br>
>> +        self..set_orientation(Gtk.Orientation.VERTICAL)<br>
>><br>
>>          scroll_up = _TrayScrollButton('go-up', _PREVIOUS_PAGE)<br>
>>          self.pack_start(scroll_up, False, False, 0)<br>
>> diff --git a/src/sugar3/graphics/window.py b/src/sugar3/graphics/window.py<br>
>> index 2d9764d..1a955c7 100644<br>
>> --- a/src/sugar3/graphics/window.py<br>
>> +++ b/src/sugar3/graphics/window.py<br>
>> @@ -99,8 +99,10 @@ class Window(Gtk.Window):<br>
>>          self._canvas = None<br>
>>          self.tray = None<br>
>><br>
>> -        self.__vbox = Gtk.VBox()<br>
>> -        self.__hbox = Gtk.HBox()<br>
>> +        self.__vbox = Gtk.Box()<br>
>> +        self.__vbox.set_orientation(Gtk.Orientation.VERTICAL)<br>
>> +        self.__hbox = Gtk.Box()<br>
>> +        self.__hbox.set_orientation(Gtk.Orientation.HORIZONTAL)<br>
>>          self.__vbox.pack_start(self.__hbox, True, True, 0)<br>
>>          self.__hbox.show()<br>
>><br>
>><br>
><br>
><br>
> _______________________________________________<br>
> Sugar-devel mailing list<br>
> <a href="mailto:Sugar-devel@lists.sugarlabs.org">Sugar-devel@lists.sugarlabs.org</a><br>
> <a href="http://lists.sugarlabs.org/listinfo/sugar-devel" target="_blank">http://lists.sugarlabs.org/listinfo/sugar-devel</a><br>
_______________________________________________<br>
Sugar-devel mailing list<br>
<a href="mailto:Sugar-devel@lists.sugarlabs.org">Sugar-devel@lists.sugarlabs.org</a><br>
<a href="http://lists.sugarlabs.org/listinfo/sugar-devel" target="_blank">http://lists.sugarlabs.org/listinfo/sugar-devel</a><br>
</div></div></blockquote></div><br>