Re: [patch] Scrollable Widgets




Lars Hamann <lars@gtk.org> writes:

> This message is in MIME format
> --_=XFMail.1.3.p0.Linux:981029015930:10706=_
> Content-Type: text/plain; charset=us-ascii
> 
> Hi !
> 
> This patch removes the scrollbars from clist/ctree.
> To make a CList scrollable use a GtkScrolledWindow now.
> GtkScrollableWindow can handle any widget, which
> provides "hadjustment", "vadjustment" args via the
> gtk_object_arg_set mechanism.
> If a widget does not provide these args, a viewport
> will be generated automatically.
> 
> These changes are source incompatible for
> GtkCList/CTree. All scrolled windows should
> work as usual.
> 
> Comments are welcome.

This looks quite good. I think using object args for the hadjustment
and vadjustment is the right way to do it. (Wish I had thought of that
myself.)

However, to play the devil's advocate, the one problem I see with this
is that it is quite difficult to make a scrollable "pseudo-widget", or
to modify the behavior the scrolling behavior of an existing widget,
since there is no equivalent of a user-signal for args. I can't take a
drawing area and make it suitable for plugging into a ScrolledWindow.
(In something other than the trivial sense of putting the scrolled
window inside a viewport)

A few comments:

+         arg.name = "hadjustment";
+         arg.type = info_hadj->type;
+         GTK_VALUE_POINTER (arg) =
+           gtk_scrolled_window_get_hadjustment (scrolled_window);
+         gtk_object_arg_set (GTK_OBJECT (widget), &arg, info_hadj);

Why not:

  gtk_object_set (GTK_OBJECT (widget), "hadjustment",
                  gtk_scrolled_window_get_hadjustment (scrolled_window));

I don't think the performance benefits are worth the additional code.

Also, to be on the conservative side, you might want to check that the
"hadjustment" and "vadjustment" arguments you find actually have the
expected type. (GTK_TYPE_ADJUSTMENT)

But in general, I would have no objections to this change being
committed. However, since it does break source compatibility, it would
be good to send out a short "this is what will break, and here's how
to fix it" message to gtk-list and gnome-list before making the
change, so people know what is going.

Regards,
                                        Owen



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