Browse Source

First release ;-)

develop
Kolan Sh 6 years ago
parent
commit
7f48d3c371
  1. 6
      .gitmodules
  2. 1
      AUTHORS
  3. 24
      CMakeLists.txt
  4. 165
      COPYING
  5. 85
      INSTALL
  6. 2
      MAINTAINERS
  7. 2
      README
  8. 1
      cmake/backbone
  9. 5
      config/CMakeLists.txt
  10. 6
      config/Config.vapi
  11. 3
      config/config.h.in
  12. 23
      config/ws.backbone.laview.desktop.gschema.xml
  13. 14
      cpack/CMakeLists.txt
  14. 6
      pkg-config/CMakeLists.txt
  15. 1
      po/CMakeLists.txt
  16. 1
      po/de/CMakeLists.txt
  17. 196
      po/de/laview-desktop.po
  18. 196
      po/laview-desktop.pot
  19. 1
      po/ru/CMakeLists.txt
  20. 197
      po/ru/laview-desktop.po
  21. 7
      res/CMakeLists.txt
  22. 262
      res/about.svg
  23. 9
      res/laview-desktop.desktop.in
  24. 8
      res/laview-desktop.gresource.xml
  25. BIN
      res/laview-desktop.ico
  26. BIN
      res/laview-desktop.png
  27. 1
      res/laview-desktop.rc
  28. 37
      src/AboutWindow.vala
  29. 10
      src/AppCore.vala
  30. 31
      src/AppDirs.vala
  31. 16
      src/CMakeLists.txt
  32. 256
      src/MainWindow.vala
  33. 77
      src/PreferencesWindow.vala
  34. 11
      src/Resources.vala
  35. 15
      src/Settings.vala
  36. 69
      src/SubprocessDialog.vala
  37. 72
      src/Utils.vala
  38. 72
      src/main.vala
  39. 0
      test/CMakeLists.txt
  40. 1
      ui/CMakeLists.txt
  41. 2
      ui/glade/CMakeLists.txt
  42. 1134
      ui/glade/laview-desktop.glade
  43. 1
      util/backbone
  44. 2
      valadoc_env

6
.gitmodules

@ -0,0 +1,6 @@
[submodule "cmake/backbone"]
path = cmake/backbone
url = git@git.backbone.ws:cmake/backbone.git
[submodule "util/backbone"]
path = util/backbone
url = git@git.backbone.ws:cmake/backbone-utils.git

1
AUTHORS

@ -0,0 +1 @@
Kolan Sh <backbone@backbone.ws>

24
CMakeLists.txt

@ -0,0 +1,24 @@
PROJECT (LAviewDesktop C)
CMAKE_MINIMUM_REQUIRED (VERSION 2.8)
SET (PROJECT_LOWERCASE_NAME "laview-desktop")
SET (PROJECT_DESCRIPTION "LAview Desktop Application.")
SET (MAJOR 0)
SET (MINOR 0)
SET (PATCH 0)
LIST (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/backbone)
ADD_SUBDIRECTORY (config)
ADD_SUBDIRECTORY (src)
ADD_SUBDIRECTORY (po)
ADD_SUBDIRECTORY (pkg-config)
ADD_SUBDIRECTORY (test)
ADD_SUBDIRECTORY (cpack)
ADD_SUBDIRECTORY (ui)
ADD_SUBDIRECTORY (res)
# enable testing
ENABLE_TESTING ()

165
COPYING

@ -0,0 +1,165 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.

85
INSTALL

@ -0,0 +1,85 @@
Requirements
------------
Build-Time Dependencies
LAview-Core: https://redmine.backbone.ws/projects/laview-core
GTK+-3:http://www.gtk.org/
CMake: http://www.cmake.org
NSIS (W32): http://nsis.sourceforge.net
Run-Time Dependencies
GTK+-3:http://www.gtk.org/
LAview-Core: https://redmine.backbone.ws/projects/laview-core
Operation Systems
* GNU/Linux (Gentoo, Debian, etc.)
* MS Windows (Windows 5.1 aka XP)
* BSD-based (FreeBSD, OpenBSD, NetBSD, Mac OS X)
If you need support of one more OS, be free in writing of patches and sending
pull-requests to the mainstream.
Compilation
-----------
Compilation under GNU/Linux
$ mkdir build-gcc && cd build-gcc
$ cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr
$ make -j$((`getconf _NPROCESSORS_ONLN`+1))
Compilation under MS Windows
$ mkdir build-mingw && cd build-mingw
$ cmake -G "MSYS Makefiles" .. -DCMAKE_BUILD_TYPE=Release
$ make -j$((NUMBER_OF_PROCESSORS + 1))
Compilation under BSD-based Systems.
TODO: add description here.
Packing/Installation
--------------------
Packing/Installation under GNU/Linux
$ cpack
Install using System Package Manager.
Packing/Installation under MS Windows
$ cpack
Install using generated by NSIS executable.
Packing/Installation under BSD-based
$ cpack
Install using System Package Manager.
Testing
-------
Testing under GNU/Linux
$ ctest -j$((`getconf _NPROCESSORS_ONLN`+1))
Automated tests for memory leaks:
$ ctest -j$((NUMBER_OF_PROCESSORS + 1)) -D NightlyMemCheck && grep definitely Testing/Temporary/LastDynamicAnalysis_*.log
Testing under MS Windows
$ ctest -j$((NUMBER_OF_PROCESSORS + 1))
Automated tests for memory leaks are not available as far as Valgrind not
present on this platform.
Testing under BSD-based
$ ctest
Automated tests for memory leaks are not available as far as Valgrind not
present on this platform.

2
MAINTAINERS

@ -0,0 +1,2 @@
Kolan Sh
email: backbone@backbone.ws

2
README

@ -1 +1 @@
Desktop LAview Application.
LAview Desktop Application.

1
cmake/backbone

@ -0,0 +1 @@
Subproject commit 126f4cc3fecf5f9c8ad3dd55edc164801f64482a

5
config/CMakeLists.txt

@ -0,0 +1,5 @@
SET (GSchemaFile "ws.backbone.laview.desktop")
INCLUDE (GSchemaCommonRules)
CONFIGURE_FILE ("${CMAKE_CURRENT_SOURCE_DIR}/config.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/config.h")

6
config/Config.vapi

@ -0,0 +1,6 @@
[CCode (cheader_filename = "config.h")]
namespace Config {
static const int VERSION_MAJOR;
static const int VERSION_MINOR;
static const int VERSION_PATCH;
}

3
config/config.h.in

@ -0,0 +1,3 @@
#define CONFIG_VERSION_MAJOR @MAJOR@
#define CONFIG_VERSION_MINOR @MINOR@
#define CONFIG_VERSION_PATCH @PATCH@

23
config/ws.backbone.laview.desktop.gschema.xml

@ -0,0 +1,23 @@
<schemalist>
<schema id="ws.backbone.lavew.desktop-@MAJOR@" path="/ws/backbone/laview/desktop-@MAJOR@/" gettext-domain="laview-desktop-@MAJOR@">
<key name="greeting" type="s">
<default l10n="messages">"Hello, earthlings"</default>
<summary>A greeting</summary>
<description>Greeting of the invading martians</description>
</key>
<key name="bottles-of-beer" type="i">
<default>99</default>
<summary>Bottles of beer</summary>
<description>Number of bottles of beer on the wall</description>
</key>
<key name="lighting" type="b">
<default>false</default>
<summary>Is the light switched on?</summary>
<description>State of an imaginary light switch.</description>
</key>
</schema>
</schemalist>

14
cpack/CMakeLists.txt

@ -0,0 +1,14 @@
SET (CONTACT "backbone@backbone.ws")
SET (DEBIAN_DEPENDENCIES "laview-core-0 >= 0.0.0")
SET (DEBIAN_SECTION "TeX")
SET (REDHAT_DEPENDENCIES "laview-core-0 >= 0.0.0")
SET (REDHAT_SECTION "Applications/Publishing")
SET (LICENSE "LGPLv3+")
SET (WIN32_UNINSTALL_NAME "LAvDesk") # <= 8 symbols for the name
SET (CPACK_PACKAGE_EXECUTABLES "${PROJECT_LOWERCASE_NAME}-${MAJOR};LAview Desktop")
SET (CPACK_NSIS_INSTALLED_ICON_NAME bin\\\\${PROJECT_LOWERCASE_NAME}-${MAJOR}.exe)
SET (CPACK_CREATE_DESKTOP_LINKS "${PROJECT_LOWERCASE_NAME}-${MAJOR}")
SET (CPACK_NSIS_MENU_LINKS "https://redmine.backbone.ws/projects/laview/wiki" "Homepage for LAview Desktop")
INCLUDE (CPackCommonRules)

6
pkg-config/CMakeLists.txt

@ -0,0 +1,6 @@
INCLUDE (PkgConfigCommonRules)
CONFIGURE_FILE (
"${CMAKE_SOURCE_DIR}/cmake/backbone/templates/pkg-config.pc.in"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_LOWERCASE_NAME}-${MAJOR}.pc"
)

1
po/CMakeLists.txt

@ -0,0 +1 @@
INCLUDE (GettextCommonRules)

1
po/de/CMakeLists.txt

@ -0,0 +1 @@
INCLUDE (GettextLangRules)

196
po/de/laview-desktop.po

@ -0,0 +1,196 @@
# German translations for laview-desktop package.
# Copyright (C) 2015 THE laview-desktop'S COPYRIGHT HOLDER
# This file is distributed under the same license as the laview-desktop package.
# <backbone@backbone.ws>, 2015.
#
msgid ""
msgstr ""
"Project-Id-Version: laview-desktop\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-12-27 19:03+0300\n"
"PO-Revision-Date: 2015-10-24 20:19+0300\n"
"Last-Translator: <backbone@backbone.ws>\n"
"Language-Team: German\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: config/ws.backbone.laview.desktop.gschema.xml.h:1
msgid "\"Hello, earthlings\""
msgstr ""
#: config/ws.backbone.laview.desktop.gschema.xml.h:2
msgid "A greeting"
msgstr ""
#: config/ws.backbone.laview.desktop.gschema.xml.h:3
msgid "Greeting of the invading martians"
msgstr ""
#: config/ws.backbone.laview.desktop.gschema.xml.h:4
msgid "Bottles of beer"
msgstr ""
#: config/ws.backbone.laview.desktop.gschema.xml.h:5
msgid "Number of bottles of beer on the wall"
msgstr ""
#: config/ws.backbone.laview.desktop.gschema.xml.h:6
msgid "Is the light switched on?"
msgstr ""
#: config/ws.backbone.laview.desktop.gschema.xml.h:7
msgid "State of an imaginary light switch."
msgstr ""
#: src/MainWindow.vala:84
msgid "Select templates"
msgstr ""
#: src/MainWindow.vala:86
msgid "_Cancel"
msgstr ""
#: src/MainWindow.vala:87
msgid "_Open"
msgstr ""
#: src/main.vala:33
msgid "Show the application's version"
msgstr ""
#: src/main.vala:52
msgid "[FILE]"
msgstr ""
#: src/main.vala:64
#, c-format
msgid "Error: %s\n"
msgstr ""
#: src/main.vala:65
#, c-format
msgid "Run '%s --help' to see a full list of available command line options.\n"
msgstr ""
#: ui/glade/laview-desktop.glade.h:1
msgid "Kolan Sh (backbone@backbone.ws)"
msgstr ""
#: ui/glade/laview-desktop.glade.h:2
msgid "LaTeX View or View Data in LaTeX."
msgstr ""
#: ui/glade/laview-desktop.glade.h:3
msgid "LAview"
msgstr ""
#: ui/glade/laview-desktop.glade.h:4
msgid "Kolan Sh"
msgstr ""
#: ui/glade/laview-desktop.glade.h:5
msgid "LAview Preferences"
msgstr ""
#: ui/glade/laview-desktop.glade.h:6
msgid "Paths"
msgstr ""
#: ui/glade/laview-desktop.glade.h:7
msgid "LyX path on Windows"
msgstr ""
#: ui/glade/laview-desktop.glade.h:8
msgid "pdfLaTeX path on Windows"
msgstr ""
#: ui/glade/laview-desktop.glade.h:9
msgid "Common"
msgstr ""
#: ui/glade/laview-desktop.glade.h:10
msgid "Protocol Plugins"
msgstr ""
#: ui/glade/laview-desktop.glade.h:11
msgid "Protocol plugins"
msgstr ""
#: ui/glade/laview-desktop.glade.h:12
msgid "Data Plugins"
msgstr ""
#: ui/glade/laview-desktop.glade.h:13
msgid "Data plugins"
msgstr ""
#: ui/glade/laview-desktop.glade.h:14
msgid "LAview Desktop"
msgstr ""
#: ui/glade/laview-desktop.glade.h:15
msgid "_Template"
msgstr ""
#: ui/glade/laview-desktop.glade.h:16
msgid "_Document"
msgstr ""
#: ui/glade/laview-desktop.glade.h:17
msgid "_Application"
msgstr ""
#: ui/glade/laview-desktop.glade.h:18
msgid "_Help"
msgstr ""
#: ui/glade/laview-desktop.glade.h:19
msgid "Create a new template"
msgstr ""
#: ui/glade/laview-desktop.glade.h:20
msgid "Open a template"
msgstr ""
#: ui/glade/laview-desktop.glade.h:21
msgid "Change selected template"
msgstr ""
#: ui/glade/laview-desktop.glade.h:22
msgid "Delete selected template"
msgstr ""
#: ui/glade/laview-desktop.glade.h:23
msgid "Document object preparing"
msgstr ""
#: ui/glade/laview-desktop.glade.h:24
msgid "View and print the document"
msgstr ""
#: ui/glade/laview-desktop.glade.h:25
msgid "Edit the result document"
msgstr ""
#: ui/glade/laview-desktop.glade.h:26
msgid "Application preferences"
msgstr ""
#: ui/glade/laview-desktop.glade.h:27
msgid "Help and reference"
msgstr ""
#: ui/glade/laview-desktop.glade.h:28
msgid "Close the application"
msgstr ""
#: ui/glade/laview-desktop.glade.h:29
msgid "Templates"
msgstr ""
#: ui/glade/laview-desktop.glade.h:30
msgid "Document Objects"
msgstr ""

196
po/laview-desktop.pot

@ -0,0 +1,196 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the laview-desktop package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: laview-desktop\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-12-27 19:04+0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: config/ws.backbone.laview.desktop.gschema.xml.h:1
msgid "\"Hello, earthlings\""
msgstr ""
#: config/ws.backbone.laview.desktop.gschema.xml.h:2
msgid "A greeting"
msgstr ""
#: config/ws.backbone.laview.desktop.gschema.xml.h:3
msgid "Greeting of the invading martians"
msgstr ""
#: config/ws.backbone.laview.desktop.gschema.xml.h:4
msgid "Bottles of beer"
msgstr ""
#: config/ws.backbone.laview.desktop.gschema.xml.h:5
msgid "Number of bottles of beer on the wall"
msgstr ""
#: config/ws.backbone.laview.desktop.gschema.xml.h:6
msgid "Is the light switched on?"
msgstr ""
#: config/ws.backbone.laview.desktop.gschema.xml.h:7
msgid "State of an imaginary light switch."
msgstr ""
#: src/MainWindow.vala:84
msgid "Select templates"
msgstr ""
#: src/MainWindow.vala:86
msgid "_Cancel"
msgstr ""
#: src/MainWindow.vala:87
msgid "_Open"
msgstr ""
#: src/main.vala:33
msgid "Show the application's version"
msgstr ""
#: src/main.vala:52
msgid "[FILE]"
msgstr ""
#: src/main.vala:64
#, c-format
msgid "Error: %s\n"
msgstr ""
#: src/main.vala:65
#, c-format
msgid "Run '%s --help' to see a full list of available command line options.\n"
msgstr ""
#: ui/glade/laview-desktop.glade.h:1
msgid "Kolan Sh (backbone@backbone.ws)"
msgstr ""
#: ui/glade/laview-desktop.glade.h:2
msgid "LaTeX View or View Data in LaTeX."
msgstr ""
#: ui/glade/laview-desktop.glade.h:3
msgid "LAview"
msgstr ""
#: ui/glade/laview-desktop.glade.h:4
msgid "Kolan Sh"
msgstr ""
#: ui/glade/laview-desktop.glade.h:5
msgid "LAview Preferences"
msgstr ""
#: ui/glade/laview-desktop.glade.h:6
msgid "Paths"
msgstr ""
#: ui/glade/laview-desktop.glade.h:7
msgid "LyX path on Windows"
msgstr ""
#: ui/glade/laview-desktop.glade.h:8
msgid "pdfLaTeX path on Windows"
msgstr ""
#: ui/glade/laview-desktop.glade.h:9
msgid "Common"
msgstr ""
#: ui/glade/laview-desktop.glade.h:10
msgid "Protocol Plugins"
msgstr ""
#: ui/glade/laview-desktop.glade.h:11
msgid "Protocol plugins"
msgstr ""
#: ui/glade/laview-desktop.glade.h:12
msgid "Data Plugins"
msgstr ""
#: ui/glade/laview-desktop.glade.h:13
msgid "Data plugins"
msgstr ""
#: ui/glade/laview-desktop.glade.h:14
msgid "LAview Desktop"
msgstr ""
#: ui/glade/laview-desktop.glade.h:15
msgid "_Template"
msgstr ""
#: ui/glade/laview-desktop.glade.h:16
msgid "_Document"
msgstr ""
#: ui/glade/laview-desktop.glade.h:17
msgid "_Application"
msgstr ""
#: ui/glade/laview-desktop.glade.h:18
msgid "_Help"
msgstr ""
#: ui/glade/laview-desktop.glade.h:19
msgid "Create a new template"
msgstr ""
#: ui/glade/laview-desktop.glade.h:20
msgid "Open a template"
msgstr ""
#: ui/glade/laview-desktop.glade.h:21
msgid "Change selected template"
msgstr ""
#: ui/glade/laview-desktop.glade.h:22
msgid "Delete selected template"
msgstr ""
#: ui/glade/laview-desktop.glade.h:23
msgid "Document object preparing"
msgstr ""
#: ui/glade/laview-desktop.glade.h:24
msgid "View and print the document"
msgstr ""
#: ui/glade/laview-desktop.glade.h:25
msgid "Edit the result document"
msgstr ""
#: ui/glade/laview-desktop.glade.h:26
msgid "Application preferences"
msgstr ""
#: ui/glade/laview-desktop.glade.h:27
msgid "Help and reference"
msgstr ""
#: ui/glade/laview-desktop.glade.h:28
msgid "Close the application"
msgstr ""
#: ui/glade/laview-desktop.glade.h:29
msgid "Templates"
msgstr ""
#: ui/glade/laview-desktop.glade.h:30
msgid "Document Objects"
msgstr ""

1
po/ru/CMakeLists.txt

@ -0,0 +1 @@
INCLUDE (GettextLangRules)

197
po/ru/laview-desktop.po

@ -0,0 +1,197 @@
# Russian translations for laview-desktop package.
# Copyright (C) 2015 THE laview-desktop'S COPYRIGHT HOLDER
# This file is distributed under the same license as the laview-desktop package.
# <backbone@backbone.ws>, 2015.
#
msgid ""
msgstr ""
"Project-Id-Version: laview-desktop\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-12-27 19:03+0300\n"
"PO-Revision-Date: 2015-10-24 20:19+0300\n"
"Last-Translator: <backbone@backbone.ws>\n"
"Language-Team: Russian\n"
"Language: ru\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
#: config/ws.backbone.laview.desktop.gschema.xml.h:1
msgid "\"Hello, earthlings\""
msgstr "\"Привет, земляне\""
#: config/ws.backbone.laview.desktop.gschema.xml.h:2
msgid "A greeting"
msgstr "Приветствие"
#: config/ws.backbone.laview.desktop.gschema.xml.h:3
msgid "Greeting of the invading martians"
msgstr "Приветствие вторгнувшихся марсиан"
#: config/ws.backbone.laview.desktop.gschema.xml.h:4
msgid "Bottles of beer"
msgstr "Бутылки пива"
#: config/ws.backbone.laview.desktop.gschema.xml.h:5
msgid "Number of bottles of beer on the wall"
msgstr "Число бутылок пива на стене"
#: config/ws.backbone.laview.desktop.gschema.xml.h:6
msgid "Is the light switched on?"
msgstr "Включен ли свет?"
#: config/ws.backbone.laview.desktop.gschema.xml.h:7
msgid "State of an imaginary light switch."
msgstr "Состояние воображаемого выключателя света."
#: src/MainWindow.vala:84
msgid "Select templates"
msgstr "Выберите шаблоны"
#: src/MainWindow.vala:86
msgid "_Cancel"
msgstr "_Отмена"
#: src/MainWindow.vala:87
msgid "_Open"
msgstr "_Открыть"
#: src/main.vala:33
msgid "Show the application's version"
msgstr "Показать версию приложения"
#: src/main.vala:52
msgid "[FILE]"
msgstr "[ФАЙЛ]"
#: src/main.vala:64
#, c-format
msgid "Error: %s\n"
msgstr "Ошибка: %s\n"
#: src/main.vala:65
#, c-format
msgid "Run '%s --help' to see a full list of available command line options.\n"
msgstr "Запустите '%s --help', чтобы увидеть весь список доступных опций.\n"
#: ui/glade/laview-desktop.glade.h:1
msgid "Kolan Sh (backbone@backbone.ws)"
msgstr "Николай Ш (backbone@backbone.ws)"
#: ui/glade/laview-desktop.glade.h:2
msgid "LaTeX View or View Data in LaTeX."
msgstr "LaTeX вид или Представление данных в LaTeX."
#: ui/glade/laview-desktop.glade.h:3
msgid "LAview"
msgstr "LAview"
#: ui/glade/laview-desktop.glade.h:4
msgid "Kolan Sh"
msgstr "Николай Ш"
#: ui/glade/laview-desktop.glade.h:5
msgid "LAview Preferences"
msgstr "Параметры LAview"
#: ui/glade/laview-desktop.glade.h:6
msgid "Paths"
msgstr "Пути"
#: ui/glade/laview-desktop.glade.h:7
msgid "LyX path on Windows"
msgstr "Путь к LyX под Windows"
#: ui/glade/laview-desktop.glade.h:8
msgid "pdfLaTeX path on Windows"
msgstr "Путь к pdfLaTeX под Windows"
#: ui/glade/laview-desktop.glade.h:9
msgid "Common"
msgstr "Общие"
#: ui/glade/laview-desktop.glade.h:10
msgid "Protocol Plugins"
msgstr "Плагины протоколов"
#: ui/glade/laview-desktop.glade.h:11
msgid "Protocol plugins"
msgstr "Плагины протоколов"
#: ui/glade/laview-desktop.glade.h:12
msgid "Data Plugins"
msgstr "Плагины данных"
#: ui/glade/laview-desktop.glade.h:13
msgid "Data plugins"
msgstr "Плагины данных"
#: ui/glade/laview-desktop.glade.h:14
msgid "LAview Desktop"
msgstr "Рабочее окно LAview"
#: ui/glade/laview-desktop.glade.h:15
msgid "_Template"
msgstr "_Шаблон"
#: ui/glade/laview-desktop.glade.h:16
msgid "_Document"
msgstr "_Документ"
#: ui/glade/laview-desktop.glade.h:17
msgid "_Application"
msgstr "_Приложение"
#: ui/glade/laview-desktop.glade.h:18
msgid "_Help"
msgstr "_Помощь"
#: ui/glade/laview-desktop.glade.h:19
msgid "Create a new template"
msgstr "Создать новый шаблон"
#: ui/glade/laview-desktop.glade.h:20
msgid "Open a template"
msgstr "Открыть шаблон"
#: ui/glade/laview-desktop.glade.h:21
msgid "Change selected template"
msgstr "Изменить выбранный шаблон"
#: ui/glade/laview-desktop.glade.h:22
msgid "Delete selected template"
msgstr "Удалить выбранный шаблон"
#: ui/glade/laview-desktop.glade.h:23
msgid "Document object preparing"
msgstr "Подготовка объекта документа"
#: ui/glade/laview-desktop.glade.h:24
msgid "View and print the document"
msgstr "Просмотр и печать документа"
#: ui/glade/laview-desktop.glade.h:25
msgid "Edit the result document"
msgstr "Редактировать полученный документ"
#: ui/glade/laview-desktop.glade.h:26
msgid "Application preferences"
msgstr "Параметры приложения"
#: ui/glade/laview-desktop.glade.h:27
msgid "Help and reference"
msgstr "Помощь и справка"
#: ui/glade/laview-desktop.glade.h:28
msgid "Close the application"
msgstr "Закрыть приложение"
#: ui/glade/laview-desktop.glade.h:29
msgid "Templates"
msgstr "Шаблоны"
#: ui/glade/laview-desktop.glade.h:30
msgid "Document Objects"
msgstr "Объекты документа"

7
res/CMakeLists.txt

@ -0,0 +1,7 @@
INCLUDE (GResourceCommonRules)
CONFIGURE_FILE ("${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_LOWERCASE_NAME}.desktop.in"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_LOWERCASE_NAME}-${MAJOR}.desktop")
INSTALL (FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_LOWERCASE_NAME}-${MAJOR}.desktop"
DESTINATION "share/applications")
INSTALL (FILES "laview-desktop.png" DESTINATION "share/pixmaps")

262
res/about.svg
File diff suppressed because it is too large
View File

9
res/laview-desktop.desktop.in

@ -0,0 +1,9 @@
[Desktop Entry]
Name=LAview Desktop @MAJOR@.@MINOR@.@PATCH@
Comment=LAview Desktop Application
Exec=laview-desktop-@MAJOR@ %u
Icon=laview-desktop
Terminal=false
Type=Application
MimeType=laview/lyx;
Categories=Office;

8
res/laview-desktop.gresource.xml

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/ws/backbone/laview/desktop">
<file preprocess="to-pixdata">about.svg</file>
<!--<file preprocess="xml-stripblanks">whois-server-list.xml</file>-->
<!--<file compressed="true">gwhois.css</file>-->
</gresource>
</gresources>

BIN
res/laview-desktop.ico

BIN
res/laview-desktop.png

After

Width: 128  |  Height: 128  |  Size: 13 KiB

1
res/laview-desktop.rc

@ -0,0 +1 @@
IDR_MAINFRAME ICON "laview-desktop.ico"

37
src/AboutWindow.vala

@ -0,0 +1,37 @@
namespace LAview.Desktop {
using Gtk;
/**
* About dialog.
*/
public class AboutDialogWindow {
AboutDialog dialog;
public AboutDialogWindow (Window parent) throws Error {
var builder = new Builder ();
builder.add_from_file (AppDirs.ui_dir + "/laview-desktop.glade");
builder.connect_signals (this);
dialog = builder.get_object ("aboutdialog_window") as AboutDialog;
dialog.set_destroy_with_parent (true);
dialog.set_transient_for (parent);
dialog.set_modal (true);
dialog.delete_event.connect ((source) => {return true;});
dialog.version = @" $(Config.VERSION_MAJOR).$(Config.VERSION_MINOR).$(Config.VERSION_PATCH)";
dialog.response.connect ((response_id) => {
if (response_id == Gtk.ResponseType.CANCEL || response_id == Gtk.ResponseType.DELETE_EVENT) {
dialog.hide_on_delete ();
}
});
dialog.logo = new Gdk.Pixbuf.from_resource_at_scale ("/ws/backbone/laview/desktop/about.svg", 256, 256, true);
}
public void show_all () {
dialog.show_all ();
}
}
}

10
src/AppCore.vala

@ -0,0 +1,10 @@
namespace LAview.Desktop {
class AppCore {
public static LAview.Core.Core core;
public static void init (string[] args) throws Error {
core = new LAview.Core.Core();
}
}
}

31
src/AppDirs.vala

@ -0,0 +1,31 @@
namespace LAview.Desktop {
class AppDirs {
private const string DEFAULT_DATA_DIR = ".texreport-gtk";
public static File exec_file;
public static File exec_dir;
public static File common_dir;
public static string resource_dir;
public static string ui_dir;
public static string locale_dir;
public static string settings_dir;
public static void init (string[] args) {
exec_file = File.new_for_path (Environment.find_program_in_path (args[0]));
exec_dir = exec_file.get_parent ();
common_dir = exec_dir.get_parent ();
resource_dir = Path.build_path (Path.DIR_SEPARATOR_S, common_dir.get_path(),
"share/laview-desktop-"+Config.VERSION_MAJOR.to_string());
ui_dir = resource_dir + "/ui";
locale_dir = Path.build_path (Path.DIR_SEPARATOR_S, common_dir.get_path(), "share/locale");
settings_dir = Path.build_path (Path.DIR_SEPARATOR_S, common_dir.get_path(), "share/glib-2.0/schemas");
string w32dhack_sdir = settings_dir+"/laview-desktop-"+Config.VERSION_MAJOR.to_string();
if (File.new_for_path(w32dhack_sdir+"/gschemas.compiled").query_exists ())
settings_dir = w32dhack_sdir;
}
public static void terminate () {
}
}
}

16
src/CMakeLists.txt

@ -0,0 +1,16 @@
SET (BinName laview-desktop-${MAJOR})
FILE (GLOB_RECURSE BinSources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.vala)
SET (BinPackages gtk+-3.0 gee-0.8 gobject-plugin-iface-0 laview-core-iface-0 laview-core-0 posix)
SET (BinPkgModules gtk+-3.0 gee-0.8 laview-core-0)
SET (BinCustomVapis ${CMAKE_SOURCE_DIR}/config/Config.vapi)
INCLUDE_DIRECTORIES ("${CMAKE_BINARY_DIR}/config")
SET (BinInstall ON)
SET (BinExtraSources "${CMAKE_SOURCE_DIR}/res/laview-desktop.rc")
IF (WIN32)
SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mwindows")
SET (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--export-all-symbols")
SET (BinValaOpts -D WINDOWS)
ELSE (WIN32)
SET (BinValaOpts -D UNIX)
ENDIF (WIN32)
INCLUDE (ValaBinCommonRules)

256
src/MainWindow.vala

@ -0,0 +1,256 @@
namespace LAview.Desktop {
using Gtk, LAview, Core;
/**
* Main LAview Desktop window.
*/
public class MainWindow {
Window window;
PreferencesDialog pref_dialog;
AboutDialogWindow about_dialog;
SubprocessDialog subprocess_dialog;
Gtk.Statusbar statusbar;
Gtk.ListStore liststore_templates;
Gtk.ListStore liststore_doc_objects;
TreeView treeview_templates;
TreeView treeview_objects;
public MainWindow () throws Error {
var builder = new Builder ();
builder.add_from_file (AppDirs.ui_dir + "/laview-desktop.glade");
builder.connect_signals (this);
window = builder.get_object ("main_window") as Window;
statusbar = builder.get_object ("statusbar") as Statusbar;
liststore_templates = builder.get_object ("liststore_templates") as Gtk.ListStore;
liststore_doc_objects = builder.get_object ("liststore_objects") as Gtk.ListStore;
treeview_templates = builder.get_object ("treeview_templates") as TreeView;
treeview_objects = builder.get_object ("treeview_objects") as TreeView;
window.title = "LAview Desktop"
+ @" $(Config.VERSION_MAJOR).$(Config.VERSION_MINOR).$(Config.VERSION_PATCH)";
pref_dialog = new PreferencesDialog (window);
subprocess_dialog = new SubprocessDialog (window);
about_dialog = new AboutDialogWindow (window);
fill_liststore_templates ();
}
void fill_liststore_templates () {
var templates = AppCore.core.get_templates_readable_names ();
liststore_templates.clear();
Gtk.TreeIter iter = Gtk.TreeIter();
foreach (var t in templates) {
liststore_templates.append (out iter);
liststore_templates.set (iter, 0, t);
}
}
void statusbar_show (string str) {
var context_id = statusbar.get_context_id ("common_context");
statusbar.push (context_id, str);
}
public void show_all () {
window.show_all ();
statusbar_show ("We're ready, Commander! Select or create a template. :-)");
}
[CCode (instance_pos = -1)]
public void menu_about_activate (Gtk.ImageMenuItem item) {
about_dialog.show_all ();
}
[CCode (instance_pos = -1)]
public void action_new_activate (Gtk.Action action) {
string[] argv = { AppCore.core.lyx_path, "--execute", "buffer-new" };
try {
var subprocess = new SubprocessLauncher( SubprocessFlags.STDIN_PIPE
| SubprocessFlags.STDOUT_PIPE
| SubprocessFlags.STDERR_PIPE);
subprocess.spawnv(argv);
} catch (Error err) {
var msg = new MessageDialog (window, DialogFlags.MODAL, MessageType.ERROR,
ButtonsType.CLOSE, @"Error: $(err.message).");
msg.response.connect ((response_id) => { msg.destroy (); } );
msg.show ();
}
}
[CCode (instance_pos = -1)]
public void action_open_activate (Gtk.Action action) {
FileChooserDialog chooser = new Gtk.FileChooserDialog (_("Select templates"), window,
FileChooserAction.OPEN,
_("_Cancel"), ResponseType.CANCEL,
_("_Open"), ResponseType.ACCEPT);
chooser.select_multiple = true;
FileFilter filter = new FileFilter ();
chooser.set_filter (filter);
filter.add_mime_type ("application/x-tex");
filter.add_mime_type ("application/x-latex");
filter.add_mime_type ("application/x-lyx");
filter.add_pattern ("*.tex");
filter.add_pattern ("*.latex");
filter.add_pattern ("*.lyx");
if (chooser.run () == ResponseType.ACCEPT) {
SList<string> paths = chooser.get_filenames ();
foreach (unowned string path in paths)
AppCore.core.add_template (path);
fill_liststore_templates ();
}
chooser.close ();
}
void edit_lyx_files (string[] paths) {
string[] args = { AppCore.core.lyx_path, "--remote" };
foreach (var p in paths) args += p;
try {
var subprocess = new SubprocessLauncher( SubprocessFlags.STDIN_PIPE
| SubprocessFlags.STDOUT_PIPE
| SubprocessFlags.STDERR_PIPE);
subprocess.spawnv(args);
} catch (Error err) {
var msg = new MessageDialog (window, DialogFlags.MODAL, MessageType.ERROR,
ButtonsType.CLOSE, @"Error: $(err.message).");
msg.response.connect ((response_id) => { msg.destroy (); } );
msg.show ();
}
}
int[] get_template_indices () {
var selection = treeview_templates.get_selection ();
var selected_rows = selection.get_selected_rows (null);
int[] indices = {};
foreach (var r in selected_rows) {
indices += r.get_indices()[0];
}
return indices;
}
[CCode (instance_pos = -1)]
public void action_edit_template_activate (Gtk.Action action) {
edit_selected_templates ();
}
[CCode (instance_pos = -1)]
public void action_delete_activate (Gtk.Action action) {
var indices = get_template_indices ();
for (int i = indices.length; i > 0; )
AppCore.core.remove_template (indices[--i]);
fill_liststore_templates ();
}
int[] get_objects_indices () {
var selection = treeview_objects.get_selection ();
var selected_rows = selection.get_selected_rows (null);
int[] indices = {};
foreach (var r in selected_rows) {
indices += r.get_indices()[0];
}
return indices;
}
[CCode (instance_pos = -1)]
public void action_compose_activate (Gtk.Action action) {
var t_indices = get_template_indices ();
var o_indices = get_objects_indices ();
if (t_indices.length != 0 && o_indices.length != 0) {
AppCore.core.compose_object (t_indices[0], o_indices[0]);
}
statusbar_show ("After composing all objects print the document.");
}
[CCode (instance_pos = -1)]
public void action_edit_result_activate (Gtk.Action action) {
var indices = get_template_indices();
if (indices.length != 0) {
var lyx_path = AppCore.core.get_lyx_file_path (indices[0]);
edit_lyx_files ({ lyx_path });
}
}
void post_print () {
var indices = get_template_indices();
var pdf_file = AppCore.core.get_pdf_file_path (indices[0]);
Utils.open_document (pdf_file, window);
}
[CCode (instance_pos = -1)]
public void action_print_activate (Gtk.Action action) {
var indices = get_template_indices();
if (indices.length != 0) {
try {
subprocess_dialog.show_all (AppCore.core.print_document (indices[0]),
"=== Print to PDF file... ===\n",
post_print);
} catch (Error err) {
var msg = new MessageDialog (window, DialogFlags.MODAL, MessageType.ERROR,
ButtonsType.CLOSE, @"Error: $(err.message).");
msg.response.connect ((response_id) => { msg.destroy (); } );
msg.show ();
}
}
}
[CCode (instance_pos = -1)]
public void action_preferences_activate (Gtk.Action action) {
pref_dialog.show_all ();
}
[CCode (instance_pos = -1)]
public void action_ref_activate (Gtk.Action action) {
try {
show_uri (null, "https://redmine.backbone.ws/projects/laview/wiki", Gdk.CURRENT_TIME);
} catch (Error err) {
var msg = new MessageDialog (window, DialogFlags.MODAL, MessageType.ERROR,
ButtonsType.CLOSE, @"Error: $(err.message).");
msg.response.connect ((response_id) => { msg.destroy (); } );
msg.show ();
}
}
void edit_selected_templates () {
var indices = get_template_indices ();
if (indices.length != 0) {
string[] paths = {};
foreach (var i in indices) {
paths += AppCore.core.get_template_path_by_index (i);
}
edit_lyx_files (paths);
}
}
[CCode (instance_pos = -1)]
public void templates_row_activated (Gtk.TreeView treeview,
Gtk.TreePath path,
Gtk.TreeViewColumn column) {
edit_selected_templates ();
}
[CCode (instance_pos = -1)]
public void templates_cursor_changed (Gtk.TreeView treeview) {
var indices = get_template_indices ();
if (indices.length != 0) {
var doc_objects = AppCore.core.get_objects_list (indices[0]);
liststore_doc_objects.clear();
Gtk.TreeIter iter = Gtk.TreeIter();
foreach (var t in doc_objects) {
liststore_doc_objects.append (out iter);
liststore_doc_objects.set (iter, 0, t);
}
}
statusbar_show ("Document analized, select an object and set it's properties.");
}
[CCode (instance_pos = -1)]
public void objects_cursor_changed (Gtk.TreeView treeview) {
statusbar_show ("Press 'Properties' button to compose the object.");
}
}
}

77
src/PreferencesWindow.vala

@ -0,0 +1,77 @@
namespace LAview.Desktop {
using Gtk;
/**
* Preferences window.
*/
public class PreferencesDialog {
Dialog dialog;
Gtk.ListStore liststore_data;
Gtk.ListStore liststore_protocols;
FileChooserButton filechooserbutton_lyx;
FileChooserButton filechooserbutton_pdflatex;
public PreferencesDialog (Window parent) throws Error {
var builder = new Builder ();
builder.add_from_file (AppDirs.ui_dir + "/laview-desktop.glade");
builder.connect_signals (this);
dialog = builder.get_object ("preferences_window") as Dialog;
dialog.set_transient_for (parent);
dialog.set_modal (true);
dialog.delete_event.connect ((source) => {return true;});
liststore_data = builder.get_object ("liststore_data") as Gtk.ListStore;
liststore_protocols = builder.get_object ("liststore_protocols") as Gtk.ListStore;
filechooserbutton_lyx = builder.get_object ("filechooserbutton_lyx") as FileChooserButton;
filechooserbutton_pdflatex = builder.get_object ("filechooserbutton_pdflatex") as FileChooserButton;
fill_liststore_data ();
fill_liststore_protocols ();
filechooserbutton_lyx.set_filename (AppCore.core.lyx_path);
filechooserbutton_pdflatex.set_filename (AppCore.core.pdflatex_path);
}
void fill_liststore_data () {
var data_plugins = AppCore.core.get_data_plugins ();
liststore_data.clear();
TreeIter iter = TreeIter();
foreach (var p in data_plugins.entries) {
liststore_data.append (out iter);
liststore_data.set (iter, 0, p.value.get_readable_name ());
}
}
void fill_liststore_protocols () {
var protocol_plugins = AppCore.core.get_protocol_plugins ();
liststore_protocols.clear();
TreeIter iter = TreeIter();
foreach (var p in protocol_plugins.entries) {
liststore_protocols.append (out iter);
liststore_protocols.set (iter, 0, p.value.get_readable_name ());
}
}
public void show_all () {
dialog.show_all ();
}
[CCode (instance_pos = -1)]
public void button_close_clicked (Button button) {
dialog.hide ();
}
[CCode (instance_pos = -1)]
public void lyx_file_set (FileChooserButton chooser) {
AppCore.core.lyx_path = chooser.get_filename ();
}
[CCode (instance_pos = -1)]
public void pdflatex_file_set (FileChooserButton chooser) {
AppCore.core.pdflatex_path = chooser.get_filename ();
}
}
}

11
src/Resources.vala

@ -0,0 +1,11 @@
namespace LAview.Desktop {
class Resources {
public static Resource resource;
public static void init (string[] args) throws Error {
var resource_file = AppDirs.resource_dir+"/laview-desktop.gresource";
resource = Resource.load (resource_file);
resource._register();
}
}
}

15
src/Settings.vala

@ -0,0 +1,15 @@
namespace LAview.Desktop {
class AppSettings {
//public static GLib.Settings settings;
public static void init (string[] args) throws Error {
SettingsSchemaSource sss = new SettingsSchemaSource.from_directory (AppDirs.settings_dir, null, false);
//SettingsSchema schema = sss.lookup ("ws.backbone.laview.desktop-"+Config.VERSION_MAJOR.to_string(), false);
if (sss.lookup == null)
throw new FileError.NOENT ("Schema ID not found");
//settings = new Settings.full (schema, null, null);
}
}
}

69
src/SubprocessDialog.vala

@ -0,0 +1,69 @@
namespace LAview.Desktop {
using Gtk;
/**
* Subprocess window.
*/
public class SubprocessDialog {
Dialog dialog;
TextView textview_stderrout;
Subprocess sp;
unowned PostProcessDelegate ppdelegate;
public delegate void PostProcessDelegate ();
public SubprocessDialog (Window parent) throws Error {
var builder = new Builder ();
builder.add_from_file (AppDirs.ui_dir + "/laview-desktop.glade");
builder.connect_signals (this);
dialog = builder.get_object ("subprocess_dialog") as Dialog;
dialog.set_transient_for (parent);
dialog.set_modal (true);
dialog.delete_event.connect ((source) => {return true;});
textview_stderrout = builder.get_object ("textview_stderrout") as TextView;
}
async void subprocess_async () {
try {
var ds_out = new DataInputStream(sp.get_stdout_pipe());
try {
for (string s = yield ds_out.read_line_async(); s != null; s = yield ds_out.read_line_async())
textview_stderrout.buffer.text += s + "\n";
} catch (IOError err) {
assert_not_reached();
}
if ((sp.wait_check()) == false) throw new IOError.FAILED("Error running subprocess.");
ppdelegate ();
dialog.hide ();
} catch (Error err) {
textview_stderrout.buffer.text += @"Error: $(err.message)";
if (sp != null) {
var ds_err = new DataInputStream(sp.get_stderr_pipe());
try {
for (string s = yield ds_err.read_line_async(); s != null; s = yield ds_err.read_line_async())
textview_stderrout.buffer.text += s + "\n";
} catch (IOError err) {
assert_not_reached();
}
}
}
}
public void show_all (Subprocess sp, string message, PostProcessDelegate ppdelegate) {
this.sp = sp;
textview_stderrout.buffer.text = message;
this.ppdelegate = ppdelegate;
dialog.show_all ();
subprocess_async.begin ();
}
[CCode (instance_pos = -1)]
public void button_stop_clicked (Button button) {
sp.force_exit ();
dialog.hide ();
}
}
}

72
src/Utils.vala

@ -0,0 +1,72 @@
namespace LAview.Desktop {
namespace Utils {
using Gtk;
/**
* Resolve a path beginning with "~"
* Look at: https://github.com/ssokolow/gvrun/blob/master/process_runner.vala#L86
*/
#if (linux || UNIX || __unix__)
static string expand_tilde (string path) {
if (!path.has_prefix ("~")) return path; // Just pass paths through if they don't start with ~
// Split the ~user portion from the path (Use / for the path if not present)
string parts[2];
if (!(Path.DIR_SEPARATOR_S in path)) {
parts = { path.substring(1), Path.DIR_SEPARATOR_S };
} else {
string trimmed = path.substring(1);
parts = trimmed.split(Path.DIR_SEPARATOR_S, 2);
}
warn_if_fail(parts.length == 2);
// Handle both "~" and "~user" forms
string home_path;
if (parts[0] == "") {
home_path = Environment.get_variable("HOME") ?? Environment.get_home_dir();
} else {
unowned Posix.Passwd _pw = Posix.getpwnam(parts[0]);
home_path = (_pw == null) ? null : _pw.pw_dir;
}
// Fail safely if we couldn't look up a homedir
if (home_path == null) {
warning("Could not get homedir for user: %s", parts[0].length > 0 ? parts[0] : "<current user>");
return path;
} else {
return home_path + Path.DIR_SEPARATOR_S + parts[1];
}
}
#endif
/**
* Open document.
* Idea borrowed from: https://github.com/ssokolow/gvrun/blob/master/process_runner.vala
*/
void open_document (string path, Window? parent_window = null) {
#if (UNIX)
const string[] OPENERS = {"xdg-open", "mimeopen", "open"};
foreach (var opener in OPENERS) {
if (Environment.find_program_in_path (opener) != null) {
try {
string[] argv = { opener, expand_tilde (path) };
Process.spawn_async(null, argv, null, SpawnFlags.SEARCH_PATH, null, null);
} catch (SpawnError err) {
var msg = new MessageDialog (parent_window, DialogFlags.MODAL, MessageType.ERROR,
ButtonsType.CLOSE, @"Error: $(err.message).");
msg.response.connect ((response_id) => { msg.destroy (); } );
msg.show ();
}
break;
}
}
#elif (WINDOWS)
Posix.system (@"start $path");
#else
assert_not_reached ();
#endif
}
}
}

72
src/main.vala

@ -0,0 +1,72 @@
extern const string GETTEXT_PACKAGE;
namespace LAview.Desktop {
using Gtk, LAview.Desktop;
namespace CommandlineOptions {
// bool no_startup_progress = false;
// string data_dir = null;
bool show_version = false;
// bool no_runtime_monitoring = false;
OptionEntry[]? entries = null;
OptionEntry[] get_options() {
if (entries != null)
return entries;
// OptionEntry datadir = { "datadir", 'd', 0, OptionArg.FILENAME, &data_dir,
// N_("Path to LAview-Desktop's private data"), N_("DIRECTORY") };
// entries += datadir;
// OptionEntry no_monitoring = { "no-runtime-monitoring", 0, 0, OptionArg.NONE, &no_runtime_monitoring,
// N_("Do not monitor library directory at runtime for changes"), null };
// entries += no_monitoring;
// OptionEntry no_startup = { "no-startup-progress", 0, 0, OptionArg.NONE,
// &no_startup_progress,
// N_("Don't display startup progress meter"), null };
// entries += no_startup;
OptionEntry version = { "version", 'V', 0, OptionArg.NONE, &show_version,
N_("Show the application's version"), null };
entries += version;
OptionEntry terminator = { null, 0, 0, 0, null, null, null };
entries += terminator;
return entries;
}
}
void main (string[] args) {
try {
AppDirs.init (args);
AppSettings.init (args);
AppCore.init (args);
Resources.init (args);
Gtk.init_with_args (ref args, _("[FILE]"), CommandlineOptions.get_options (), GETTEXT_PACKAGE);
// Internationalization
Intl.bindtextdomain (GETTEXT_PACKAGE, AppDirs.locale_dir);
Intl.bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
var main_window = new MainWindow ();
main_window.show_all ();
Gtk.main ();
} catch (Error e) {
stderr.printf (_("Error: %s\n"), e.message);
stderr.printf (_("Run '%s --help' to see a full list of available command line options.\n"), args[0]);
}
AppDirs.terminate();
return;
}
}

0
test/CMakeLists.txt

1
ui/CMakeLists.txt

@ -0,0 +1 @@
ADD_SUBDIRECTORY (glade)

2
ui/glade/CMakeLists.txt

@ -0,0 +1,2 @@
SET (GladeFile ${PROJECT_LOWERCASE_NAME})
INCLUDE (GladeCommonRules)

1134
ui/glade/laview-desktop.glade
File diff suppressed because it is too large
View File

1
util/backbone

@ -0,0 +1 @@
Subproject commit 11c998aca2aa1b787286b336e579e5a4e31f471a

2
valadoc_env

@ -0,0 +1,2 @@
BASEDIR=src config
PKGS=gtk+-3.0 laview-core-0 laview-core-iface-0 gobject-plugin-iface-0 gobject-plugin-loader-0 gmodule-2.0 gee-0.8
Loading…
Cancel
Save