Re: Splash screen as widget



Hi,

2008/6/9 George Brink <siberianowl yahoo com>:
> 1) I think command
>        splash = MY_SPLASH(g_object_new(my_splash_get_type(), NULL));
> should create new window (since GtkWindow is a parent) but how can I set to
> this new window GTK_WINDOW_POPUP as GtkWindowType?

In your _init() function, do

        gtk_window_set_type_hint( GTK_WINDOW( splash ),
                GDK_WINDOW_TYPE_HINT_SPLASHSCREEN );

> 2) I am inheriting MySplash from GtkWindow:
> But when I am trying to cast MySplash as GtkWindow
> I get a run-time warning:
> GLib-GObject-WARNING **: invalid cast from `MySplash' to `GtkWindow'

Are you setting GtkWindow as the parent class in your type creator?

> 3) Each time label or progress bar is updated on splash screen, it should be
> updated on the real screen, so I define (by tutorial):
>        while(gtk_events_pending()) {
>                gtk_main_iteration();
>        }

That's from a rather old tutorial, better to use:

        while( g_main_context_iteration( NULL, FALSE ) )
                ;

> Also I am a confused, loop while(gtk_events_pending()) gtk_main_iteration();
> will run BEFORE gtk_main_loop(), Since splash screen always shown during
> initialization phase of application. Will this loop work?

Yes, should work fine.

Here's the splash class from my app, for what it's worth:

  http://vips.svn.sourceforge.net/viewvc/vips/nip2/trunk/src/boxes.c?view=markup

search for 'splash'.

John


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