[maemo-developers] [maemo-developers] Usage of hildon_appview_add_with_scrollbar()

From: Luca Donaggio donaggio at gmail.com
Date: Mon Jan 16 12:44:13 EET 2006
Hi,

I'm porting an app to Maemo and I came to a point where it seems convenient
to use hildon_appview_add_with_scrollbar function from hildon-lgp.
Original code after minimal and preliminary hildonization looks like this:

[code]

  main = HILDON_APPVIEW (hildon_appview_new ("Main view"));
  hildon_appview_set_fullscreen_key_allowed(main, TRUE );
  gtk_widget_show (GTK_WIDGET (main));

  main_icon_pixbuf = create_pixbuf ("grsync.png");
  if (main_icon_pixbuf)
    {
      gtk_window_set_icon (GTK_WINDOW (main), main_icon_pixbuf);
      gdk_pixbuf_unref (main_icon_pixbuf);
    }

  scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL);
  gtk_container_add (GTK_CONTAINER (main), scrolledwindow1);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow1),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
  gtk_widget_show (scrolledwindow1);

  viewport1 = gtk_viewport_new (NULL, NULL);
  gtk_widget_show (viewport1);
  gtk_container_add (GTK_CONTAINER (scrolledwindow1), viewport1);

[end code]

Of course to viewport1 are added all the widget used by the application and
the HildonAppView is added to a HildonApp object.
It works unmodified, but then I tried to avoid using the scrolled window:
Maemo API documentation for HildonAppView (
http://www.maemo.org/platform/docs/api/hildon-docs/lgpl-html/HildonAppView.html)
states that
hildon_appview_add_with_scrollbar ()

void        hildon_appview_add_with_scrollbar
                                            (HildonAppView *self,
                                             GtkWidget *child);

Adds the *child* to the *self*(HildonAppView) and creates a scrollbar to it.
Similar as adding first a *GtkScrolledWindow* and then the *child* to it.
Resulting code is:

[code]

  main = HILDON_APPVIEW (hildon_appview_new ("Main view"));
  hildon_appview_set_fullscreen_key_allowed(main, TRUE );
  gtk_widget_show (GTK_WIDGET (main));
  main_icon_pixbuf = create_pixbuf ("grsync.png");
  if (main_icon_pixbuf)
    {
      gtk_window_set_icon (GTK_WINDOW (main), main_icon_pixbuf);
      gdk_pixbuf_unref (main_icon_pixbuf);
    }

  viewport1 = gtk_viewport_new (NULL, NULL);
  gtk_widget_show (viewport1);
  hildon_appview_add_with_scrollbar(main, viewport1);

[/end code]

It produces no compiler error, but by running it (inside scratchbox and on
the real device) produces only a blank window with no widget drawn.
What am I doing wrong?

Luca Donaggio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maemo.org/pipermail/maemo-developers/attachments/20060116/689c51be/attachment.htm 
More information about the maemo-developers mailing list