diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-09-15 15:05:51 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-09-21 07:30:18 +0200 |
commit | 8d8a8e1a2ea26df6d676495af7f017baa071153d (patch) | |
tree | df9745ee33f72a8d5d40326533527944e12886fd /libreofficekit/qa | |
parent | 2b69ce33edaed9eaa018821180a00d563ad1ba18 (diff) |
gtktiledviewer: factor out setupDocView() from main()
Change-Id: Iac803f03267859c11f0f9090346b09b90c115b76
Diffstat (limited to 'libreofficekit/qa')
-rw-r--r-- | libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx index bdba91ce4ad5..47d349b9493b 100644 --- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx @@ -717,6 +717,21 @@ static GtkWidget* createWindow(TiledWindow& rWindow) return pWindow; } +/// Common setup for DocView (regardless if it's just a new view or a document to be loaded). +static void setupDocView(GtkWidget* pDocView) +{ +#if GLIB_CHECK_VERSION(2,40,0) + g_assert_nonnull(pDocView); +#endif + g_signal_connect(pDocView, "edit-changed", G_CALLBACK(signalEdit), NULL); + g_signal_connect(pDocView, "command-changed", G_CALLBACK(signalCommand), NULL); + g_signal_connect(pDocView, "search-not-found", G_CALLBACK(signalSearch), NULL); + g_signal_connect(pDocView, "part-changed", G_CALLBACK(signalPart), NULL); + g_signal_connect(pDocView, "size-changed", G_CALLBACK(signalSize), NULL); + g_signal_connect(pDocView, "hyperlink-clicked", G_CALLBACK(signalHyperlink), NULL); + g_signal_connect(pDocView, "cursor-changed", G_CALLBACK(cursorChanged), NULL); +} + int main( int argc, char* argv[] ) { if( argc < 3 || @@ -731,19 +746,8 @@ int main( int argc, char* argv[] ) gtk_init( &argc, &argv ); - // Docview - GtkWidget* pDocView = lok_doc_view_new (argv[1], NULL, NULL); -#if GLIB_CHECK_VERSION(2,40,0) - g_assert_nonnull(pDocView); -#endif - g_signal_connect(pDocView, "edit-changed", G_CALLBACK(signalEdit), NULL); - g_signal_connect(pDocView, "command-changed", G_CALLBACK(signalCommand), NULL); - g_signal_connect(pDocView, "search-not-found", G_CALLBACK(signalSearch), NULL); - g_signal_connect(pDocView, "part-changed", G_CALLBACK(signalPart), NULL); - g_signal_connect(pDocView, "size-changed", G_CALLBACK(signalSize), NULL); - g_signal_connect(pDocView, "hyperlink-clicked", G_CALLBACK(signalHyperlink), NULL); - g_signal_connect(pDocView, "cursor-changed", G_CALLBACK(cursorChanged), NULL); - + GtkWidget* pDocView = lok_doc_view_new(argv[1], NULL, NULL); + setupDocView(pDocView); TiledWindow aWindow; aWindow.m_pDocView = pDocView; createWindow(aWindow); |