Re: RecentManager
- From: g4hx <g4hx gmx de>
- To: Kjell Ahlstedt <kjell ahlstedt bredband net>
- Cc: "'gtkmm-list gnome org'" <gtkmm-list gnome org>
- Subject: Re: RecentManager
- Date: Wed, 31 Oct 2012 17:20:15 +0100
On 10/31/2012 04:50 PM, Kjell Ahlstedt wrote:
> RecentManager::get_default() gets a RecentManager where all programs can
> save recently used files. Usually it's not empty. Word processors, text
> editors and all kinds of programs may have saved names of recently used
> files there. The information is saved in a file, on my PC in file
> ~/.local/share/recently-used.xbel. I don't think there's any guarantee
> that your newly saved file name will be the first one in the vector that
> RecentManager::get_items() returns, but it should be somewhere in that
> vector.
>
> I'm don't know why you don't find your file name in a FileChooserDialog.
> Do you use a filter that hides it? Have you looked through the whole
> list of files in the dialog, and not just the first few entries?
>
> Kjell
>
> 2012-10-31 14:51, g4hx skrev:
>> Hello all,
>>
>> I am trying to include a RecentManager in my program but so far I am
>> utterly failing to do it. I have the following code to add a file
>> obtained by a FileChooserDialog to the recent files list:
>>
>> Glib::RefPtr<RecentManager> mgr = RecentManager::get_default();
>>
>> if(!mgr->add_item(dialog.get_uri()))
>> g_warning("Could not add item to recent files");
>>
>> If I understand correctly, then a subsequent statement of the type
>>
>> g_warning("%s", mgr->get_items()[0]->get_uri().raw().c_str());
>>
>> should return the URI that I passed to the RecentManager. Only this
>> is not the case, instead the warning prints another file to the
>> terminal. Also the file does not show up in any FileChooserDialog.
>> What am I doing wrong?
>>
>> g4hx
>>
>
>
Well, I have a filter in all my dialogs which permits only xml files.
I removed the recently-used.xbel. After that the call to mgr->get_items
results in a SEGFAULT, since there are no entries at all.
How can I set up a RecentManager for my application only?
g4hx
[
Date Prev][
Date Next] [
Thread Prev][Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]