[Sugar-devel] [PATCH shell 3/3] Fix layout of Clear search button in Journal and Activity List - SL #3809

Simon Schampijer simon at schampijer.de
Tue Sep 25 10:16:31 EDT 2012


Great, works as expected:

http://git.sugarlabs.org/sugar/mainline/commit/42fc93826f0d28c9cd43194df16c1fa47f930b2f

Simon

On 09/25/2012 04:31 AM, Manuel Quiñones wrote:
> To do it, add the button to a ButtonBox with layout
> Gtk.ButtonBoxStyle.CENTER.
>
> Signed-off-by: Manuel Quiñones <manuq at laptop.org>
> ---
>   src/jarabe/desktop/activitieslist.py | 7 ++++++-
>   src/jarabe/journal/listview.py       | 7 ++++++-
>   2 files changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/src/jarabe/desktop/activitieslist.py b/src/jarabe/desktop/activitieslist.py
> index b111164..b830526 100644
> --- a/src/jarabe/desktop/activitieslist.py
> +++ b/src/jarabe/desktop/activitieslist.py
> @@ -333,11 +333,16 @@ class ClearMessageBox(Gtk.EventBox):
>           box.pack_start(label, expand=True, fill=False, padding=0)
>           label.show()
>
> +        button_box = Gtk.HButtonBox()
> +        button_box.set_layout(Gtk.ButtonBoxStyle.CENTER)
> +        box.pack_start(button_box, False, True, 0)
> +        button_box.show()
> +
>           button = Gtk.Button(label=_('Clear search'))
>           button.connect('clicked', button_callback)
>           button.props.image = Icon(icon_name='dialog-cancel',
>                                     icon_size=Gtk.IconSize.BUTTON)
> -        box.pack_start(button, expand=True, fill=False, padding=0)
> +        button_box.pack_start(button, expand=True, fill=False, padding=0)
>           button.show()
>
>
> diff --git a/src/jarabe/journal/listview.py b/src/jarabe/journal/listview.py
> index 46c3440..917beb0 100644
> --- a/src/jarabe/journal/listview.py
> +++ b/src/jarabe/journal/listview.py
> @@ -403,11 +403,16 @@ class BaseListView(Gtk.Bin):
>           box.pack_start(label, expand=True, fill=False, padding=0)
>
>           if show_clear_query:
> +            button_box = Gtk.HButtonBox()
> +            button_box.set_layout(Gtk.ButtonBoxStyle.CENTER)
> +            box.pack_start(button_box, False, True, 0)
> +            button_box.show()
> +
>               button = Gtk.Button(label=_('Clear search'))
>               button.connect('clicked', self.__clear_button_clicked_cb)
>               button.props.image = Icon(icon_name='dialog-cancel',
>                                         icon_size=Gtk.IconSize.BUTTON)
> -            box.pack_start(button, expand=True, fill=False, padding=0)
> +            button_box.pack_start(button, expand=True, fill=False, padding=0)
>
>           background_box.show_all()
>
>



More information about the Sugar-devel mailing list