GNOME Bugzilla – Bug 527587
Glib::RefPtr<Gtk::RecentInfo> cannot be used in TreeStore
Last modified: 2008-04-11 17:52:11 UTC
When attempting to add() a Gtk::TreeModelColumn<Glib::RefPtr<Gtk::RecentInfo> > to a Gtk::TreeModel::ColumnRecord derived class, a compile error occurs. Adding GtkRecentInfo* to a GtkListStore works perfectly in C, though.
Created attachment 109066 [details] Test case This is a (rather) simple test case. It produces the following error: /usr/include/glibmm-2.4/glibmm/value.h: In static member function ‘static GType Glib::Value<Glib::RefPtr<T_CppObject> >::value_type() [with T = Gtk::RecentInfo]’: /usr/include/gtkmm-2.4/gtkmm/treemodelcolumn.h:140: instantiated from ‘Gtk::TreeModelColumn<T>::TreeModelColumn() [with T = Glib::RefPtr<Gtk::RecentInfo>]’ 20080411-openismus-recentinfo-value-testcase.cc:7: instantiated from here /usr/include/glibmm-2.4/glibmm/value.h:233: error: ‘get_base_type’ is not a member of ‘Gtk::RecentInfo’ /usr/include/glibmm-2.4/glibmm/value.h: In member function ‘void Glib::Value<Glib::RefPtr<T_CppObject> >::set(const Glib::RefPtr<T_CppObject>&) [with T = Gtk::RecentInfo]’: /usr/include/gtkmm-2.4/gtkmm/treeiter.h:456: instantiated from ‘void Gtk::TreeRow::set_value(const Gtk::TreeModelColumn<ColumnType>&, const ColumnType&) const [with ColumnType = Glib::RefPtr<Gtk::RecentInfo>]’ /usr/include/gtkmm-2.4/gtkmm/treeiter.h:429: instantiated from ‘Gtk::TreeValueProxy<ColumnType>& Gtk::TreeValueProxy<ColumnType>::operator=(const ColumnType&) [with ColumnType = Glib::RefPtr<Gtk::RecentInfo>]’ 20080411-openismus-recentinfo-value-testcase.cc:39: instantiated from here /usr/include/glibmm-2.4/glibmm/value.h:235: error: no matching function for call to ‘Glib::Value<Glib::RefPtr<Gtk::RecentInfo> >::set_object(Gtk::RecentInfo*)’ /usr/include/glibmm-2.4/glibmm/value.h:129: note: candidates are: void Glib::ValueBase_Object::set_object(Glib::ObjectBase*)
Created attachment 109067 [details] [review] Proposed patch This patch fixes the problem by providing a specialization of Glib::Value<Glib::RefPtr<Gtk::RecentInfo> >.
Yeah, please add that in gtkmm's svn trunk. For the record, we could add a get_base_type() to Gtk::RecentInfo, but we don't want to make Gtk::RecentInfo derive from Glib::ObjectBase, so this is the best solution.
Done. I also tried implementing get_base_type() in Gtk::RecentInfo first, but that's not enough to make it compile. Since Gtk::RecentInfo is a boxed type it cannot derive from Glib::ObjectBase anyway, I think.