summaryrefslogtreecommitdiff
path: root/libreofficekit
diff options
context:
space:
mode:
authorPranav Kant <pranavk@collabora.co.uk>2018-03-12 22:03:05 +0530
committerpranavk <pranavk@collabora.co.uk>2018-03-13 06:07:18 +0100
commitf495a324921589d731d7d16f4554e36d4230476b (patch)
tree7ce7e860491b125910b988f05612c2e8763f929b /libreofficekit
parent074436829840763eaf0c3d150b606aedca4e3ef0 (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>
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 87b69ec409af..8a76c78e1151 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),
@@ -293,6 +295,7 @@ enum
PROP_LOAD_PROGRESS,
PROP_ZOOM,
PROP_IS_LOADING,
+ PROP_IS_INITIALIZED,
PROP_DOC_WIDTH,
PROP_DOC_HEIGHT,
PROP_CAN_ZOOM_IN,
@@ -970,6 +973,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;
}
@@ -2575,6 +2581,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;
@@ -2845,6 +2854,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.