diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2019-05-09 18:25:22 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2019-05-10 22:16:42 +0200 |
commit | f29fded5a52f4c2fc1aae307e1f43326dd04108c (patch) | |
tree | a614fbc7ec73dbc4d62e061576b17f7ad5ffc72a /libreofficekit/qa | |
parent | d77495060016c5e97d6e367c2a44fec83cf441f2 (diff) |
unipoll: add a --unipoll parameter to gtktiledviewer.
Arguably should be the default. Implementation is a bit cute -
re-starting the main-loop as a child of a callback from its
idle handler.
Change-Id: I95e87c8a4ae3de745d7ca1f636859dd1d8deca17
Reviewed-on: https://gerrit.libreoffice.org/72072
Tested-by: Jenkins
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'libreofficekit/qa')
3 files changed, 18 insertions, 4 deletions
diff --git a/libreofficekit/qa/gtktiledviewer/gtv-application-window.cxx b/libreofficekit/qa/gtktiledviewer/gtv-application-window.cxx index 1de1aa94568d..564c1de137c6 100644 --- a/libreofficekit/qa/gtktiledviewer/gtv-application-window.cxx +++ b/libreofficekit/qa/gtktiledviewer/gtv-application-window.cxx @@ -356,9 +356,18 @@ gtv_application_window_load_document(GtvApplicationWindow* window, *(priv->m_pRenderingArgs) = *aArgs; // setup lokdocview - window->lokdocview = lok_doc_view_new_from_user_profile(priv->m_pRenderingArgs->m_aLoPath.c_str(), - priv->m_pRenderingArgs->m_aUserProfile.empty() ? nullptr : priv->m_pRenderingArgs->m_aUserProfile.c_str(), - nullptr, nullptr); + const char *pUserProfile = priv->m_pRenderingArgs->m_aUserProfile.empty() ? + nullptr : priv->m_pRenderingArgs->m_aUserProfile.c_str(); + + window->lokdocview = GTK_WIDGET( + g_initable_new(LOK_TYPE_DOC_VIEW, nullptr, nullptr, + "lopath", priv->m_pRenderingArgs->m_aLoPath.c_str(), + "unipoll", priv->m_pRenderingArgs->m_bUnipoll, + "userprofileurl", pUserProfile, + "halign", GTK_ALIGN_CENTER, + "valign", GTK_ALIGN_CENTER, + nullptr)); + gtk_container_add(GTK_CONTAINER(window->scrolledwindow), window->lokdocview); setupDocView(window); diff --git a/libreofficekit/qa/gtktiledviewer/gtv-application-window.hxx b/libreofficekit/qa/gtktiledviewer/gtv-application-window.hxx index 748195c5aff0..21508097e077 100644 --- a/libreofficekit/qa/gtktiledviewer/gtv-application-window.hxx +++ b/libreofficekit/qa/gtktiledviewer/gtv-application-window.hxx @@ -24,6 +24,7 @@ struct GtvRenderingArgs std::string m_aLoPath; std::string m_aUserProfile; bool m_bEnableTiledAnnotations; + bool m_bUnipoll; std::string m_aBackgroundColor; bool m_bHidePageShadow; @@ -31,6 +32,7 @@ struct GtvRenderingArgs GtvRenderingArgs() : m_bEnableTiledAnnotations(false), + m_bUnipoll(false), m_bHidePageShadow(false), m_bHideWhiteSpace(false) { } diff --git a/libreofficekit/qa/gtktiledviewer/gtv-application.cxx b/libreofficekit/qa/gtktiledviewer/gtv-application.cxx index 3d802ee325d4..15e5f15f1697 100644 --- a/libreofficekit/qa/gtktiledviewer/gtv-application.cxx +++ b/libreofficekit/qa/gtktiledviewer/gtv-application.cxx @@ -46,6 +46,7 @@ gtv_application_init(GtvApplication* app) { { "version", 0, 0, G_OPTION_ARG_NONE, nullptr, "Show LOkit version", nullptr }, { "lo-path", 0, 0, G_OPTION_ARG_STRING, nullptr, "LO path", nullptr }, + { "unipoll", 0, 0, G_OPTION_ARG_NONE, nullptr, "Enable unified polling loop", nullptr }, { "user-profile", 0, 0, G_OPTION_ARG_STRING, nullptr, "User profile to use", nullptr }, { "enable-tiled-annotations", 0, 0, G_OPTION_ARG_NONE, nullptr, "Whether tiled annotations should be enabled", nullptr }, { "background-color", 0, 0, G_OPTION_ARG_STRING, nullptr, "Background color", nullptr }, @@ -92,11 +93,13 @@ gtv_application_handle_local_options(GApplication* app, GVariantDict* options) return 1; // Cannot afford to continue in absence of this param } + if (g_variant_dict_contains(options, "unipoll")) + priv->m_pRenderingArgs->m_bUnipoll = true; + if (g_variant_dict_contains(options, "version")) { if (!priv->m_pRenderingArgs->m_aLoPath.empty()) { - // FIXME: Crashes for some reason GtkWidget* pDocView = lok_doc_view_new(priv->m_pRenderingArgs->m_aLoPath.c_str(), nullptr, nullptr); const gchar* versionInfo = lok_doc_view_get_version_info(LOK_DOC_VIEW(pDocView)); if (versionInfo) |