diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-06-13 18:09:47 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-06-13 17:53:36 +0000 |
commit | bf11fe9fa1e2caf752c1f9ec3ead1ef20425143f (patch) | |
tree | 7ca8b7d342c62570ea365f063f77525962d18df2 /libreofficekit/qa | |
parent | 351aa7246deee977e90c0f0756df96e3b965effe (diff) |
gtktiledviewer: fix the per-view part selector
Need to populate it & register handlers for the non-first windows as
well.
Change-Id: I27231027c3f33fb081768c51ecc291b9f2a7e99b
Reviewed-on: https://gerrit.libreoffice.org/26225
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'libreofficekit/qa')
-rw-r--r-- | libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx index 1c68e81144d2..380bc04f3daf 100644 --- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx @@ -181,6 +181,12 @@ static std::map<GtkWidget*, TiledWindow> g_aWindows; static void setupDocView(GtkWidget* pDocView); static GtkWidget* createWindow(TiledWindow& rWindow); static void openDocumentCallback (GObject* source_object, GAsyncResult* res, gpointer userdata); +/// Called when the document size is changed. +static void signalSize(LOKDocView* pLOKDocView, gpointer pData); +/// Handler for m_pPartModeComboBox. +static void changePartMode( GtkWidget* pSelector, gpointer /*pItem*/); +/// Handler for m_pPartSelector. +static void changePart( GtkWidget* pSelector, gpointer /*pItem*/ ); static TiledWindow& lcl_getTiledWindow(GtkWidget* pWidget) { @@ -515,6 +521,14 @@ static TiledWindow& setupWidgetAndCreateWindow(GtkWidget* pDocView) return lcl_getTiledWindow(pWindow); } +/// Register handlers on the combo boxes. +static void registerSelectorHandlers(TiledWindow& rWindow) +{ + // Connect these signals after populating the selectors, to avoid re-rendering on setting the default part/partmode. + g_signal_connect(G_OBJECT(rWindow.m_pPartModeComboBox), "changed", G_CALLBACK(changePartMode), 0); + g_signal_connect(G_OBJECT(rWindow.m_pPartSelector), "changed", G_CALLBACK(changePart), 0); +} + /// Creates a new view, i.e. no LOK init or document load. static void createView(GtkWidget* pButton, gpointer /*pItem*/) { @@ -525,6 +539,9 @@ static void createView(GtkWidget* pButton, gpointer /*pItem*/) // Hide the unused progress bar. gtk_widget_show_all(rNewWindow.m_pStatusBar); gtk_widget_hide(rNewWindow.m_pProgressBar); + // Trigger a 'document size changed' event to populate the part selectors. + signalSize(LOK_DOC_VIEW(pDocView), nullptr); + registerSelectorHandlers(rNewWindow); } /// Creates a new model, i.e. LOK init and document load, one view implicitly. @@ -1067,9 +1084,7 @@ static void openDocumentCallback (GObject* source_object, GAsyncResult* res, gpo populatePartSelector(pDocView); populatePartModeSelector( GTK_COMBO_BOX_TEXT(rWindow.m_pPartModeComboBox) ); - // Connect these signals after populating the selectors, to avoid re-rendering on setting the default part/partmode. - g_signal_connect(G_OBJECT(rWindow.m_pPartModeComboBox), "changed", G_CALLBACK(changePartMode), 0); - g_signal_connect(G_OBJECT(rWindow.m_pPartSelector), "changed", G_CALLBACK(changePart), 0); + registerSelectorHandlers(rWindow); focusChain = g_list_append( focusChain, pDocView ); gtk_container_set_focus_chain ( GTK_CONTAINER (rWindow.m_pVBox), focusChain ); |