Re: RecentInfo



On Sun, 2006-07-30 at 20:53 -0500, Jonathon Jongsma wrote:
> On 7/30/06, Murray Cumming <murrayc murrayc com> wrote:
> > On Wed, 2006-07-26 at 17:57 +0200, Murray Cumming wrote:
> > > I've fixed that in cvs. We were using the wrong _CLASS_* macro.
> > >
> > > You'll still need that traits specialization though, I think.
> >
> > I made some more corrections in cvs (after breaking the build for a
> > while). I'm not sure if everything is perfect, but the example seems to
> > work now.
> >
> 
> OK, so the existing example works, but RecentManager::get_items()
> still segfaults when trying to construct a std::vector.

It works for me. I added this test code at the end of
ExampleWindow::on_menu_file_recent_files_dialog():

  typedef std::vector< Glib::RefPtr<Gtk::RecentInfo> > type_items;
  type_items items = dialog.get_items();
  for(type_items::iterator iter = items.begin(); iter != items.end();
++iter)
  {
    Glib::RefPtr<Gtk::RecentInfo> item = *iter;
    if(item) 
      std::cout << "item: display_name=" << item->get_display_name() <<
std::endl;
  }

Maybe you could post your code somewhere or check it in if appropriate.
Then I could investigate.

>   I apologize
> that I haven't had time to look into adding a traits specialization
> for that.  Actually, I'm not sure how to approach that.  The traits
> specializations are implemented in Glib.  For example,
> glib/glibmm/containerhandle_shared.h has the following type:
> template <class T>
> struct TypeTraits< Glib::RefPtr<const T> >
> {
> ...
> }
> 
> Which matches the ListHandle<Glib::RefPtr<Gtk::RecentInfo> >  type,
> but we don't want this template to match since it assumes that T is a
> GObject type.  So we'd need a more specialized template, something
> like:
> struct TypeTraits< Glib::RefPtr<Gtk::RecentInfo> >
> 
> But this couldn't be defined in Glib, since it depends on a gtkmm
> type.  So do we just add a traits specialization to the
> recentinfo.hg/ccg files in gtkmm?

Actually there already is a RecentInfoTraits in recentchooser.hg and I
think I fixed it up during my last changes. I'm not sure who added it.

Actually, maybe it's wrong to call it a traits specialization. The
traits allow you to specify a specialization of the ListHandle.

-- 
Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com




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