Bug 69973 - gtk+ recent-files integration improvements
Summary: gtk+ recent-files integration improvements
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
(earliest affected) Master
Hardware: Other Linux (All)
: medium normal
Assignee: Not Assigned
Keywords: difficultyInteresting, easyHack, skillCpp, topicCleanup
Depends on:
Reported: 2013-09-30 16:06 UTC by Michael Meeks
Modified: 2016-02-18 16:37 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Note You need to log in before you can comment on or make changes to this bug.
Description Michael Meeks 2013-09-30 16:06:14 UTC
IIRC recent-files doesn't update until the app exits; this is way too late. We should instead expose and model the GtkRecent object and update as/when we get a signal to do so, my old (2008) note says:

  + it only updates the recent-files on application exit
  + I believe it's only write-only, ie. if you open an XLS in gnumeric, it
    will be in Panel->System->Recent Files, but it will not be available
    in File->Recent Documents in OO.o

I guess with the new recent-files code in gtk+ we should be able to listen to
"changed" on the gtkrecent object - and get nice live updates here.

The code to hack is: sfx2/source/appl/sfxpicklist.cxx and
shell/source/unix/sysshell/systemshell.cxx - we need a new API to fetch the
picklist and use that instead of SvtHistoryOptions.GetList - I imagine.

Hopefully this is not impossibly hard.
Comment 1 Björn Michaelsen 2013-10-04 18:47:44 UTC
adding LibreOffice developer list as CC to unresolved EasyHacks for better visibility.

see e.g. http://nabble.documentfoundation.org/minutes-of-ESC-call-td4076214.html for details
Comment 2 Robinson Tryon (qubit) 2013-10-23 17:25:05 UTC
Removing comma from whiteboard (please use a space to delimit values in this field)
Comment 3 Julien Nabet 2015-02-15 14:43:42 UTC
Michael: I noticed that AddDocumentToPickList was called at the opening + closing of the document.
    406             case SFX_EVENT_OPENDOC:
    407             {
    408                 AddDocumentToPickList(pDocSh);
    409             }
    410             break;
    412             case SFX_EVENT_SAVEDOCDONE:
    413             case SFX_EVENT_SAVEASDOCDONE:
    414             case SFX_EVENT_SAVETODOCDONE:
    415             case SFX_EVENT_CLOSEDOC:
    416             {
    417                 AddDocumentToPickList(pDocSh);
    418             }
    419             break;
    421             case SFX_EVENT_SAVEASDOC:
    422             {
... 434                     AddDocumentToPickList(pDocSh);

See http://opengrok.libreoffice.org/xref/core/sfx2/source/appl/sfxpicklist.cxx#406

Moreover, shell/source/unix/sysshell/systemshell.cxx is nowhere to be seen (at least in master sources).

Any thoughts?
Comment 4 Michael Meeks 2015-02-16 14:17:39 UTC
Sure - so we do a call there that in AddDocumentToPickList does:

    if ( aURL.GetProtocol() == INET_PROT_FILE )
        Application::AddToRecentDocumentList( aURL.GetURLNoPass( INetURLObject::NO_DECODE ),
                                                                 (pFilter) ? pFilter->GetMimeType() : OUString(),
                                                                 (pFilter) ? pFilter->GetServiceName() : OUString() );

Which (AFAICS) should not really be filtering out only file URLs (at least here) but ... that ends up here:

    GtkRecentManager *manager = gtk_recent_manager_get_default ();
    gtk_recent_manager_add_item (manager, sGtkURL.getStr());

And (I guess) it is entirely possible that this now works properly =)

I believe the file-selector in other apps uses this, as that now synchronizes without exiting libreoffice, we can close this guy =)

Thanks for the poke.
Comment 5 Julien Nabet 2015-02-16 14:31:03 UTC
Thank you Michael for your feedback.

Side question: I'm just wondering if we could/should remove SFX_EVENT_CLOSEDOC since I can't imagine a use case that will need it.
It would allow us to save 1 call to AddDocumentToPickList.
Comment 6 Michael Meeks 2015-02-16 15:20:45 UTC
As you like =) it does little harm performance-wise I suspect.
Comment 7 Robinson Tryon (qubit) 2015-12-16 00:24:36 UTC
Migrating Whiteboard tags to Keywords: (EasyHack DifficultyInteresting SkillCpp TopicCleanup)
Comment 8 Robinson Tryon (qubit) 2016-02-18 16:37:26 UTC
Remove LibreOffice Dev List from CC on EasyHacks
(curtailing excessive email to list)