diff options
author | Jan Holesovsky <kendy@collabora.com> | 2015-11-03 13:20:06 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2015-11-03 13:25:23 +0100 |
commit | 8c987fababbddb6e4f81b0cd717b59b9a9ff9be0 (patch) | |
tree | 269bb73e21a8afebd8ea916d1280d8f858a571bc /libreofficekit/qa | |
parent | c0f37892a24b202c0a28836ed1046c90c7631e03 (diff) |
lok: Introduce LOK_CALLBACK_UNO_COMMAND_RESULT callback.
Posting of the .uno:Something commands is asynchronous. To be able to find
out when eg. .uno:Save finished, this commit introduces a callback that fires
when that happens.
To be able to receive such a notification, the appropriate postUnoCommand()
must be called with 'true' as the parameter for bNotifyWhenFinished (defaults
to 'false').
Change-Id: I254939ebc8ea5f309ae39686dcaaeddd5148b0c9
Diffstat (limited to 'libreofficekit/qa')
-rw-r--r-- | libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx index 5f76e367c77d..e67db9f02460 100644 --- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx @@ -596,7 +596,7 @@ static void doSearch(GtkWidget* pButton, bool bBackwards) std::stringstream aStream; boost::property_tree::write_json(aStream, aTree); - lok_doc_view_post_command(pLOKDocView, ".uno:ExecuteSearch", aStream.str().c_str()); + lok_doc_view_post_command(pLOKDocView, ".uno:ExecuteSearch", aStream.str().c_str(), false); } /// Click handler for the search next button. @@ -672,6 +672,12 @@ static void signalCommand(LOKDocView* pLOKDocView, char* pPayload, gpointer /*pD } } +/// LOKDocView command finished -> just write it to the console, not that useful for the viewer. +static void signalCommandResult(LOKDocView* /*pLOKDocView*/, char* pPayload, gpointer /*pData*/) +{ + fprintf(stderr, "Command finished: %s\n", pPayload); +} + static void loadChanged(LOKDocView* /*pLOKDocView*/, gdouble fValue, gpointer pData) { GtkWidget* pProgressBar = GTK_WIDGET (pData); @@ -774,7 +780,11 @@ static void toggleToolItem(GtkWidget* pWidget, gpointer /*pData*/) GtkToolItem* pItem = GTK_TOOL_ITEM(pWidget); const std::string& rString = rWindow.m_aToolItemCommandNames[pItem]; g_info("toggleToolItem: lok_doc_view_post_command('%s')", rString.c_str()); - lok_doc_view_post_command(pLOKDocView, rString.c_str(), 0); + + // notify about the finished Save + gboolean bNotify = (rString == ".uno:Save"); + + lok_doc_view_post_command(pLOKDocView, rString.c_str(), 0, bNotify); } } @@ -1172,6 +1182,7 @@ static void setupDocView(GtkWidget* pDocView) #endif g_signal_connect(pDocView, "edit-changed", G_CALLBACK(signalEdit), NULL); g_signal_connect(pDocView, "command-changed", G_CALLBACK(signalCommand), NULL); + g_signal_connect(pDocView, "command-result", G_CALLBACK(signalCommandResult), NULL); g_signal_connect(pDocView, "search-not-found", G_CALLBACK(signalSearch), NULL); g_signal_connect(pDocView, "search-result-count", G_CALLBACK(signalSearchResultCount), NULL); g_signal_connect(pDocView, "part-changed", G_CALLBACK(signalPart), NULL); |