1
0
Fork 0

Squashed commit of the following:

commit d637633290
Author: Kolan Sh <backbone@backbone.ws>
Date:   Tue May 8 19:26:54 2018 +0300

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

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

    URLs, captions fixed.

commit ebd71aa552
Author: Kolan Sh <backbone@backbone.ws>
Date:   Sat Apr 28 19:07:03 2018 +0300

    Spare Plugin, Core keywords removed from identifiers.

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

    Valadoc fixes.

commit 308dee4232
Author: Kolan Sh <backbone@backbone.ws>
Date:   Fri Apr 27 18:03:34 2018 +0300

    ObjectExample Dialog [Preferences Button] -> Preferences Dialog.

commit a846158937
Author: Kolan Sh <backbone@backbone.ws>
Date:   Fri Apr 27 17:33:33 2018 +0300

    Fix UI Glade file.

commit d21729d16d
Author: Kolan Sh <backbone@backbone.ws>
Date:   Fri Apr 27 17:28:07 2018 +0300

    PreferencesDialog added

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

    UI file updated.

commit f987024016
Author: Kolan Sh <backbone@backbone.ws>
Date:   Fri Apr 27 15:02:56 2018 +0300

    Conflicting AppDirs fxd.

commit 75f8ecc06e
Author: Kolan Sh <backbone@backbone.ws>
Date:   Thu Apr 26 16:38:55 2018 +0300

    PluginObject.preferences() added.

commit d0f518049f
Author: Kolan Sh <backbone@backbone.ws>
Date:   Thu Mar 29 10:52:35 2018 +0300

    submodules URLs updated.

commit 954073e68e
Author: Kolan Sh <backbone@backbone.ws>
Date:   Tue Feb 13 23:27:42 2018 +0300

    lib != lib64, lib != lib32

commit 16f0814208
Author: Kolan Sh <backbone@backbone.ws>
Date:   Tue Dec 19 08:52:31 2017 +0300

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

commit aefe2404e6
Author: Kolan Sh <backbone@backbone.ws>
Date:   Sat Feb 18 18:12:45 2017 +0300

    Backbone's submodules urls fixed.

commit 036c79e9e3
Author: Kolan Sh <backbone@backbone.ws>
Date:   Thu Dec 8 04:17:13 2016 +0300

    Valadoc fxd.

commit 111805ad73
Author: Kolan Sh <backbone@backbone.ws>
Date:   Thu Dec 8 04:16:52 2016 +0300

    util/backbone submodule udpated: valadoc

commit 155b3e1a1a
Author: Kolan Sh <backbone@backbone.ws>
Date:   Wed Dec 7 19:00:13 2016 +0300

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

commit 37652bedfd
Author: Kolan Sh <backbone@backbone.ws>
Date:   Fri Sep 2 18:47:44 2016 +0300

    cmake/backbone submodule updated: dlls regresion fxd.

commit 70f6158c09
Author: Kolan Sh <backbone@backbone.ws>
Date:   Tue Aug 9 18:22:00 2016 +0300

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

commit 606013daef
Author: Kolan Sh <backbone@backbone.ws>
Date:   Tue Jun 21 13:32:05 2016 +0300

    Show paths.

commit 29817dd27b
Author: Kolan Sh <backbone@backbone.ws>
Date:   Fri Apr 8 03:18:56 2016 +0300

    Homepage menu link added.

commit 5800e4f331
Author: Kolan Sh <backbone@backbone.ws>
Date:   Sat Nov 14 12:50:00 2015 +0300
This commit is contained in:
Kolan Sh 2018-06-18 12:12:45 +03:00
parent 453a888472
commit e8ed782e1c
31 changed files with 1119 additions and 1 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>

22
CMakeLists.txt Normal file
View File

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

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

2
README
View File

@ -1 +1 @@
LAview protocol plugin sample.
LAview protocol object plugin sample.

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.object-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.object-example-@MAJOR@" path="/ws/backbone/laview/object-example-@MAJOR@/" gettext-domain="laview-object-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, 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)

1
po/CMakeLists.txt Normal file
View File

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

View File

@ -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 <EMAIL@ADDRESS>, 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 <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"
#: 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 ""

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

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

View File

@ -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.
# <backbone@backbone.ws>, 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: <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"
#: 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 "...свойства..."

1
src/CMakeLists.txt Normal file
View File

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

View File

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

View File

@ -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 () {
}
}
}

View File

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

View File

@ -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 ();
}
}
}

View File

@ -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 ();
}
}
}

View File

@ -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");
});
}
}
}

View File

@ -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<string, AnswerValue> 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);
}

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,295 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.4 -->
<interface>
<requires lib="gtk+" version="3.16"/>
<object class="GtkDialog" id="object_example_dialog">
<property name="can_focus">False</property>
<property name="title" translatable="yes">Object 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_preferences">
<property name="label">gtk-preferences</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_object_example_main_dialog_button_preferences_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_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_object_example_main_dialog_button_apply_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_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_object_example_main_dialog_button_ok_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</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_object_example_main_dialog_button_cancel_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">3</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">Object Example Protocol</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">Any</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">Controls</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">Here</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>
<object class="GtkDialog" id="preferences_dialog">
<property name="can_focus">False</property>
<property name="title" translatable="yes">Object Example Protocol Preferences</property>
<property name="type_hint">dialog</property>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox2">
<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_area2">
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="button_apply1">
<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_object_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_ok1">
<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_object_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_cancel1">
<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_object_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="box2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="label5">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Object 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="label6">
<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="label7">
<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="label8">
<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 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