In progress...
This commit is contained in:
parent
3fe8c2cf27
commit
4e30ad10f6
138
src/main.vala
138
src/main.vala
@ -2,79 +2,81 @@ using LAview, Core, GObject.Plugins;
|
|||||||
|
|
||||||
extern const string GETTEXT_PACKAGE;
|
extern const string GETTEXT_PACKAGE;
|
||||||
|
|
||||||
/**
|
namespace LAview.Core.Plugins {
|
||||||
* Plugin of type A1.
|
|
||||||
*/
|
|
||||||
public class PluginDataExample : PluginData {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new ``PluginDataExample``.
|
* Plugin of type A1.
|
||||||
*/
|
*/
|
||||||
construct {
|
public class PluginDataExample : PluginData {
|
||||||
// Initialize the data object, open database connection for example.
|
|
||||||
stdout.puts ("PluginDataExample init () called\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroys the ``PluginDataExample``.
|
* Constructs a new ``PluginDataExample``.
|
||||||
*/
|
*/
|
||||||
~PluginDataExample () {
|
construct {
|
||||||
// Deinitialize the data object, close database connection for example.
|
// Initialize the data object, open database connection for example.
|
||||||
stdout.puts ("PluginDataExample deinit () called\n");
|
stdout.puts ("PluginDataExample init () called\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get plugin name.
|
* Destroys the ``PluginDataExample``.
|
||||||
*/
|
*/
|
||||||
public override string get_name () {
|
~PluginDataExample () {
|
||||||
return "DataExample";
|
// Deinitialize the data object, close database connection for example.
|
||||||
}
|
stdout.puts ("PluginDataExample deinit () called\n");
|
||||||
|
}
|
||||||
/**
|
|
||||||
* Any abstract method realization for PluginData.
|
/**
|
||||||
*/
|
* Get plugin name.
|
||||||
public override string get_readable_name () {
|
*/
|
||||||
return _("Data Example");
|
public override string get_name () {
|
||||||
}
|
return "DataExample";
|
||||||
|
}
|
||||||
/**
|
|
||||||
* transfer string data
|
/**
|
||||||
*/
|
* Any abstract method realization for PluginData.
|
||||||
public string get_string_data (string id) {
|
*/
|
||||||
switch (id) {
|
public override string get_readable_name () {
|
||||||
case "SampleRequest": return "Sample Answer";
|
return _("Data Example");
|
||||||
case "AnotherRequest": return "Another Answer";
|
}
|
||||||
case "Manual.SampleRequest": return "Manual Sample Answer";
|
|
||||||
case "MainChart":
|
/**
|
||||||
var cache_dir = (host as IHostCore).get_cache_dir ();
|
* transfer string data
|
||||||
// TODO: save picture in path: cache_dir + "MainChart.png";
|
*/
|
||||||
|
public string get_string_data (string id) {
|
||||||
return "MainChart";
|
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"},
|
||||||
|
};
|
||||||
}
|
}
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
[ModuleInit]
|
||||||
* transfer array1D data
|
Type plugin_init (GLib.TypeModule type_module) {
|
||||||
*/
|
return typeof (PluginDataExample);
|
||||||
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 (PluginDataExample);
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user