[gtkmm] Convert Enum to GType
- From: Bryan Forbes <mxpxfifws yahoo com>
- To: Gtkmm List <gtkmm-list gnome org>
- Subject: [gtkmm] Convert Enum to GType
- Date: Sun, 18 Jan 2004 19:49:58 -0800 (PST)
Is there a way to take a typedef'd enum and turn it into a GType? The reason I ask
is I'm deriving a class from Gtk::TreeStore, but my derived TreeModel uses an enum I made
up. here are the classes:
class DataColumns : public Gtk::TreeModel::ColumnRecord
{
public:
DataColumns()
{ add(m_col_name); add(m_col_size); add(m_col_uri); add(m_col_entity_type); }
Gtk::TreeModelColumn<Glib::ustring> m_col_name;
Gtk::TreeModelColumn<Gnome::Vfs::FileSize> m_col_size;
Gtk::TreeModelColumn<Glib::ustring> m_col_uri;
Gtk::TreeModelColumn<cstr_EntityType> m_col_entity_type; // cstr_EntityType is my enum
};
class cstr_TreeStoreDnd : public Gtk::TreeStore
{
protected:
explicit cstr_TreeStoreDnd(const Gtk::TreeModelColumnRecord& columns);
public:
static DataColumns m_modelColumns;
static Glib::RefPtr<cstr_TreeStoreDnd> create();
protected:
// Overridden virtual functions
virtual bool row_draggable_vfunc(const Gtk::TreeModel::Path& path);
};
When I run the program with these two classes compiled in, I get this warning:
(process:760): GLib-GObject-CRITICAL **: gtype.c:1871: initialization assertion failed,
use g_type_init() prior to this function
And when I actually use the TreeStore class, I get these warnings:
(process:2315): GLib-GObject-CRITICAL **: gtype.c:1871: initialization assertion failed,
use g_type_init() prior to this function
(coaster:2315): Gtk-WARNING **: gtktreestore.c:384: Invalid type (null) passed to
gtk_tree_store_set_column_types
and it segfaults when I try to add things to the treestore. I figure it's because I'm
using that custom enum value. I've even tried using
Glib::ObjectBase(typeid(cstr_TreeStoreDnd)) in the constructor, and I still get those
warnings. Is there any easy way to register that enum as a GType? Thanks in advance!
-Bryan
__________________________________
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]