Re: GtkOrientable and GtkBox



Hi,

On Wed, 2009-06-03 at 13:32 -0400, Freddie Unpenstein wrote:
> From: "Tristan Van Berkom", Date: 04/06/2009 00:13, Wrote:
> 
> >> In general though, GtkOrientable already exists. People are bound
> to
> >> use it.
> > An example use case of this would be a custom toolbar that could be
> > placed optionally on top or on the side of the workspace where the
> tool
> > ordering is relevant, but thats not really the point right, aren't
> we more after
> > making sure the use cases we haven't thought of yet are still
> valid ? ;-)
> 
> I have had a use case... Wasn't critical, just a two-pane window, and
> wanted to allow the two halves to be swapped. Since the thing was
> loaded from a glade file, it was a pain to do it manually, and I ended
> up just ditching the idea in favour or more useful functionality.

what's so painful about:

GList *list = gtk_container_get_children (GTK_CONTAINER (box));
gint   pos  = g_list_length (list) - 1;

for (; list; list = list->next, pos--)
  gtk_box_reorder_child (GTK_BOX (box), list->data, pos);

I haven't tried this, but unless I am mistaken this should reverse the
order of children in a box. Seems easy enough to do and avoids the need
to introduce yet another special case in the GtkBox code. Perhaps if
this solution is not obvious enough, this should be turned into a
utility function gtk_box_reverse_children_order() ?


Sven




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]