[Libreoffice-commits] core.git: libreofficekit/qa
Miklos Vajna
vmiklos at collabora.co.uk
Mon Jun 13 17:54:06 UTC 2016
libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx | 21 +++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
New commits:
commit bf11fe9fa1e2caf752c1f9ec3ead1ef20425143f
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Mon Jun 13 18:09:47 2016 +0200
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 at collabora.co.uk>
Tested-by: Jenkins <ci at libreoffice.org>
diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index 1c68e81..380bc04 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 );
More information about the Libreoffice-commits
mailing list