summaryrefslogtreecommitdiff
path: root/libreofficekit
diff options
context:
space:
mode:
authorPranav Kant <pranavk@collabora.co.uk>2018-03-12 22:03:05 +0530
committerAndras Timar <andras.timar@collabora.com>2018-03-27 12:22:55 +0200
commit75f2d26ab6d83c91e8ce511926186e958f3e5000 (patch)
treef51eef3bc1d764dc97103387d8bf6e8955cdf811 /libreofficekit
parentfacabb8ecf6356c8f0012f91f0db0f0663faf53a (diff)
lokdocview: new property 'is-initialized'; fix gtktiledviewer for calc
there's no lokdocview property to tell if the doc has been completely initialized (initializeForRendering() has been called, etc.). This new property takes care of that which we now use to ignore configure event fired before document is initialized for rendering. Configure event handler queries document for row/col header which asserts because some values hasn't been initialized yet. Change-Id: I58385b2cb56bf317fe20ecf0570b7095f7260174 Reviewed-on: https://gerrit.libreoffice.org/51156 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: pranavk <pranavk@collabora.co.uk> (cherry picked from commit f495a324921589d731d7d16f4554e36d4230476b)
Diffstat (limited to 'libreofficekit')
-rw-r--r--libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx9
-rw-r--r--libreofficekit/source/gtk/lokdocview.cxx22
2 files changed, 31 insertions, 0 deletions
diff --git a/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx b/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx
index 5983b7f77e5b..c3ee592a5463 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx
@@ -403,6 +403,15 @@ void LOKDocViewSigHandlers::window(LOKDocView* pDocView, gchar* pPayload, gpoint
gboolean LOKDocViewSigHandlers::configureEvent(GtkWidget* pWidget, GdkEventConfigure* /*pEvent*/, gpointer /*pData*/)
{
GtvApplicationWindow* window = GTV_APPLICATION_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(pWidget)));
+
+ gboolean isInit = false;
+ g_object_get(G_OBJECT(window->lokdocview), "is-initialized", &isInit, nullptr);
+ if (!isInit)
+ {
+ g_info("Ignoring configure event; document not yet ready");
+ return false;
+ }
+
LibreOfficeKitDocument* pDocument = lok_doc_view_get_document(LOK_DOC_VIEW(window->lokdocview));
if (pDocument && pDocument->pClass->getDocumentType(pDocument) == LOK_DOCTYPE_SPREADSHEET)
{
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index 5243e3887514..8fa945ae2db7 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -82,6 +82,7 @@ struct LOKDocViewPrivateImpl
std::string m_aRenderingArguments;
gdouble m_nLoadProgress;
gboolean m_bIsLoading;
+ gboolean m_bInit; // initializeForRendering() has been called
gboolean m_bCanZoomIn;
gboolean m_bCanZoomOut;
LibreOfficeKit* m_pOffice;
@@ -194,6 +195,7 @@ struct LOKDocViewPrivateImpl
LOKDocViewPrivateImpl()
: m_nLoadProgress(0),
m_bIsLoading(false),
+ m_bInit(false),
m_bCanZoomIn(true),
m_bCanZoomOut(true),
m_pOffice(nullptr),
@@ -292,6 +294,7 @@ enum
PROP_LOAD_PROGRESS,
PROP_ZOOM,
PROP_IS_LOADING,
+ PROP_IS_INITIALIZED,
PROP_DOC_WIDTH,
PROP_DOC_HEIGHT,
PROP_CAN_ZOOM_IN,
@@ -969,6 +972,9 @@ static gboolean postDocumentLoad(gpointer pData)
gtk_widget_grab_focus(GTK_WIDGET(pLOKDocView));
lok_doc_view_set_zoom(pLOKDocView, 1.0);
+ // we are completely loaded
+ priv->m_bInit = TRUE;
+
return G_SOURCE_REMOVE;
}
@@ -2574,6 +2580,9 @@ static void lok_doc_view_get_property (GObject* object, guint propId, GValue *va
case PROP_IS_LOADING:
g_value_set_boolean (value, priv->m_bIsLoading);
break;
+ case PROP_IS_INITIALIZED:
+ g_value_set_boolean (value, priv->m_bInit);
+ break;
case PROP_DOC_WIDTH:
g_value_set_long (value, priv->m_nDocumentWidthTwips);
break;
@@ -2844,6 +2853,19 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass)
G_PARAM_STATIC_STRINGS));
/**
+ * LOKDocView:is-initialized:
+ *
+ * Whether the requested document has completely loaded or not.
+ */
+ properties[PROP_IS_INITIALIZED] =
+ g_param_spec_boolean("is-initialized",
+ "Has initialized",
+ "Whether the view has completely initialized",
+ FALSE,
+ static_cast<GParamFlags>(G_PARAM_READABLE |
+ G_PARAM_STATIC_STRINGS));
+
+ /**
* LOKDocView:doc-width:
*
* The width of the currently loaded document in #LOKDocView in twips.