After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 320208 - GtkScrolledWindow creator function doesn't create default adjustments
GtkScrolledWindow creator function doesn't create default adjustments
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: Widget: Other
2.8.x
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2005-10-30 03:28 UTC by Lucas Rocha
Modified: 2008-04-09 14:18 UTC
See Also:
GNOME target: ---
GNOME version: 2.13/2.14



Description Lucas Rocha 2005-10-30 03:28:27 UTC
Please describe the problem:
According to the API docs, gtk_scrolled_window_new () should create adjustment
instances when passing NULL values as input but the current implementation
doesn't do this. This function should create default horizontal and vertical
adjustments in this case.

Steps to reproduce:
1. 
2. 
3. 


Actual results:


Expected results:


Does this happen every time?


Other information:
Comment 1 Björn Lindqvist 2008-03-28 17:37:49 UTC
Can you verify if this is still an issue? Using this test code, it seems that default adjustments are created.

#include <assert.h>
#include <gtk/gtk.h>
int main (int argc, char *argv[])
{
    gtk_init (&argc, &argv);
    GtkScrolledWindow *sw = gtk_scrolled_window_new (NULL, NULL);
    assert (gtk_scrolled_window_get_hadjustment (sw) &&
            gtk_scrolled_window_get_vadjustment (sw));
}
Comment 2 Lucas Rocha 2008-03-29 21:43:33 UTC
(In reply to comment #1)
> Can you verify if this is still an issue? Using this test code, it seems that
> default adjustments are created.
> 
> #include <assert.h>
> #include <gtk/gtk.h>
> int main (int argc, char *argv[])
> {
>     gtk_init (&argc, &argv);
>     GtkScrolledWindow *sw = gtk_scrolled_window_new (NULL, NULL);
>     assert (gtk_scrolled_window_get_hadjustment (sw) &&
>             gtk_scrolled_window_get_vadjustment (sw));
> }

This test case doesn't fail because the gtk_scrolled_window_get_hadjustment() and gtk_scrolled_window_get_vadjustment() called trigger the creation of the adjustments (through gtk_range_get_adjustment() calls). This means that gtk_scrolled_window_new () doesn't actually create the adjustments. 

This might be a problem is some developer creates a scrolled window and tries to directly the struct attributes "hscrollbar" and "vscrollbar" (which is not rare) expecting them to have actual adjustment instances.

If all GTK+ structs were properly sealed, this wouldn't be a problem. But this is not the case just yet...  

Comment 3 Björn Lindqvist 2008-03-30 22:52:34 UTC
Now I do not understand, because this test case doesn't fail either:

  #include <assert.h>
  #include <gtk/gtk.h>
  int main (int argc, char *argv[])
  {
      gtk_init (&argc, &argv);
      GtkScrolledWindow *sw =
          GTK_SCROLLED_WINDOW (gtk_scrolled_window_new (NULL, NULL));
      GtkRange *hrange = GTK_RANGE (sw->hscrollbar);
      GtkRange *vrange = GTK_RANGE (sw->vscrollbar);
      assert (GTK_IS_ADJUSTMENT (hrange->adjustment));
      assert (GTK_IS_ADJUSTMENT (vrange->adjustment));
  }

It really seems to me that the API doc is correct in this case.
Comment 4 Björn Lindqvist 2008-04-09 14:18:37 UTC
Closing as obsolete. Please reopen if you disagree.