diff --git a/CMakeLists.txt b/CMakeLists.txt index 8a5418d..6e95592 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,8 @@ -PROJECT (LAviewPluginObjectExample C) +PROJECT (LAviewObjectExample C) CMAKE_MINIMUM_REQUIRED (VERSION 2.8) -SET (PROJECT_LOWERCASE_NAME "laview-plugin-object-example") +SET (PROJECT_LOWERCASE_NAME "laview-object-example") SET (PROJECT_DESCRIPTION "LAview Plugin Protocol Object Example.") SET (MAJOR 0) diff --git a/cmake/backbone b/cmake/backbone index 9ba1995..cd1394c 160000 --- a/cmake/backbone +++ b/cmake/backbone @@ -1 +1 @@ -Subproject commit 9ba1995060ebb1c65ac9855e3671b3992c859059 +Subproject commit cd1394cb27b229c618524759f91ac765e80413aa diff --git a/config/CMakeLists.txt b/config/CMakeLists.txt index b4f2f41..9ceffcf 100644 --- a/config/CMakeLists.txt +++ b/config/CMakeLists.txt @@ -1,5 +1,5 @@ -SET (GSchemaFile "ws.backbone.laview.plugins.object-example") -INCLUDE (GSchemaCommonRules) - CONFIGURE_FILE ("${CMAKE_CURRENT_SOURCE_DIR}/config.h.in" "${CMAKE_CURRENT_BINARY_DIR}/config.h") + +SET (GSchemaFile "ws.backbone.laview.object-example") +INCLUDE (GSchemaCommonRules) diff --git a/config/ws.backbone.laview.plugins.object-example.gschema.xml b/config/ws.backbone.laview.object-example.gschema.xml similarity index 79% rename from config/ws.backbone.laview.plugins.object-example.gschema.xml rename to config/ws.backbone.laview.object-example.gschema.xml index 1112c0e..9a00837 100644 --- a/config/ws.backbone.laview.plugins.object-example.gschema.xml +++ b/config/ws.backbone.laview.object-example.gschema.xml @@ -1,5 +1,5 @@ - + "Hello, earthlings" diff --git a/cpack/CMakeLists.txt b/cpack/CMakeLists.txt index 45fbee0..9f77229 100644 --- a/cpack/CMakeLists.txt +++ b/cpack/CMakeLists.txt @@ -1,10 +1,10 @@ SET (CONTACT "backbone@backbone.ws") -SET (DEBIAN_DEPENDENCIES "laview-core-0 >= 0.0.0, laview-plugin-data-example-0 (>= 0.0.0)") +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-plugin-data-example-0 >= 0.0.0") +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/laview/object-example" +SET (CPACK_NSIS_MENU_LINKS "https://git.backbone.ws/kolan/LAview.Object-Example" "Homepage for LAview/Object-Example") INCLUDE (CPackCommonRules) diff --git a/po/laview-object-example.pot b/po/laview-object-example.pot new file mode 100644 index 0000000..dbc4587 --- /dev/null +++ b/po/laview-object-example.pot @@ -0,0 +1,89 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the laview-object-example package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: laview-object-example\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-04-28 18:59+0300\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: build-gcc/share/glib-2.0/schemas/ws.backbone.laview.object-example-0.gschema.xml.h:1 +#: config/ws.backbone.laview.object-example.gschema.xml.h:1 +msgid "\"Hello, earthlings\"" +msgstr "" + +#: build-gcc/share/glib-2.0/schemas/ws.backbone.laview.object-example-0.gschema.xml.h:2 +#: config/ws.backbone.laview.object-example.gschema.xml.h:2 +msgid "A greeting" +msgstr "" + +#: build-gcc/share/glib-2.0/schemas/ws.backbone.laview.object-example-0.gschema.xml.h:3 +#: config/ws.backbone.laview.object-example.gschema.xml.h:3 +msgid "Greeting of the invading martians" +msgstr "" + +#: build-gcc/share/glib-2.0/schemas/ws.backbone.laview.object-example-0.gschema.xml.h:4 +#: config/ws.backbone.laview.object-example.gschema.xml.h:4 +msgid "Bottles of beer" +msgstr "" + +#: build-gcc/share/glib-2.0/schemas/ws.backbone.laview.object-example-0.gschema.xml.h:5 +#: config/ws.backbone.laview.object-example.gschema.xml.h:5 +msgid "Number of bottles of beer on the wall" +msgstr "" + +#: build-gcc/share/glib-2.0/schemas/ws.backbone.laview.object-example-0.gschema.xml.h:6 +#: config/ws.backbone.laview.object-example.gschema.xml.h:6 +msgid "Is the light switched on?" +msgstr "" + +#: build-gcc/share/glib-2.0/schemas/ws.backbone.laview.object-example-0.gschema.xml.h:7 +#: config/ws.backbone.laview.object-example.gschema.xml.h:7 +msgid "State of an imaginary light switch." +msgstr "" + +#: src/main.vala:44 +msgid "Protocol Object Example" +msgstr "" + +#: ui/glade/laview-object-example.glade.h:1 +msgid "Object Example Protocol" +msgstr "" + +#: ui/glade/laview-object-example.glade.h:2 +msgid "Any" +msgstr "" + +#: ui/glade/laview-object-example.glade.h:3 +msgid "Controls" +msgstr "" + +#: ui/glade/laview-object-example.glade.h:4 +msgid "Here" +msgstr "" + +#: ui/glade/laview-object-example.glade.h:5 +msgid "Object Example Plugin Preferences" +msgstr "" + +#: ui/glade/laview-object-example.glade.h:6 +msgid "...settings..." +msgstr "" + +#: ui/glade/laview-object-example.glade.h:7 +msgid "...preferences..." +msgstr "" + +#: ui/glade/laview-object-example.glade.h:8 +msgid "...properties..." +msgstr "" diff --git a/po/laview-plugin-object-example.pot b/po/laview-plugin-object-example.pot deleted file mode 100644 index a046622..0000000 --- a/po/laview-plugin-object-example.pot +++ /dev/null @@ -1,50 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the laview-plugin-object-example package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: laview-plugin-object-example\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-02-14 15:16+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.plugins.object-example.gschema.xml.h:1 -msgid "\"Hello, earthlings\"" -msgstr "" - -#: config/ws.backbone.laview.plugins.object-example.gschema.xml.h:2 -msgid "A greeting" -msgstr "" - -#: config/ws.backbone.laview.plugins.object-example.gschema.xml.h:3 -msgid "Greeting of the invading martians" -msgstr "" - -#: config/ws.backbone.laview.plugins.object-example.gschema.xml.h:4 -msgid "Bottles of beer" -msgstr "" - -#: config/ws.backbone.laview.plugins.object-example.gschema.xml.h:5 -msgid "Number of bottles of beer on the wall" -msgstr "" - -#: config/ws.backbone.laview.plugins.object-example.gschema.xml.h:6 -msgid "Is the light switched on?" -msgstr "" - -#: config/ws.backbone.laview.plugins.object-example.gschema.xml.h:7 -msgid "State of an imaginary light switch." -msgstr "" - -#: src/main.vala:39 -msgid "Protocol Object Example" -msgstr "" diff --git a/po/ru/laview-object-example.po b/po/ru/laview-object-example.po new file mode 100644 index 0000000..b9a4697 --- /dev/null +++ b/po/ru/laview-object-example.po @@ -0,0 +1,90 @@ +# Russian translations for laview-object-example package. +# Copyright (C) 2015 THE laview-object-example'S COPYRIGHT HOLDER +# This file is distributed under the same license as the laview-object-example package. +# , 2015. +# +msgid "" +msgstr "" +"Project-Id-Version: laview-object-example\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-04-28 18:59+0300\n" +"PO-Revision-Date: 2015-11-09 15:51+0300\n" +"Last-Translator: \n" +"Language-Team: Russian\n" +"Language: ru\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" +"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" + +#: build-gcc/share/glib-2.0/schemas/ws.backbone.laview.object-example-0.gschema.xml.h:1 +#: config/ws.backbone.laview.object-example.gschema.xml.h:1 +msgid "\"Hello, earthlings\"" +msgstr "" + +#: build-gcc/share/glib-2.0/schemas/ws.backbone.laview.object-example-0.gschema.xml.h:2 +#: config/ws.backbone.laview.object-example.gschema.xml.h:2 +msgid "A greeting" +msgstr "" + +#: build-gcc/share/glib-2.0/schemas/ws.backbone.laview.object-example-0.gschema.xml.h:3 +#: config/ws.backbone.laview.object-example.gschema.xml.h:3 +msgid "Greeting of the invading martians" +msgstr "" + +#: build-gcc/share/glib-2.0/schemas/ws.backbone.laview.object-example-0.gschema.xml.h:4 +#: config/ws.backbone.laview.object-example.gschema.xml.h:4 +msgid "Bottles of beer" +msgstr "" + +#: build-gcc/share/glib-2.0/schemas/ws.backbone.laview.object-example-0.gschema.xml.h:5 +#: config/ws.backbone.laview.object-example.gschema.xml.h:5 +msgid "Number of bottles of beer on the wall" +msgstr "" + +#: build-gcc/share/glib-2.0/schemas/ws.backbone.laview.object-example-0.gschema.xml.h:6 +#: config/ws.backbone.laview.object-example.gschema.xml.h:6 +msgid "Is the light switched on?" +msgstr "" + +#: build-gcc/share/glib-2.0/schemas/ws.backbone.laview.object-example-0.gschema.xml.h:7 +#: config/ws.backbone.laview.object-example.gschema.xml.h:7 +msgid "State of an imaginary light switch." +msgstr "" + +#: src/main.vala:44 +msgid "Protocol Object Example" +msgstr "Пример объекта протокола" + +#: ui/glade/laview-object-example.glade.h:1 +msgid "Object Example Protocol" +msgstr "Протокол примера объекта" + +#: ui/glade/laview-object-example.glade.h:2 +msgid "Any" +msgstr "" + +#: ui/glade/laview-object-example.glade.h:3 +msgid "Controls" +msgstr "" + +#: ui/glade/laview-object-example.glade.h:4 +msgid "Here" +msgstr "" + +#: ui/glade/laview-object-example.glade.h:5 +msgid "Object Example Plugin Preferences" +msgstr "Настройки плагина примера объекта" + +#: ui/glade/laview-object-example.glade.h:6 +msgid "...settings..." +msgstr "...настройки..." + +#: ui/glade/laview-object-example.glade.h:7 +msgid "...preferences..." +msgstr "...параметры..." + +#: ui/glade/laview-object-example.glade.h:8 +msgid "...properties..." +msgstr "...свойства..." diff --git a/po/ru/laview-plugin-object-example.po b/po/ru/laview-plugin-object-example.po deleted file mode 100644 index 5b8498e..0000000 --- a/po/ru/laview-plugin-object-example.po +++ /dev/null @@ -1,51 +0,0 @@ -# Russian translations for laview-plugin-object-example package. -# Copyright (C) 2015 THE laview-plugin-object-example'S COPYRIGHT HOLDER -# This file is distributed under the same license as the laview-plugin-object-example package. -# , 2015. -# -msgid "" -msgstr "" -"Project-Id-Version: laview-plugin-object-example\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-02-14 15:16+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.plugins.object-example.gschema.xml.h:1 -msgid "\"Hello, earthlings\"" -msgstr "" - -#: config/ws.backbone.laview.plugins.object-example.gschema.xml.h:2 -msgid "A greeting" -msgstr "" - -#: config/ws.backbone.laview.plugins.object-example.gschema.xml.h:3 -msgid "Greeting of the invading martians" -msgstr "" - -#: config/ws.backbone.laview.plugins.object-example.gschema.xml.h:4 -msgid "Bottles of beer" -msgstr "" - -#: config/ws.backbone.laview.plugins.object-example.gschema.xml.h:5 -msgid "Number of bottles of beer on the wall" -msgstr "" - -#: config/ws.backbone.laview.plugins.object-example.gschema.xml.h:6 -msgid "Is the light switched on?" -msgstr "" - -#: config/ws.backbone.laview.plugins.object-example.gschema.xml.h:7 -msgid "State of an imaginary light switch." -msgstr "" - -#: src/main.vala:39 -msgid "Protocol Object Example" -msgstr "Пример объекта протокола" diff --git a/src/AppDirs.vala b/src/AppDirs.vala index 8e2ff07..2283ec3 100644 --- a/src/AppDirs.vala +++ b/src/AppDirs.vala @@ -2,7 +2,7 @@ namespace Get { extern void library_path (string so_path, void *addr); } -namespace LAview.Core.Plugins.ObjectExample { +namespace LAview.ObjectExample { class AppDirs : Object { @@ -18,9 +18,9 @@ namespace LAview.Core.Plugins.ObjectExample { 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().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-plugin-object-example-"+Config.VERSION_MAJOR.to_string()+"/ui"); + "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); diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index af67df8..a430768 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,10 +1,10 @@ -SET (LibName laview-plugin-object-example) +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-plugin-data-example-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-plugin-data-example-0) + SET (LibPkgModules ${LibPkgModules} laview-data-example-0) ENDIF (WIN32) SET (LibCustomVapis ${CMAKE_SOURCE_DIR}/config/Config.vapi) INCLUDE_DIRECTORIES ("${CMAKE_BINARY_DIR}/config") diff --git a/src/ObjectDialog.vala b/src/ObjectDialog.vala index e4fae74..8e72a50 100644 --- a/src/ObjectDialog.vala +++ b/src/ObjectDialog.vala @@ -1,15 +1,15 @@ -namespace LAview.Core.Plugins { +namespace LAview.ObjectExample { using Gtk, LAview; - class ObjectExampleDialog : Object { + class MainDialog : Object { Dialog dialog; - ObjectExample.PreferencesDialog preferences_dialog; + PreferencesDialog preferences_dialog; public bool composed { get; private set; default = false; } - public ObjectExampleDialog (Object parent) throws Error { + public MainDialog (Object parent) throws Error { var builder = new Builder (); - builder.add_from_file (ObjectExample.AppDirs.ui_dir + "/laview-plugin-object-example.glade"); + builder.add_from_file (AppDirs.ui_dir + "/laview-object-example.glade"); builder.connect_signals (this); dialog = builder.get_object ("object_example_dialog") as Dialog; @@ -47,8 +47,15 @@ namespace LAview.Core.Plugins { [CCode (instance_pos = -1)] public void button_preferences_clicked (Button button) { - if (preferences_dialog == null) preferences_dialog = new ObjectExample.PreferencesDialog (dialog); - + if (preferences_dialog == null) + try { + preferences_dialog = new PreferencesDialog (dialog); + } catch (Error err) { + var msg = new MessageDialog (dialog, DialogFlags.MODAL, MessageType.ERROR, + ButtonsType.CLOSE, _("Error: ")+err.message); + msg.response.connect ((response_id) => { msg.destroy (); } ); + msg.show (); + } preferences_dialog.show_all (); } } diff --git a/src/PreferencesDialog.vala b/src/PreferencesDialog.vala index ee11f67..79fd374 100644 --- a/src/PreferencesDialog.vala +++ b/src/PreferencesDialog.vala @@ -1,14 +1,14 @@ -namespace LAview.Core.Plugins { +namespace LAview.ObjectExample { using Gtk, LAview; - class ObjectExample.PreferencesDialog : GLib.Object { + class PreferencesDialog : GLib.Object { Dialog dialog; - public bool composed { get; private set; default = false; } + public bool apply { get; private set; default = false; } public PreferencesDialog (Object parent) throws Error { var builder = new Builder (); - builder.add_from_file (ObjectExample.AppDirs.ui_dir + "/laview-plugin-object-example.glade"); + builder.add_from_file (AppDirs.ui_dir + "/laview-object-example.glade"); builder.connect_signals (this); dialog = builder.get_object ("preferences_dialog") as Dialog; @@ -24,18 +24,18 @@ namespace LAview.Core.Plugins { } public void show_all () { - composed = false; + apply = false; dialog.run (); } [CCode (instance_pos = -1)] public void button_apply_clicked (Button button) { - composed = true; + apply = true; } [CCode (instance_pos = -1)] public void button_ok_clicked (Button button) { - composed = true; + apply = true; dialog.hide (); } diff --git a/src/main.vala b/src/main.vala index 3819bc8..9e3bbad 100644 --- a/src/main.vala +++ b/src/main.vala @@ -1,29 +1,29 @@ -using LAview, Core, Plugins, GObject.Plugins; +using LAview, Core, GObject.Plugins; extern const string GETTEXT_PACKAGE; -namespace LAview.Core.Plugins { +namespace LAview.ObjectExample { /** * Object Plugin Example. */ - public class PluginObjectExample : PluginObject { + public class Plugin : PluginObject { - ObjectExampleDialog object_dialog = null; + MainDialog object_dialog = null; ObjectExample.PreferencesDialog preferences_dialog = null; /** - * Constructs a new ``PluginObjectExample``. + * Constructs a new ``Plugin``. */ construct { - stdout.puts ("PluginObjectExample init () called\n"); + stdout.puts ("ObjectExample.Plugin init () called\n"); ObjectExample.AppDirs.init (); } /** - * Destroys the ``PluginObjectExample``. + * Destroys the ``Plugin``. */ - ~PluginObjectExample () { - stdout.puts ("PluginObjectExample deinit () called\n"); + ~Plugin () { + stdout.puts ("ObjectExample.Plugin deinit () called\n"); } /** @@ -37,8 +37,8 @@ namespace LAview.Core.Plugins { * Gets readable name of the plugin. */ public override string get_readable_name () { - stdout.puts ("PluginObjectExample.get_readable_name () called\n"); - stdout.puts ("Call IHostCore.get_cache_dir () from PluginObjectExample:\n "); + 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"); @@ -48,11 +48,11 @@ namespace LAview.Core.Plugins { * Compose the object. */ public override bool compose (Object parent, Gee.HashMap answers) throws Error { - if (object_dialog == null) object_dialog = new ObjectExampleDialog (parent); + if (object_dialog == null) object_dialog = new MainDialog (parent); object_dialog.show_all (); - PluginDataExample data_obj_ex = (host as IHostCore).get_data_object ("DataExample") as PluginDataExample; + var data_obj_ex = (host as IHostCore).get_data_object ("DataExample") as LAview.DataExample.Plugin; stdout.puts ("Compose() called\n"); @@ -100,5 +100,5 @@ namespace LAview.Core.Plugins { [ModuleInit] Type plugin_init (GLib.TypeModule type_module) { stdout.puts ("---ModuleInit called()---\n"); - return typeof (PluginObjectExample); + return typeof (LAview.ObjectExample.Plugin); } diff --git a/ui/glade/laview-plugin-object-example.glade b/ui/glade/laview-object-example.glade similarity index 92% rename from ui/glade/laview-plugin-object-example.glade rename to ui/glade/laview-object-example.glade index fbe881e..05786b0 100644 --- a/ui/glade/laview-plugin-object-example.glade +++ b/ui/glade/laview-object-example.glade @@ -22,7 +22,7 @@ True True True - + True @@ -38,7 +38,7 @@ True True True - + True @@ -54,7 +54,7 @@ True True True - + True @@ -70,7 +70,7 @@ True True True - + True @@ -174,7 +174,7 @@ True True True - + True @@ -190,7 +190,7 @@ True True True - + True @@ -206,7 +206,7 @@ True True True - + True @@ -230,7 +230,7 @@ True False - Object Plugin Preferences + Object Example Plugin Preferences