diff options
author | Andrzej Hunt <andrzej.hunt@collabora.com> | 2014-06-13 11:20:15 +0100 |
---|---|---|
committer | Andrzej Hunt <andrzej.hunt@collabora.com> | 2014-06-25 13:04:32 +0100 |
commit | 0cea87d60cfdc2bbc7c6b5d5ee9918e283fc7b2c (patch) | |
tree | 6aced406e9e2089a571598a7364453211a56c01f /libreofficekit/qa/gtktiledviewer | |
parent | ff6a38b76df80d0f907f2f92cb851dea43c91d81 (diff) |
Move gtktiledviewer into libreofficekit.
desktop is no longer the right place for it now that
libreofficekit has its own directory.
Change-Id: I207f1d642e7e35c460ff85bb57aa142cb98023c8
Diffstat (limited to 'libreofficekit/qa/gtktiledviewer')
-rw-r--r-- | libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx new file mode 100644 index 000000000000..3549903b988a --- /dev/null +++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx @@ -0,0 +1,57 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include <stdio.h> +#include <string.h> + +#include <gdk/gdk.h> +#include <gtk/gtk.h> + +#include <LibreOfficeKit/LibreOfficeKitGtk.h> + +static int help() +{ + fprintf( stderr, "Usage: gtktiledviewer <absolute-path-to-libreoffice-install> [path to document]\n" ); + return 1; +} + +int main( int argc, char* argv[] ) +{ + if( argc < 2 || + ( argc > 1 && ( !strcmp( argv[1], "--help" ) || !strcmp( argv[1], "-h" ) ) ) ) + return help(); + + if ( argv[1][0] != '/' ) + { + fprintf(stderr, "Absolute path required to libreoffice install\n"); + return 1; + } + + LibreOfficeKit* pOffice = lok_init( argv[1] ); + + gtk_init( &argc, &argv ); + + GtkWidget *pWindow = gtk_window_new( GTK_WINDOW_TOPLEVEL ); + gtk_window_set_title( GTK_WINDOW(pWindow), "LibreOffice GTK Tiled Viewer" ); + gtk_window_set_default_size(GTK_WINDOW(pWindow), 800, 600); + g_signal_connect( pWindow, "destroy", G_CALLBACK(gtk_main_quit), NULL ); + + + GtkWidget* pDocView = lok_docview_new( pOffice ); + gtk_container_add( GTK_CONTAINER(pWindow), pDocView ); + + lok_docview_open_document( LOK_DOCVIEW(pDocView), argv[2] ); + + gtk_widget_show( pDocView ); + gtk_widget_show( pWindow ); + + gtk_main(); + + return 0; +}
\ No newline at end of file |