Re: RecentManager



2012-11-01 15:26, g4hx skrev:
On 11/01/2012 01:17 PM, Kjell Ahlstedt wrote:

Gtk::RecentManager::add_item() calls the gtk+ function
gtk_recent_manager_add_item(). That function always returns true, and
does most of its job asynchronosly, meaning that when the function
returns, its job has probably not been finished.
If you call get_items() immediately after add_item(), the newly added
item might not be included in the returned vector. It's much safer to
connect to signal_changed() and call get_items() in your signal handler.

The documentation does not mention that add_item() works asynchonously,
neither the documentation in gtk+ nor in gtkmm.

To set up a RecentManager for your application only, you need to create
your own RecentManager, i.e. call Gtk::RecentManager::create() instead
of get_default(). You must set a filename, where your RecentManager
shall save its information, or else it will use the default file that
most other programs use. BUT, that does not seem to be possible, using
Gtk::RecentManager. There is a property_filename(), but it's read-only.
The property 'filename' in the gtk+ class GtkRecentManager is
construct-only, meaning it can only be given a value when the object is
constructed. I think something is missing in gtkmm.
Gtk::RecentManager::create() should have a 'filename' parameter.

Kjell

Well, you're right, after some time the items seem to show up. It is
unfortunate that it is impossible to use your own RecentManager...

g4hx

I think you can use your own RecentManager, if you call some gtk+ functions directly. It's more difficult than it would be if Gtk::RecentManager::create() had had the filename parameter I believe it should have.

File a bug in Bugzilla, if you think it's worth the trouble. Gtk::RecentManager::create() might be fixed in a future gtkmm release.

Kjell



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