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..2a53054 --- /dev/null +++ b/CMakeLists.txt @@ -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 () 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/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..6c20f26 --- /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.data-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.data-example.gschema.xml b/config/ws.backbone.laview.data-example.gschema.xml new file mode 100644 index 0000000..065188f --- /dev/null +++ b/config/ws.backbone.laview.data-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..b3ef7a9 --- /dev/null +++ b/cpack/CMakeLists.txt @@ -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) diff --git a/pkg-config/CMakeLists.txt b/pkg-config/CMakeLists.txt new file mode 100644 index 0000000..d349889 --- /dev/null +++ b/pkg-config/CMakeLists.txt @@ -0,0 +1,6 @@ +INCLUDE (PkgConfigCommonRules) + +CONFIGURE_FILE ( + "${CMAKE_SOURCE_DIR}/cmake/backbone/templates/pkg-config.pc.in" + "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_LOWERCASE_NAME}-${MAJOR}.pc" +) 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/de/CMakeLists.txt b/po/de/CMakeLists.txt new file mode 100644 index 0000000..0b6020c --- /dev/null +++ b/po/de/CMakeLists.txt @@ -0,0 +1 @@ +INCLUDE (GettextLangRules) diff --git a/po/de/laview-data-example.po b/po/de/laview-data-example.po new file mode 100644 index 0000000..834c6c5 --- /dev/null +++ b/po/de/laview-data-example.po @@ -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. +# , 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: \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 "" diff --git a/po/laview-data-example.pot b/po/laview-data-example.pot new file mode 100644 index 0000000..1d61b59 --- /dev/null +++ b/po/laview-data-example.pot @@ -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 , 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 \n" +"Language-Team: LANGUAGE \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 "" 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-data-example.po b/po/ru/laview-data-example.po new file mode 100644 index 0000000..5478874 --- /dev/null +++ b/po/ru/laview-data-example.po @@ -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. +# , 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: \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 "...свойства..." 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..190a099 --- /dev/null +++ b/src/laview-core/CMakeLists.txt @@ -0,0 +1 @@ +ADD_SUBDIRECTORY (data-plugins) diff --git a/src/laview-core/data-plugins/AppDirs.vala b/src/laview-core/data-plugins/AppDirs.vala new file mode 100644 index 0000000..0a3293c --- /dev/null +++ b/src/laview-core/data-plugins/AppDirs.vala @@ -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 () { + } + } +} diff --git a/src/laview-core/data-plugins/CMakeLists.txt b/src/laview-core/data-plugins/CMakeLists.txt new file mode 100644 index 0000000..724d151 --- /dev/null +++ b/src/laview-core/data-plugins/CMakeLists.txt @@ -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) diff --git a/src/laview-core/data-plugins/PreferencesDialog.vala b/src/laview-core/data-plugins/PreferencesDialog.vala new file mode 100644 index 0000000..a447493 --- /dev/null +++ b/src/laview-core/data-plugins/PreferencesDialog.vala @@ -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 (); + } + } +} diff --git a/src/laview-core/data-plugins/Settings.vala b/src/laview-core/data-plugins/Settings.vala new file mode 100644 index 0000000..a1e5bd8 --- /dev/null +++ b/src/laview-core/data-plugins/Settings.vala @@ -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"); + }); + } + } +} diff --git a/src/laview-core/data-plugins/main.vala b/src/laview-core/data-plugins/main.vala new file mode 100644 index 0000000..ec7be83 --- /dev/null +++ b/src/laview-core/data-plugins/main.vala @@ -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); +} 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-data-example.glade b/ui/glade/laview-data-example.glade new file mode 100644 index 0000000..7209ce3 --- /dev/null +++ b/ui/glade/laview-data-example.glade @@ -0,0 +1,142 @@ + + + + + + False + Data Example Protocol + 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 + Data 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..3aa0688 --- /dev/null +++ b/valadoc_env @@ -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