I am trying to make splash screen as widget.
Problems are:
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?


2) I am inheriting MySplash from GtkWindow:
struct _MySplash {
  GtkWindow window;
  GtkWidget *label, *progressBar;
};
But when I am trying to cast MySplash as GtkWindow
---
MySplash * my_splash_new(GdkPixbuf *pixbuf) {
        MySplash *splash;
        GtkWidget *vbox, *image;

        // actual object creation
        splash = MY_SPLASH(g_object_new(my_splash_get_type(), NULL));
        gtk_window_set_position (GTK_WINDOW (splash), 
GTK_WIN_POS_CENTER_ALWAYS);
----
I get a run-time warning:
GLib-GObject-WARNING **: invalid cast from `MySplash' to `GtkWindow'
Gtk-CRITICAL **: gtk_window_set_position: assertion `GTK_IS_WINDOW (window)' failed

Same thing with GTK_CONTAINER(splash) or even GTK_CONTAINER(&(splash->window))

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):
void gtk_splash_set_text(GtkWidget *widget, const gchar *text) {
        MySplash *splash;
        g_return_if_fail (widget != NULL);
        g_return_if_fail (IS_MY_SPLASH (widget));
        splash = MY_SPLASH (widget);

        gtk_label_set_text( splash->label, text);
        while(gtk_events_pending()) {
                gtk_main_iteration();
        }
}
Do I have to define first parameter here as GtkWidget or can I define it directly as MySplash *splash? 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?




_______________________________________________
gtk-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtk-list

Reply via email to