1
0
Fork 0

Squashed commit of the following:

commit ccf7c4f373
Author: Kolan Sh <backbone@backbone.ws>
Date:   Tue May 8 19:27:07 2018 +0300

    Fix GSchema with custom plugins directories. + Separate Settings.vala.

commit 8928e10ee2
Author: Kolan Sh <backbone@backbone.ws>
Date:   Mon Apr 30 17:35:45 2018 +0300

    URLs, captions fixed.

commit bdaa3d451a
Author: Kolan Sh <backbone@backbone.ws>
Date:   Sat Apr 28 18:54:36 2018 +0300

    PreferenceDialog: composed->apply.

commit f684d90586
Author: Kolan Sh <backbone@backbone.ws>
Date:   Sat Apr 28 18:47:01 2018 +0300

    Translations updated.

commit d17fcdb029
Author: Kolan Sh <backbone@backbone.ws>
Date:   Sat Apr 28 18:38:18 2018 +0300

    win32: menu url links fxd.

commit 75e53c2e75
Author: Kolan Sh <backbone@backbone.ws>
Date:   Sat Apr 28 17:14:10 2018 +0300

    GObject-Plugin: Different load methods: load_modules(), load_modules_depth2().

commit 04c512b36f
Author: Kolan Sh <backbone@backbone.ws>
Date:   Sat Apr 28 15:03:22 2018 +0300

    Spare Plugin, Core keywords removed from identifiers.

commit cc0edbab09
Author: Kolan Sh <backbone@backbone.ws>
Date:   Sat Apr 28 10:26:54 2018 +0300

    Valadoc fixes.

commit 1ace70831f
Author: Kolan Sh <backbone@backbone.ws>
Date:   Fri Apr 27 17:23:30 2018 +0300

    spare code removed

commit ae35b77787
Author: Kolan Sh <backbone@backbone.ws>
Date:   Fri Apr 27 16:48:32 2018 +0300

    DataExampleDialog->DataExample.PreferencesDialog

commit db1e427c98
Author: Kolan Sh <backbone@backbone.ws>
Date:   Fri Apr 27 16:23:17 2018 +0300

    UI file updated.

commit 71e07e82e2
Author: Kolan Sh <backbone@backbone.ws>
Date:   Fri Apr 27 15:01:54 2018 +0300

    Conflicting AppDirs fxd.

commit 473abfa1e3
Author: Kolan Sh <backbone@backbone.ws>
Date:   Fri Apr 27 10:18:20 2018 +0300

    Plugin.{Data,Object}.preferences(): show preferences window.

commit 13f5cf753f
Author: Kolan Sh <backbone@backbone.ws>
Date:   Thu Apr 26 16:39:05 2018 +0300

    PluginData.preferences() added.

commit 62bd6e311e
Author: Kolan Sh <backbone@backbone.ws>
Date:   Thu Mar 29 10:51:43 2018 +0300

    submodules URLs updated.

commit eab83e0bd9
Author: Kolan Sh <backbone@backbone.ws>
Date:   Tue Feb 13 23:26:39 2018 +0300

    lib != lib64, lib != lib32

commit 66035c1fe2
Author: Kolan Sh <backbone@backbone.ws>
Date:   Tue Dec 19 08:53:21 2017 +0300

    Module cmake/backbone updated: Check BinPkgModules for empty value.

commit 263efa0d35
Author: Kolan Sh <backbone@backbone.ws>
Date:   Sat Feb 18 18:12:05 2017 +0300

    Backbone's submodules urls fixed.

commit fa8fb4098a
Author: Kolan Sh <backbone@backbone.ws>
Date:   Thu Dec 8 04:19:50 2016 +0300

    Valadoc fxd.

commit 4fc1ba8d29
Author: Kolan Sh <backbone@backbone.ws>
Date:   Thu Dec 8 04:16:30 2016 +0300

    util/backbone submodule udpated: valadoc

commit 46df962282
Author: Kolan Sh <backbone@backbone.ws>
Date:   Wed Dec 7 18:58:41 2016 +0300

    cmake/backbone submodule updated: Override NSIS.InstallOptions only if needed.

commit 819855fd7f
Author: Kolan Sh <backbone@backbone.ws>
Date:   Fri Sep 2 18:47:29 2016 +0300

    cmake/backbone submodule updated: dlls regresion fxd.

commit 24f8dd82e2
Author: Kolan Sh <backbone@backbone.ws>
Date:   Tue Aug 9 18:21:37 2016 +0300

    cmake/backbone submodule: get_library_path(): uninitialized hCurrentModuleInstance + make it static.

commit 889d605f37
Author: Kolan Sh <backbone@backbone.ws>
Date:   Tue Jun 21 16:14:07 2016 +0300

    Homepage menu link added.

commit 262dac3925
Author: Kolan Sh <backbone@backbone.ws>
Date:   Sat Nov 14 12:50:05 2015 +0300
This commit is contained in:
Kolan Sh 2018-06-18 12:10:10 +03:00
parent fc285cdce5
commit 68b6703a13
32 changed files with 917 additions and 0 deletions

6
.gitmodules vendored Normal file
View File

@ -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

1
AUTHORS Normal file
View File

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

23
CMakeLists.txt Normal file
View File

@ -0,0 +1,23 @@
PROJECT (LAviewDataExample C)
CMAKE_MINIMUM_REQUIRED (VERSION 2.8)
SET (PROJECT_LOWERCASE_NAME "laview-data-example")
SET (PROJECT_DESCRIPTION "LAview Plugin Data 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 (pkg-config)
ADD_SUBDIRECTORY (test)
ADD_SUBDIRECTORY (cpack)
ADD_SUBDIRECTORY (ui)
# enable testing
ENABLE_TESTING ()

165
COPYING Normal file
View File

@ -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 Normal file
View File

@ -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 Normal file
View File

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

1
cmake/backbone Submodule

@ -0,0 +1 @@
Subproject commit cd1394cb27b229c618524759f91ac765e80413aa

5
config/CMakeLists.txt Normal file
View File

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

6
config/Config.vapi Normal file
View File

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

3
config/config.h.in Normal file
View File

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

View File

@ -0,0 +1,23 @@
<schemalist>
<schema id="ws.backbone.laview.data-example-@MAJOR@" path="/ws/backbone/laview/data-example-@MAJOR@/" gettext-domain="laview-data-example-@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>

10
cpack/CMakeLists.txt Normal file
View File

@ -0,0 +1,10 @@
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 "LAvPlDEx") # <= 8 symbols for the name
SET (CPACK_NSIS_MENU_LINKS "https://git.backbone.ws/kolan/LAview.Data-Example"
"Homepage for LAview/Data-Example")
INCLUDE (CPackCommonRules)

View File

@ -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 Normal file
View File

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

1
po/de/CMakeLists.txt Normal file
View File

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

View File

@ -0,0 +1,66 @@
# German translations for laview-data-example package.
# Copyright (C) 2015 THE laview-data-example'S COPYRIGHT HOLDER
# This file is distributed under the same license as the laview-data-example package.
# <backbone@backbone.ws>, 2015.
#
msgid ""
msgstr ""
"Project-Id-Version: laview-data-example\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-04-28 18:45+0300\n"
"PO-Revision-Date: 2015-11-09 15:51+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=ASCII\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: config/ws.backbone.laview.data-example.gschema.xml.h:1
msgid "\"Hello, earthlings\""
msgstr ""
#: config/ws.backbone.laview.data-example.gschema.xml.h:2
msgid "A greeting"
msgstr ""
#: config/ws.backbone.laview.data-example.gschema.xml.h:3
msgid "Greeting of the invading martians"
msgstr ""
#: config/ws.backbone.laview.data-example.gschema.xml.h:4
msgid "Bottles of beer"
msgstr ""
#: config/ws.backbone.laview.data-example.gschema.xml.h:5
msgid "Number of bottles of beer on the wall"
msgstr ""
#: config/ws.backbone.laview.data-example.gschema.xml.h:6
msgid "Is the light switched on?"
msgstr ""
#: config/ws.backbone.laview.data-example.gschema.xml.h:7
msgid "State of an imaginary light switch."
msgstr ""
#: src/main.vala:41
msgid "Data Example"
msgstr ""
#: ui/glade/laview-data-example.glade.h:1
msgid "Data Example Plugin Preferences"
msgstr ""
#: ui/glade/laview-data-example.glade.h:2
msgid "...settings..."
msgstr ""
#: ui/glade/laview-data-example.glade.h:3
msgid "...preferences..."
msgstr ""
#: ui/glade/laview-data-example.glade.h:4
msgid "...properties..."
msgstr ""

View File

@ -0,0 +1,66 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the laview-data-example package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: laview-data-example\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-04-28 18:45+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.data-example.gschema.xml.h:1
msgid "\"Hello, earthlings\""
msgstr ""
#: config/ws.backbone.laview.data-example.gschema.xml.h:2
msgid "A greeting"
msgstr ""
#: config/ws.backbone.laview.data-example.gschema.xml.h:3
msgid "Greeting of the invading martians"
msgstr ""
#: config/ws.backbone.laview.data-example.gschema.xml.h:4
msgid "Bottles of beer"
msgstr ""
#: config/ws.backbone.laview.data-example.gschema.xml.h:5
msgid "Number of bottles of beer on the wall"
msgstr ""
#: config/ws.backbone.laview.data-example.gschema.xml.h:6
msgid "Is the light switched on?"
msgstr ""
#: config/ws.backbone.laview.data-example.gschema.xml.h:7
msgid "State of an imaginary light switch."
msgstr ""
#: src/main.vala:41
msgid "Data Example"
msgstr ""
#: ui/glade/laview-data-example.glade.h:1
msgid "Data Example Plugin Preferences"
msgstr ""
#: ui/glade/laview-data-example.glade.h:2
msgid "...settings..."
msgstr ""
#: ui/glade/laview-data-example.glade.h:3
msgid "...preferences..."
msgstr ""
#: ui/glade/laview-data-example.glade.h:4
msgid "...properties..."
msgstr ""

1
po/ru/CMakeLists.txt Normal file
View File

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

View File

@ -0,0 +1,67 @@
# Russian translations for laview-data-example package.
# Copyright (C) 2015 THE laview-data-example'S COPYRIGHT HOLDER
# This file is distributed under the same license as the laview-data-example package.
# <backbone@backbone.ws>, 2015.
#
msgid ""
msgstr ""
"Project-Id-Version: laview-data-example\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-04-28 18:45+0300\n"
"PO-Revision-Date: 2015-11-09 15:51+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.data-example.gschema.xml.h:1
msgid "\"Hello, earthlings\""
msgstr ""
#: config/ws.backbone.laview.data-example.gschema.xml.h:2
msgid "A greeting"
msgstr ""
#: config/ws.backbone.laview.data-example.gschema.xml.h:3
msgid "Greeting of the invading martians"
msgstr ""
#: config/ws.backbone.laview.data-example.gschema.xml.h:4
msgid "Bottles of beer"
msgstr ""
#: config/ws.backbone.laview.data-example.gschema.xml.h:5
msgid "Number of bottles of beer on the wall"
msgstr ""
#: config/ws.backbone.laview.data-example.gschema.xml.h:6
msgid "Is the light switched on?"
msgstr ""
#: config/ws.backbone.laview.data-example.gschema.xml.h:7
msgid "State of an imaginary light switch."
msgstr ""
#: src/main.vala:41
msgid "Data Example"
msgstr "Пример данных"
#: ui/glade/laview-data-example.glade.h:1
msgid "Data Example Plugin Preferences"
msgstr "Настройки примера плагина данных"
#: ui/glade/laview-data-example.glade.h:2
msgid "...settings..."
msgstr "...настройки..."
#: ui/glade/laview-data-example.glade.h:3
msgid "...preferences..."
msgstr "...параметры..."
#: ui/glade/laview-data-example.glade.h:4
msgid "...properties..."
msgstr "...свойства..."

1
src/CMakeLists.txt Normal file
View File

@ -0,0 +1 @@
ADD_SUBDIRECTORY (laview-core)

View File

@ -0,0 +1 @@
ADD_SUBDIRECTORY (data-plugins)

View File

@ -0,0 +1,34 @@
namespace Get {
extern void library_path (string so_path, void *addr);
}
namespace LAview.DataExample {
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-data-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 () {
}
}
}

View File

@ -0,0 +1,13 @@
SET (LibName laview-data-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)
SET (LibPkgModules gtk+-3.0 gee-0.8 gobject-plugin-0 laview-core-0)
SET (LibCustomVapis ${CMAKE_SOURCE_DIR}/config/Config.vapi)
INCLUDE_DIRECTORIES ("${CMAKE_BINARY_DIR}/config")
SET (LibIsPlugin ON)
SET (LibInstall 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/data-plugins")
INCLUDE (ValaLibCommonRules)

View File

@ -0,0 +1,47 @@
namespace LAview.DataExample {
using Gtk, LAview;
class PreferencesDialog : GLib.Object {
Dialog dialog;
public bool apply { get; private set; default = false; }
public PreferencesDialog (GLib.Object parent) throws Error {
var builder = new Builder ();
builder.add_from_file (AppDirs.ui_dir + "/laview-data-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 ();
}
}
}

View File

@ -0,0 +1,35 @@
namespace LAview.DataExample {
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.data-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");
});
}
}
}

View File

@ -0,0 +1,100 @@
using LAview, Core, GObject.Plugins;
extern const string GETTEXT_PACKAGE;
namespace LAview.DataExample {
/**
* Data Plugin Example.
*/
public class Plugin : LAview.Core.PluginData {
PreferencesDialog preferences_dialog = null;
AppSettings settings;
/**
* Constructs a new ``Plugin``.
*/
construct {
// Initialize the data object, open database connection for example.
stdout.puts ("DataExample.Plugin init () called\n");
AppDirs.init ();
try {
settings = new AppSettings();
} catch (Error err) {
stderr.printf("Error: %s\n", err.message);
}
}
/**
* Destroys the ``Plugin``.
*/
~Plugin () {
// Deinitialize the data object, close database connection for example.
stdout.puts ("DataExample.Plugin deinit () called\n");
}
/**
* Get plugin name.
*/
public override string get_name () {
return "DataExample";
}
/**
* Any abstract method realization for PluginData.
*/
public override string get_readable_name () {
return _("Data Example");
}
/**
* Open Preferences.
*/
public override void preferences (Object parent) throws Error {
if (preferences_dialog == null) preferences_dialog = new PreferencesDialog (parent);
preferences_dialog.show_all ();
}
/**
* transfer string data
*/
public string get_string_data (string id) {
switch (id) {
case "SampleRequest": return "Sample Answer";
case "AnotherRequest": return "Another Answer";
case "Manual.SampleRequest": return "Manual Sample Answer";
case "MainChart":
var cache_dir = (host as IHostCore).get_cache_dir ();
// TODO: save picture in path: cache_dir + "MainChart.png";
return "MainChart";
}
return "";
}
/**
* transfer array1D data
*/
public string[] get_array1d_data (string id) {
return { "A1d", "B1d", "C1d", "D1d", "E1d" };
}
/**
* transfer array1D data
*/
public string[,] get_array2d_data (string id) {
return { { "A2d", "B2d", "C2d", "D2d", "E2d"},
{ "F2d", "G2d", "H2d", "I2d", "J2d"},
{ "K2d", "L2d", "M2d", "N2d", "O2d"},
{ "P2d", "Q2d", "R2d", "S2d", "T2d"},
{ "U2d", "V2d", "W2d", "X2d", "Y2d"},
};
}
}
}
[ModuleInit]
Type plugin_init (GLib.TypeModule type_module) {
return typeof (LAview.DataExample.Plugin);
}

0
test/CMakeLists.txt Normal file
View File

1
ui/CMakeLists.txt Normal file
View File

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

2
ui/glade/CMakeLists.txt Normal file
View File

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

View File

@ -0,0 +1,142 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.4 -->
<interface>
<requires lib="gtk+" version="3.16"/>
<object class="GtkDialog" id="preferences_dialog">
<property name="can_focus">False</property>
<property name="title" translatable="yes">Data Example Protocol</property>
<property name="type_hint">dialog</property>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action_area1">
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="button_apply">
<property name="label">gtk-apply</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<property name="always_show_image">True</property>
<signal name="clicked" handler="laview_data_example_preferences_dialog_button_apply_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="button_ok">
<property name="label">gtk-ok</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<property name="always_show_image">True</property>
<signal name="clicked" handler="laview_data_example_preferences_dialog_button_ok_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="button_cancel">
<property name="label">gtk-undo</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<property name="always_show_image">True</property>
<signal name="clicked" handler="laview_data_example_preferences_dialog_button_cancel_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Data Example Plugin Preferences</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">...settings...</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">...preferences...</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">...properties...</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
<child>
<placeholder/>
</child>
</object>
</interface>

1
util/backbone Submodule

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

2
valadoc_env Normal file
View File

@ -0,0 +1,2 @@
BASEDIR=src config
PKGS=gtk+-3.0 gio-2.0 laview-core-iface-0 gobject-plugin-iface-0 gee-0.8