[Vala] Strange Gtk-CRITICAL assertions GTK_IS_TYPE (variable) failures



Hi,

I'm trying to use Vala to create a Gtk+ application, but I'm having all
sorts of problems.

So I basically get: Gtk-CRITICAL **: gtk_widget_show_all: assertion
`GTK_IS_WIDGET (widget)' failed
And nothing happens.

The problem occurs in a callback from a menu item (the help->about menu
item). The method do_about() gets called, which calls show_all() on the
about dialog.

If I change the signal handling to something like

        menu_help_about.activate += about_dialog.show_all;

It doesn't work either (the same errors happens)


I already had some similar problems but it was because my classes
didn't inherit GLib.Object. That's not the case here.


Here is the corresponding vala class:

public class MailBrowser : GLib.Object {

  private Gtk.Builder  builder;
  private Gtk.Window   main_window;
  private Gtk.Dialog   about_dialog;
  private Gtk.Action   menu_help_about;

  construct {
    builder = new Gtk.Builder();
  }
  
  public void setup() throws GLib.Error {
    try {
      builder.add_from_file(Main.cfg.file_mail_browser_ui);
      main_window     = (Gtk.Window) builder.get_object("main_window");
      about_dialog    = (Gtk.Dialog) builder.get_object("about_window");
      menu_help_about = (Gtk.Action) builder.get_object("menu_help_about");
      main_window.destroy += Gtk.main_quit;
      menu_help_about.activate += do_about;
    } catch (GLib.Error err) {
      var msg = new Gtk.MessageDialog (
                null, Gtk.DialogFlags.MODAL, Gtk.MessageType.ERROR, Gtk.ButtonsType.CANCEL,
                "Failed to load UI\n" + err.message);
      msg.run();
      throw err;
    }
  }
  
  public void do_about(){
    about_dialog.show_all();
  }
  
  public void show_all(){
    main_window.show_all();
  }
  
  public void run() throws GLib.Error {
    setup();
    show_all();
    Gtk.main();
  }

}



What could go wrong?

Thanks

Mildred


-- 
Mildred Ki'Lya
╭───────── mildred593@online.fr ──────────
│ Jabber, GoogleTalk: <mildred jabber fr>
│ Site: <http://ki.lya.online.fr>              GPG ID: 9A7D 2E2B
│ Fingerprint: 197C A7E6 645B 4299 6D37 684B 6F9D A8D6 9A7D 2E2B



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