Re: Possible bug in gtk or gtkmm?



I have got the similar problem, and I think this is a gtk+ problem, and
report the bug : http://bugzilla.gnome.org/show_bug.cgi?id=490391
> Hello,
> 
> I've a problem here with an IconView on two different systems. On my
> Gentoo system the IconView behaves like normal, but on Ubuntu it
> behaves bad. I'll insert the exact version numbers below.
> 
> I use this code to add images to an IconView:
> 
> class IconBrowser : public Gtk::IconView
> {
> ....
>   class IconModelColumns : public Gtk::TreeModel::ColumnRecord
>   {
>   public:
> 
>     IconModelColumns()
>     {
>       add (m_col_filename);
>       add (m_col_description);
>       add (m_col_url);
>       add (m_col_pixbuf);
>     }
> 
>     // TODO: save Url or Link instead of all this data
>     Gtk::TreeModelColumn<std::string> m_col_filename;
>     Gtk::TreeModelColumn<Glib::ustring>  m_col_description;
>     Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf> > m_col_pixbuf;
>     Gtk::TreeModelColumn<Glib::ustring> m_col_url;
>   };
> ...
>   Glib::RefPtr<Gtk::ListStore> m_refListModel;
>   IconModelColumns m_IconColum
> }
> 
> void IconBrowser::createTree ()
> {
>   // Create the Tree model:
>   m_refListModel = Gtk::ListStore::create( m_IconColumns );
>   set_model (m_refListModel);
>   set_markup_column (m_IconColumns.m_col_description);
>   set_pixbuf_column (m_IconColumns.m_col_pixbuf);
> }
> 
> void IconBrowser::addIconEntry (const std::string& filename,
>                                 const Glib::ustring& description,
>                                 const string& href, int width, int
> height) {
>   if (m_refListModel)
>   {
>     try
>     {
>       Gtk::TreeModel::Row row = *(m_refListModel->append());
>       row[m_IconColumns.m_col_filename] = filename;
>       row[m_IconColumns.m_col_description] = description;
>       row[m_IconColumns.m_col_url] = href;
>       
>       Glib::RefPtr<Gdk::Pixbuf> pixbuf_ptr =
> Gdk::Pixbuf::create_from_file(filename, width, height);
> row[m_IconColumns.m_col_pixbuf] = pixbuf_ptr; }
>     catch (Gdk::PixbufError)
>     {
>       // ignore this exception currently
>     }
>     catch (Glib::FileError)
>     {
>       // ignore this exception currently
>     }
>   }
>   else
>   {
>     cerr << " m_refListModel == NULL" << endl;
>   }
> }
> 
> void IconBrowser::showFileList (const list<Link*> *ll)
> {    
>   // why is that needed to shadow m_cache?
>   Global &global = Global::instance ();
>   Cache *m_cache = global.getCache ();
>   
>   clear (); // delete list before loading new one
>   
>   for (list<Link*>::const_iterator ll_it = ll->begin ();
>        ll_it != ll->end ();
>        ++ll_it)
>   {
>     const Link *lnk = *ll_it;
>     string image = lnk->getImage ().getUrl ();
>     string href = lnk->getHref ().getUrl ();
>     
>     string fullPath;
>     m_cache->urlToFile (Url (image), fullPath);
>       
>     // TODO: better check for image while parsing
>     if (Filter::isImage (fullPath))
>     {
>       addIconEntry (fullPath, Glib::path_get_basename (fullPath), href,
> 128, 128); }
>     
>   }
> }
> 
> void IconBrowser::showImage (const string &url)
> {
>   Global &global = Global::instance ();
>   Cache *m_cache = global.getCache ();
>   
>   clear (); // delete list before loading new one
>   
>   string outFile;
>   m_cache->urlToFile (url, outFile);
>   
>   // TODO: better check for image while parsing
>   if (Filter::isImage (outFile))
>   {
>     addIconEntry (outFile, Glib::path_get_basename (outFile), url);
>   }
> }
> 
> 
> The problem is that after adding a image with showImage() in a big
> size. If then showFileList () is called again the images are good, but
> the the "invisible frame" around each image and text below is as big as
> the big image I added before. So it looks like as there's only one
> single column of images.
> 
> I hope I explained the problem good enough. If not I'll provide some
> screenshots.
> 
> Any ideas why this happens and how to solve it?
> 
> Gentoo:
> x11-libs/gtk+-2.10.14
> dev-cpp/gtkmm-2.10.10
> 
> Ubuntu:
> libgtk2 2.12.0-1ubuntu3 (gutsy)
> libgtkmm-2.4-1c2a 1:2.12.0-0ubuntu1 (gutsy)
> 
> regards
> Andreas
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list



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