From e8ed782e1c6ec3a3e333949cb515fea54a15b3bb Mon Sep 17 00:00:00 2001 From: Kolan Sh Date: Mon, 18 Jun 2018 12:12:45 +0300 Subject: [PATCH] Squashed commit of the following: commit d637633290c6d07d3a0552a738bb2350d5ad0daf Author: Kolan Sh Date: Tue May 8 19:26:54 2018 +0300 Fix GSchema with custom plugins directories. + Separate Settings.vala. commit c9963cd9f78502ee3d91d647fd0b02b6fef782d8 Author: Kolan Sh Date: Mon Apr 30 17:35:51 2018 +0300 URLs, captions fixed. commit ebd71aa5520416fba3f79c71430ad0e8bd006384 Author: Kolan Sh Date: Sat Apr 28 19:07:03 2018 +0300 Spare Plugin, Core keywords removed from identifiers. commit 2b72b6b0b19957c9b3884e2a08e89aaee7f232de Author: Kolan Sh Date: Sat Apr 28 10:26:49 2018 +0300 Valadoc fixes. commit 308dee423268860fcb37ae7965d89406e6568d32 Author: Kolan Sh Date: Fri Apr 27 18:03:34 2018 +0300 ObjectExample Dialog [Preferences Button] -> Preferences Dialog. commit a846158937bf88151b3d8e1b318748650b8db043 Author: Kolan Sh Date: Fri Apr 27 17:33:33 2018 +0300 Fix UI Glade file. commit d21729d16de24ea36a884bf3bcf0141044bf87fc Author: Kolan Sh Date: Fri Apr 27 17:28:07 2018 +0300 PreferencesDialog added commit acd8e1e6bf5b8e206eaeca2c76ba4b7f19466dbf Author: Kolan Sh Date: Fri Apr 27 16:23:37 2018 +0300 UI file updated. commit f987024016532911e8e48e8ce3e7a68e6b471912 Author: Kolan Sh Date: Fri Apr 27 15:02:56 2018 +0300 Conflicting AppDirs fxd. commit 75f8ecc06e50ab2c76fbe912b8bc27c0b0ed5fe9 Author: Kolan Sh Date: Thu Apr 26 16:38:55 2018 +0300 PluginObject.preferences() added. commit d0f518049f935931ac6f980ef7c6d267c63f7ac8 Author: Kolan Sh Date: Thu Mar 29 10:52:35 2018 +0300 submodules URLs updated. commit 954073e68e7f5c13a719014b2131051944eba7b4 Author: Kolan Sh Date: Tue Feb 13 23:27:42 2018 +0300 lib != lib64, lib != lib32 commit 16f081420846410b0cd4a7da972453e7caec75fd Author: Kolan Sh Date: Tue Dec 19 08:52:31 2017 +0300 Module cmake/backbone updated: Check BinPkgModules for empty value. commit aefe2404e6918abff1f34143934920e274f98a89 Author: Kolan Sh Date: Sat Feb 18 18:12:45 2017 +0300 Backbone's submodules urls fixed. commit 036c79e9e30a363f5bebd55ec178887354ef20bf Author: Kolan Sh Date: Thu Dec 8 04:17:13 2016 +0300 Valadoc fxd. commit 111805ad73a50c1a3ffc73d9c90a7262cd6dd04c Author: Kolan Sh Date: Thu Dec 8 04:16:52 2016 +0300 util/backbone submodule udpated: valadoc commit 155b3e1a1a11cbbe30b66aa88d09734e68b36838 Author: Kolan Sh Date: Wed Dec 7 19:00:13 2016 +0300 cmake/backbone submodule updated: Override NSIS.InstallOptions only if needed. commit 37652bedfde49ac17ae30f59538bc16a2930d87e Author: Kolan Sh Date: Fri Sep 2 18:47:44 2016 +0300 cmake/backbone submodule updated: dlls regresion fxd. commit 70f6158c091303ab531154de3228e6730f998922 Author: Kolan Sh Date: Tue Aug 9 18:22:00 2016 +0300 cmake/backbone submodule: get_library_path(): uninitialized hCurrentModuleInstance + make it static. commit 606013daef68852f81544b7eb8740148b97fae22 Author: Kolan Sh Date: Tue Jun 21 13:32:05 2016 +0300 Show paths. commit 29817dd27b23aa7e934795ff242c70482a1667fa Author: Kolan Sh Date: Fri Apr 8 03:18:56 2016 +0300 Homepage menu link added. commit 5800e4f331f62c61262bc510956c226e250f5d2d Author: Kolan Sh Date: Sat Nov 14 12:50:00 2015 +0300 --- .gitmodules | 6 + AUTHORS | 1 + CMakeLists.txt | 22 ++ COPYING | 165 ++++++++++ INSTALL | 85 +++++ MAINTAINERS | 2 + README | 2 +- cmake/backbone | 1 + config/CMakeLists.txt | 5 + config/Config.vapi | 6 + config/config.h.in | 3 + ...backbone.laview.object-example.gschema.xml | 23 ++ cpack/CMakeLists.txt | 10 + po/CMakeLists.txt | 1 + po/laview-object-example.pot | 89 ++++++ po/ru/CMakeLists.txt | 1 + po/ru/laview-object-example.po | 90 ++++++ src/CMakeLists.txt | 1 + src/laview-core/CMakeLists.txt | 1 + src/laview-core/object-plugins/AppDirs.vala | 34 ++ src/laview-core/object-plugins/CMakeLists.txt | 17 + .../object-plugins/ObjectDialog.vala | 62 ++++ .../object-plugins/PreferencesDialog.vala | 47 +++ src/laview-core/object-plugins/Settings.vala | 35 +++ src/laview-core/object-plugins/main.vala | 110 +++++++ test/CMakeLists.txt | 0 ui/CMakeLists.txt | 1 + ui/glade/CMakeLists.txt | 2 + ui/glade/laview-object-example.glade | 295 ++++++++++++++++++ util/backbone | 1 + valadoc_env | 2 + 31 files changed, 1119 insertions(+), 1 deletion(-) create mode 100644 .gitmodules create mode 100644 AUTHORS create mode 100644 CMakeLists.txt create mode 100644 COPYING create mode 100644 INSTALL create mode 100644 MAINTAINERS create mode 160000 cmake/backbone create mode 100644 config/CMakeLists.txt create mode 100644 config/Config.vapi create mode 100644 config/config.h.in create mode 100644 config/ws.backbone.laview.object-example.gschema.xml create mode 100644 cpack/CMakeLists.txt create mode 100644 po/CMakeLists.txt create mode 100644 po/laview-object-example.pot create mode 100644 po/ru/CMakeLists.txt create mode 100644 po/ru/laview-object-example.po create mode 100644 src/CMakeLists.txt create mode 100644 src/laview-core/CMakeLists.txt create mode 100644 src/laview-core/object-plugins/AppDirs.vala create mode 100644 src/laview-core/object-plugins/CMakeLists.txt create mode 100644 src/laview-core/object-plugins/ObjectDialog.vala create mode 100644 src/laview-core/object-plugins/PreferencesDialog.vala create mode 100644 src/laview-core/object-plugins/Settings.vala create mode 100644 src/laview-core/object-plugins/main.vala create mode 100644 test/CMakeLists.txt create mode 100644 ui/CMakeLists.txt create mode 100644 ui/glade/CMakeLists.txt create mode 100644 ui/glade/laview-object-example.glade create mode 160000 util/backbone create mode 100644 valadoc_env diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..b77187f --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "cmake/backbone"] + path = cmake/backbone + url = git@git.backbone.ws:kolan/cmake.backbone.git +[submodule "util/backbone"] + path = util/backbone + url = git@git.backbone.ws:kolan/cmake.backbone-utils.git diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..609258d --- /dev/null +++ b/AUTHORS @@ -0,0 +1 @@ +Kolan Sh diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..6e95592 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,22 @@ +PROJECT (LAviewObjectExample C) + +CMAKE_MINIMUM_REQUIRED (VERSION 2.8) + +SET (PROJECT_LOWERCASE_NAME "laview-object-example") +SET (PROJECT_DESCRIPTION "LAview Plugin Protocol Object Example.") + +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 (test) +ADD_SUBDIRECTORY (cpack) +ADD_SUBDIRECTORY (ui) + +# enable testing +ENABLE_TESTING () diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..65c5ca8 --- /dev/null +++ b/COPYING @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + 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. diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..067530d --- /dev/null +++ b/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. diff --git a/MAINTAINERS b/MAINTAINERS new file mode 100644 index 0000000..f2b408a --- /dev/null +++ b/MAINTAINERS @@ -0,0 +1,2 @@ +Kolan Sh +email: backbone@backbone.ws diff --git a/README b/README index 5163cd7..2f56796 100644 --- a/README +++ b/README @@ -1 +1 @@ -LAview protocol plugin sample. +LAview protocol object plugin sample. diff --git a/cmake/backbone b/cmake/backbone new file mode 160000 index 0000000..cd1394c --- /dev/null +++ b/cmake/backbone @@ -0,0 +1 @@ +Subproject commit cd1394cb27b229c618524759f91ac765e80413aa diff --git a/config/CMakeLists.txt b/config/CMakeLists.txt new file mode 100644 index 0000000..9ceffcf --- /dev/null +++ b/config/CMakeLists.txt @@ -0,0 +1,5 @@ +CONFIGURE_FILE ("${CMAKE_CURRENT_SOURCE_DIR}/config.h.in" + "${CMAKE_CURRENT_BINARY_DIR}/config.h") + +SET (GSchemaFile "ws.backbone.laview.object-example") +INCLUDE (GSchemaCommonRules) diff --git a/config/Config.vapi b/config/Config.vapi new file mode 100644 index 0000000..5158417 --- /dev/null +++ b/config/Config.vapi @@ -0,0 +1,6 @@ +[CCode (cheader_filename = "config.h")] +namespace Config { + const int VERSION_MAJOR; + const int VERSION_MINOR; + const int VERSION_PATCH; +} diff --git a/config/config.h.in b/config/config.h.in new file mode 100644 index 0000000..3c66f33 --- /dev/null +++ b/config/config.h.in @@ -0,0 +1,3 @@ +#define CONFIG_VERSION_MAJOR @MAJOR@ +#define CONFIG_VERSION_MINOR @MINOR@ +#define CONFIG_VERSION_PATCH @PATCH@ diff --git a/config/ws.backbone.laview.object-example.gschema.xml b/config/ws.backbone.laview.object-example.gschema.xml new file mode 100644 index 0000000..01518ad --- /dev/null +++ b/config/ws.backbone.laview.object-example.gschema.xml @@ -0,0 +1,23 @@ + + + + + "Hello, earthlings" + A greeting + Greeting of the invading martians + + + + 99 + Bottles of beer + Number of bottles of beer on the wall + + + + false + Is the light switched on? + State of an imaginary light switch. + + + + diff --git a/cpack/CMakeLists.txt b/cpack/CMakeLists.txt new file mode 100644 index 0000000..9f77229 --- /dev/null +++ b/cpack/CMakeLists.txt @@ -0,0 +1,10 @@ +SET (CONTACT "backbone@backbone.ws") +SET (DEBIAN_DEPENDENCIES "laview-core-0 >= 0.0.0, laview-data-example-0 (>= 0.0.0)") +SET (DEBIAN_SECTION "TeX") +SET (REDHAT_DEPENDENCIES "laview-core-0 >= 0.0.0, laview-data-example-0 >= 0.0.0") +SET (REDHAT_SECTION "Applications/Publishing") +SET (LICENSE "LGPLv3+") +SET (WIN32_UNINSTALL_NAME "LAvPlOEx") # <= 8 symbols for the name +SET (CPACK_NSIS_MENU_LINKS "https://git.backbone.ws/kolan/LAview.Object-Example" + "Homepage for LAview/Object-Example") +INCLUDE (CPackCommonRules) diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt new file mode 100644 index 0000000..c191c1b --- /dev/null +++ b/po/CMakeLists.txt @@ -0,0 +1 @@ +INCLUDE (GettextCommonRules) diff --git a/po/laview-object-example.pot b/po/laview-object-example.pot new file mode 100644 index 0000000..dbc4587 --- /dev/null +++ b/po/laview-object-example.pot @@ -0,0 +1,89 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the laview-object-example package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: laview-object-example\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-04-28 18:59+0300\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: build-gcc/share/glib-2.0/schemas/ws.backbone.laview.object-example-0.gschema.xml.h:1 +#: config/ws.backbone.laview.object-example.gschema.xml.h:1 +msgid "\"Hello, earthlings\"" +msgstr "" + +#: build-gcc/share/glib-2.0/schemas/ws.backbone.laview.object-example-0.gschema.xml.h:2 +#: config/ws.backbone.laview.object-example.gschema.xml.h:2 +msgid "A greeting" +msgstr "" + +#: build-gcc/share/glib-2.0/schemas/ws.backbone.laview.object-example-0.gschema.xml.h:3 +#: config/ws.backbone.laview.object-example.gschema.xml.h:3 +msgid "Greeting of the invading martians" +msgstr "" + +#: build-gcc/share/glib-2.0/schemas/ws.backbone.laview.object-example-0.gschema.xml.h:4 +#: config/ws.backbone.laview.object-example.gschema.xml.h:4 +msgid "Bottles of beer" +msgstr "" + +#: build-gcc/share/glib-2.0/schemas/ws.backbone.laview.object-example-0.gschema.xml.h:5 +#: config/ws.backbone.laview.object-example.gschema.xml.h:5 +msgid "Number of bottles of beer on the wall" +msgstr "" + +#: build-gcc/share/glib-2.0/schemas/ws.backbone.laview.object-example-0.gschema.xml.h:6 +#: config/ws.backbone.laview.object-example.gschema.xml.h:6 +msgid "Is the light switched on?" +msgstr "" + +#: build-gcc/share/glib-2.0/schemas/ws.backbone.laview.object-example-0.gschema.xml.h:7 +#: config/ws.backbone.laview.object-example.gschema.xml.h:7 +msgid "State of an imaginary light switch." +msgstr "" + +#: src/main.vala:44 +msgid "Protocol Object Example" +msgstr "" + +#: ui/glade/laview-object-example.glade.h:1 +msgid "Object Example Protocol" +msgstr "" + +#: ui/glade/laview-object-example.glade.h:2 +msgid "Any" +msgstr "" + +#: ui/glade/laview-object-example.glade.h:3 +msgid "Controls" +msgstr "" + +#: ui/glade/laview-object-example.glade.h:4 +msgid "Here" +msgstr "" + +#: ui/glade/laview-object-example.glade.h:5 +msgid "Object Example Plugin Preferences" +msgstr "" + +#: ui/glade/laview-object-example.glade.h:6 +msgid "...settings..." +msgstr "" + +#: ui/glade/laview-object-example.glade.h:7 +msgid "...preferences..." +msgstr "" + +#: ui/glade/laview-object-example.glade.h:8 +msgid "...properties..." +msgstr "" diff --git a/po/ru/CMakeLists.txt b/po/ru/CMakeLists.txt new file mode 100644 index 0000000..0b6020c --- /dev/null +++ b/po/ru/CMakeLists.txt @@ -0,0 +1 @@ +INCLUDE (GettextLangRules) diff --git a/po/ru/laview-object-example.po b/po/ru/laview-object-example.po new file mode 100644 index 0000000..b9a4697 --- /dev/null +++ b/po/ru/laview-object-example.po @@ -0,0 +1,90 @@ +# Russian translations for laview-object-example package. +# Copyright (C) 2015 THE laview-object-example'S COPYRIGHT HOLDER +# This file is distributed under the same license as the laview-object-example package. +# , 2015. +# +msgid "" +msgstr "" +"Project-Id-Version: laview-object-example\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-04-28 18:59+0300\n" +"PO-Revision-Date: 2015-11-09 15:51+0300\n" +"Last-Translator: \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" + +#: build-gcc/share/glib-2.0/schemas/ws.backbone.laview.object-example-0.gschema.xml.h:1 +#: config/ws.backbone.laview.object-example.gschema.xml.h:1 +msgid "\"Hello, earthlings\"" +msgstr "" + +#: build-gcc/share/glib-2.0/schemas/ws.backbone.laview.object-example-0.gschema.xml.h:2 +#: config/ws.backbone.laview.object-example.gschema.xml.h:2 +msgid "A greeting" +msgstr "" + +#: build-gcc/share/glib-2.0/schemas/ws.backbone.laview.object-example-0.gschema.xml.h:3 +#: config/ws.backbone.laview.object-example.gschema.xml.h:3 +msgid "Greeting of the invading martians" +msgstr "" + +#: build-gcc/share/glib-2.0/schemas/ws.backbone.laview.object-example-0.gschema.xml.h:4 +#: config/ws.backbone.laview.object-example.gschema.xml.h:4 +msgid "Bottles of beer" +msgstr "" + +#: build-gcc/share/glib-2.0/schemas/ws.backbone.laview.object-example-0.gschema.xml.h:5 +#: config/ws.backbone.laview.object-example.gschema.xml.h:5 +msgid "Number of bottles of beer on the wall" +msgstr "" + +#: build-gcc/share/glib-2.0/schemas/ws.backbone.laview.object-example-0.gschema.xml.h:6 +#: config/ws.backbone.laview.object-example.gschema.xml.h:6 +msgid "Is the light switched on?" +msgstr "" + +#: build-gcc/share/glib-2.0/schemas/ws.backbone.laview.object-example-0.gschema.xml.h:7 +#: config/ws.backbone.laview.object-example.gschema.xml.h:7 +msgid "State of an imaginary light switch." +msgstr "" + +#: src/main.vala:44 +msgid "Protocol Object Example" +msgstr "Пример объекта протокола" + +#: ui/glade/laview-object-example.glade.h:1 +msgid "Object Example Protocol" +msgstr "Протокол примера объекта" + +#: ui/glade/laview-object-example.glade.h:2 +msgid "Any" +msgstr "" + +#: ui/glade/laview-object-example.glade.h:3 +msgid "Controls" +msgstr "" + +#: ui/glade/laview-object-example.glade.h:4 +msgid "Here" +msgstr "" + +#: ui/glade/laview-object-example.glade.h:5 +msgid "Object Example Plugin Preferences" +msgstr "Настройки плагина примера объекта" + +#: ui/glade/laview-object-example.glade.h:6 +msgid "...settings..." +msgstr "...настройки..." + +#: ui/glade/laview-object-example.glade.h:7 +msgid "...preferences..." +msgstr "...параметры..." + +#: ui/glade/laview-object-example.glade.h:8 +msgid "...properties..." +msgstr "...свойства..." diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..3ba34db --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1 @@ +ADD_SUBDIRECTORY (laview-core) diff --git a/src/laview-core/CMakeLists.txt b/src/laview-core/CMakeLists.txt new file mode 100644 index 0000000..ec8ad2d --- /dev/null +++ b/src/laview-core/CMakeLists.txt @@ -0,0 +1 @@ +ADD_SUBDIRECTORY (object-plugins) diff --git a/src/laview-core/object-plugins/AppDirs.vala b/src/laview-core/object-plugins/AppDirs.vala new file mode 100644 index 0000000..2283ec3 --- /dev/null +++ b/src/laview-core/object-plugins/AppDirs.vala @@ -0,0 +1,34 @@ +namespace Get { + extern void library_path (string so_path, void *addr); +} + +namespace LAview.ObjectExample { + + class AppDirs : Object { + + public static File so_path; + public static File exec_dir; + public static File common_dir; + public static string ui_dir; + public static string settings_dir; + + public static void init () { + char _so_path[256]; + Get.library_path ((string)_so_path, (void*)init); + so_path = File.new_for_path ((string)_so_path); + exec_dir = so_path.get_parent (); + common_dir = exec_dir.get_parent (); + common_dir = common_dir.get_parent().get_parent(); + ui_dir = Path.build_path (Path.DIR_SEPARATOR_S, common_dir.get_path(), + "share/laview-object-example-"+Config.VERSION_MAJOR.to_string()+"/ui"); + stdout.printf ("Vala:so_path=%s\n", so_path.get_path()); + settings_dir = Path.build_path (Path.DIR_SEPARATOR_S, common_dir.get_path(), "share/glib-2.0/schemas"); + stdout.printf ("ui_dir = %s\n", ui_dir); + stdout.printf ("settings_dir = %s\n", settings_dir); + + } + + public static void terminate () { + } + } +} diff --git a/src/laview-core/object-plugins/CMakeLists.txt b/src/laview-core/object-plugins/CMakeLists.txt new file mode 100644 index 0000000..d5f7f71 --- /dev/null +++ b/src/laview-core/object-plugins/CMakeLists.txt @@ -0,0 +1,17 @@ +SET (LibName laview-object-example) +FILE (GLOB_RECURSE LibSources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.vala) +SET (LibPackages gtk+-3.0 gee-0.8 gobject-plugin-iface-0 laview-core-iface-0 laview-core-0 laview-data-example-0) +SET (LibPkgModules gtk+-3.0 gee-0.8 gobject-plugin-0 laview-core-0) +IF (WIN32) + SET (LibPkgModules ${LibPkgModules} laview-data-example-0) +ENDIF (WIN32) +SET (LibCustomVapis ${CMAKE_SOURCE_DIR}/config/Config.vapi) +INCLUDE_DIRECTORIES ("${CMAKE_BINARY_DIR}/config") +SET (LibIsPlugin ON) +SET (LibInstall ON) +SET (LibNoApi ON) +SET (LibExtraSources ${CMAKE_CURRENT_BINARY_DIR}/library_constructor.c) +SET (LC_RELATIVE_PREFIX "../../../..") +CONFIGURE_FILE ( "${CMAKE_SOURCE_DIR}/cmake/backbone/templates/library_constructor.c.in" "${LibExtraSources}") +SET (LibInstallPrefix "laview-core-0/object-plugins") +INCLUDE (ValaLibCommonRules) diff --git a/src/laview-core/object-plugins/ObjectDialog.vala b/src/laview-core/object-plugins/ObjectDialog.vala new file mode 100644 index 0000000..8e72a50 --- /dev/null +++ b/src/laview-core/object-plugins/ObjectDialog.vala @@ -0,0 +1,62 @@ +namespace LAview.ObjectExample { + using Gtk, LAview; + + class MainDialog : Object { + Dialog dialog; + PreferencesDialog preferences_dialog; + + public bool composed { get; private set; default = false; } + + public MainDialog (Object parent) throws Error { + var builder = new Builder (); + builder.add_from_file (AppDirs.ui_dir + "/laview-object-example.glade"); + builder.connect_signals (this); + + dialog = builder.get_object ("object_example_dialog") as Dialog; + if (parent is Window) { + dialog.destroy_with_parent = true; + dialog.transient_for = parent as Window; + dialog.modal = true; + dialog.delete_event.connect ((source) => { + dialog.hide_on_delete(); + return true; + }); + } + } + + public void show_all () { + composed = false; + dialog.run (); + } + + [CCode (instance_pos = -1)] + public void button_apply_clicked (Button button) { + composed = true; + } + + [CCode (instance_pos = -1)] + public void button_ok_clicked (Button button) { + composed = true; + dialog.hide (); + } + + [CCode (instance_pos = -1)] + public void button_cancel_clicked (Button button) { + dialog.hide (); + } + + [CCode (instance_pos = -1)] + public void button_preferences_clicked (Button button) { + if (preferences_dialog == null) + try { + preferences_dialog = new PreferencesDialog (dialog); + } catch (Error err) { + var msg = new MessageDialog (dialog, DialogFlags.MODAL, MessageType.ERROR, + ButtonsType.CLOSE, _("Error: ")+err.message); + msg.response.connect ((response_id) => { msg.destroy (); } ); + msg.show (); + } + preferences_dialog.show_all (); + } + } +} diff --git a/src/laview-core/object-plugins/PreferencesDialog.vala b/src/laview-core/object-plugins/PreferencesDialog.vala new file mode 100644 index 0000000..79fd374 --- /dev/null +++ b/src/laview-core/object-plugins/PreferencesDialog.vala @@ -0,0 +1,47 @@ +namespace LAview.ObjectExample { + using Gtk, LAview; + + class PreferencesDialog : GLib.Object { + Dialog dialog; + + public bool apply { get; private set; default = false; } + + public PreferencesDialog (Object parent) throws Error { + var builder = new Builder (); + builder.add_from_file (AppDirs.ui_dir + "/laview-object-example.glade"); + builder.connect_signals (this); + + dialog = builder.get_object ("preferences_dialog") as Dialog; + if (parent is Window) { + dialog.destroy_with_parent = true; + dialog.transient_for = parent as Window; + dialog.modal = true; + dialog.delete_event.connect ((source) => { + dialog.hide_on_delete(); + return true; + }); + } + } + + public void show_all () { + apply = false; + dialog.run (); + } + + [CCode (instance_pos = -1)] + public void button_apply_clicked (Button button) { + apply = true; + } + + [CCode (instance_pos = -1)] + public void button_ok_clicked (Button button) { + apply = true; + dialog.hide (); + } + + [CCode (instance_pos = -1)] + public void button_cancel_clicked (Button button) { + dialog.hide (); + } + } +} diff --git a/src/laview-core/object-plugins/Settings.vala b/src/laview-core/object-plugins/Settings.vala new file mode 100644 index 0000000..0583e32 --- /dev/null +++ b/src/laview-core/object-plugins/Settings.vala @@ -0,0 +1,35 @@ +namespace LAview.ObjectExample { + + public class AppSettings : Object { + Settings settings; + + string _greeting; + + public string greeting { + get { return _greeting; } + set { + if (settings != null) settings.set_string ("greeting", value); + _greeting = value; + } + default = "lyx"; + } + + public AppSettings () throws Error { + string schema_file = AppDirs.settings_dir+"/gschemas.compiled"; + if (!File.new_for_path (schema_file).query_exists ()) + throw new IOError.NOT_FOUND ("File "+schema_file+" not found"); + SettingsSchemaSource sss = new SettingsSchemaSource.from_directory (AppDirs.settings_dir, null, false); + string schema_name = "ws.backbone.laview.object-example-"+Config.VERSION_MAJOR.to_string(); + SettingsSchema schema = sss.lookup (schema_name, false); + if (schema == null) { + throw new IOError.NOT_FOUND ("Schema "+schema_name+" not found in "+schema_file); + } + settings = new Settings.full (schema, null, null); + + _greeting = settings.get_string("greeting"); + settings.changed["greeting"].connect (() => { + _greeting = settings.get_string("greeting"); + }); + } + } +} diff --git a/src/laview-core/object-plugins/main.vala b/src/laview-core/object-plugins/main.vala new file mode 100644 index 0000000..e103f7a --- /dev/null +++ b/src/laview-core/object-plugins/main.vala @@ -0,0 +1,110 @@ +using LAview, Core, GObject.Plugins; + +extern const string GETTEXT_PACKAGE; + +namespace LAview.ObjectExample { + /** + * Object Plugin Example. + */ + public class Plugin : PluginObject { + + MainDialog object_dialog = null; + ObjectExample.PreferencesDialog preferences_dialog = null; + AppSettings settings; + + /** + * Constructs a new ``Plugin``. + */ + construct { + stdout.puts ("ObjectExample.Plugin init () called\n"); + AppDirs.init (); + try { + settings = new AppSettings(); + } catch (Error err) { + stderr.printf("Error: %s\n", err.message); + } + } + + /** + * Destroys the ``Plugin``. + */ + ~Plugin () { + stdout.puts ("ObjectExample.Plugin deinit () called\n"); + } + + /** + * Gets a name of the plugin. + */ + public override string get_name () { + return "ProtObjEx"; + } + + /** + * Gets readable name of the plugin. + */ + public override string get_readable_name () { + stdout.puts ("ObjectExample.Plugin.get_readable_name () called\n"); + stdout.puts ("Call IHostCore.get_cache_dir () from ObjectExample.Plugin:\n "); + var cache_dir = (host as IHostCore).get_cache_dir (); + stdout.printf ("cache dir = %s\n", cache_dir); + return _("Protocol Object Example"); + } + + /** + * Compose the object. + */ + public override bool compose (Object parent, Gee.HashMap answers) throws Error { + if (object_dialog == null) object_dialog = new MainDialog (parent); + + object_dialog.show_all (); + + var data_obj_ex = (host as IHostCore).get_data_object ("DataExample") as LAview.DataExample.Plugin; + + stdout.puts ("Compose() called\n"); + + foreach (var a in answers.entries) { + switch (a.key) { + case "MainChart": + break; + + case "arr1d": + if (a.value is AnswerArray1D) + (a.value as AnswerArray1D).value = data_obj_ex.get_array1d_data (a.key); + break; + + case "arr2d": + if (a.value is AnswerArray2D) + (a.value as AnswerArray2D).value = data_obj_ex.get_array2d_data (a.key); + break; + + case "AnotherRequest": + case "SampleRequest": + case "Manual.SampleRequest": + if (a.value is AnswerString) + (a.value as AnswerString).value = data_obj_ex.get_string_data (a.key); + break; + + default: + break; + } + } + + return object_dialog.composed; + } + + /** + * Open Preferences. + */ + public override void preferences (Object parent) throws Error { + if (preferences_dialog == null) preferences_dialog = new ObjectExample.PreferencesDialog (parent); + + preferences_dialog.show_all (); + } + } +} + +[ModuleInit] +Type plugin_init (GLib.TypeModule type_module) { + stdout.puts ("---ModuleInit called()---\n"); + return typeof (LAview.ObjectExample.Plugin); +} diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 0000000..e69de29 diff --git a/ui/CMakeLists.txt b/ui/CMakeLists.txt new file mode 100644 index 0000000..fc14716 --- /dev/null +++ b/ui/CMakeLists.txt @@ -0,0 +1 @@ +ADD_SUBDIRECTORY (glade) diff --git a/ui/glade/CMakeLists.txt b/ui/glade/CMakeLists.txt new file mode 100644 index 0000000..548088d --- /dev/null +++ b/ui/glade/CMakeLists.txt @@ -0,0 +1,2 @@ +SET (GladeFile ${PROJECT_LOWERCASE_NAME}) +INCLUDE (GladeCommonRules) diff --git a/ui/glade/laview-object-example.glade b/ui/glade/laview-object-example.glade new file mode 100644 index 0000000..0e409a0 --- /dev/null +++ b/ui/glade/laview-object-example.glade @@ -0,0 +1,295 @@ + + + + + + False + Object Example Protocol + dialog + + + False + vertical + 2 + + + False + end + + + gtk-preferences + True + True + True + True + True + + + + True + True + 0 + + + + + gtk-apply + True + True + True + True + True + + + + True + True + 1 + + + + + gtk-ok + True + True + True + True + True + + + + True + True + 2 + + + + + gtk-undo + True + True + True + True + True + + + + True + True + 3 + + + + + False + False + 0 + + + + + True + False + vertical + + + True + False + Object Example Protocol + + + + + + True + True + 0 + + + + + True + False + Any + + + True + True + 1 + + + + + True + False + Controls + + + True + True + 2 + + + + + True + False + Here + + + True + True + 3 + + + + + True + True + 1 + + + + + + + + + + False + Object Example Protocol Preferences + dialog + + + False + vertical + 2 + + + False + end + + + gtk-apply + True + True + True + True + True + + + + True + True + 0 + + + + + gtk-ok + True + True + True + True + True + + + + True + True + 1 + + + + + gtk-undo + True + True + True + True + True + + + + True + True + 2 + + + + + False + False + 0 + + + + + True + False + vertical + + + True + False + Object Example Plugin Preferences + + + + + + True + True + 0 + + + + + True + False + ...settings... + + + True + True + 1 + + + + + True + False + ...preferences... + + + True + True + 2 + + + + + True + False + ...properties... + + + True + True + 3 + + + + + True + True + 1 + + + + + + + + + diff --git a/util/backbone b/util/backbone new file mode 160000 index 0000000..11c998a --- /dev/null +++ b/util/backbone @@ -0,0 +1 @@ +Subproject commit 11c998aca2aa1b787286b336e579e5a4e31f471a diff --git a/valadoc_env b/valadoc_env new file mode 100644 index 0000000..0c9486b --- /dev/null +++ b/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-iface-0 laview-plugin-data-example-0 gmodule-2.0 gee-0.8