Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace Alm {
- [DBus (name = "org.gnome.zeitgeist.Blacklist")]
- interface BlacklistInterface : Object {
- public abstract void add_template (string blacklist_id, Variant blacklist_template) throws IOError;
- public abstract HashTable<string, Variant> get_templates () throws IOError;
- public abstract void remove_template(string blacklist_id) throws IOError;
- public signal void template_added(string blacklist_id, Variant blacklist_template);
- public signal void template_removed(string blacklist_id, Variant blacklist_template);
- }
- public class Blacklist {
- private BlacklistInterface blacklist;
- private HashTable<string, Event> blacklists;
- // Incognito
- private string incognito_id = "block-all";
- private Event incognito_event = new Event();
- public Blacklist () {
- blacklist = Bus.get_proxy_sync (BusType.SESSION, "org.gnome.zeitgeist.Engine",
- "/org/gnome/zeitgeist/blacklist");
- blacklist.template_added.connect(on_template_added);
- blacklist.template_removed.connect(on_template_removed);
- }
- public signal void template_added(string blacklist_id, Event blacklist_template);
- public signal void template_removed(string blacklist_id, Event blacklist_template);
- public signal void incognito_toggled(bool status);
- public void add_template (string blacklist_id, Event blacklist_template) {
- blacklist.add_template(blacklist_id, blacklist_template.to_variant());
- }
- public HashTable<string, Event> get_templates() {
- HashTable<string, Variant> var_blacklists = blacklist.get_templates();
- blacklists = new HashTable<string, Event>(null, null);
- foreach(var val in var_blacklists.get_values()) {
- //debug("Checking if event is container: %s", (val == null).to_string());
- debug("Event type: %s", (val.get_type_string()).to_string());
- }
- List<string> keys = var_blacklists.get_keys();
- foreach(var key in keys) {
- debug("Vaiant Key: %s", key);
- //debug("Checking if event is null: %s", (var_blacklists.get(key) == null).to_string());
- blacklists.insert(key, new Event.from_variant(var_blacklists.get(key)));
- }
- return blacklists;
- }
- }
Add Comment
Please, Sign In to add comment