1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
/**
* This class represents the plugin interface. Subclass Gazette.Plugin to create a new plugin.
* Plugins will be assigned a {@link Gazette.Service} that will be on variable service.
* Plugins have to use Gazette.Service methods in order to display contents on it.
* @see Gazette.Service for more information.
*
*
*/
public abstract class Gazette.Plugin.Base : Object {
/**
* Connect to this signal to do any cleanup before being disabled.
*/
public signal void destroy ();
public string id { get; protected set;}
public string name {get; protected set;}
/**
* Creates a new {@link Service}.
*/
public abstract Service create_service () {}
/**
* Place here all the code necessary to update the service.
* This method is guarranteed to be called at least once.
* If you want your service to auto-update on a time basis
* add a call to {@link GLib.Timeout} in {@link create_service}.
* @see GLib.Timeout
* @since 0.1
*/
public abstract bool update ();
public void set_update_interval (int ms) {
Timeout.add(ms, update);
}
public Service service;
/*TODO Make all services use ellipsize by default, this should be done using
*Clutter.Text. We may migrate ShadowedLabel to Clutter.Text if possible
*since it allows native clutter support.
*/
public static string ellipsize (string s, int max_length) {
string ret = s;
if (ret.length > max_length)
ret = ret.substring (0, ret.index_of_nth_char(max_length-3)) + "...";
return ret;
}
}
|