From a07a88311d4efbaa8682354c199910a8d96eb0a7 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Thu, 24 Jun 2010 01:25:13 +0100 Subject: attempting to subscribe to client desktop file path notifications --- src/Makefile.am | 3 +- src/familiar-players-db.vala | 152 +++++++++++++++++++++++++++++++++++++++++++ src/music-player-bridge.vala | 45 ++++++++----- src/sound-service.c | 4 +- 4 files changed, 185 insertions(+), 19 deletions(-) create mode 100644 src/familiar-players-db.vala diff --git a/src/Makefile.am b/src/Makefile.am index a2a54e8..685ef71 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -57,7 +57,8 @@ music_bridge_VALASOURCES = \ player-controller.vala \ mpris-controller-v2.vala \ mpris-controller.vala \ - player-item.vala + player-item.vala \ + familiar-players-db.vala music_bridge_VALAFLAGS = \ --ccode \ diff --git a/src/familiar-players-db.vala b/src/familiar-players-db.vala new file mode 100644 index 0000000..5ed209b --- /dev/null +++ b/src/familiar-players-db.vala @@ -0,0 +1,152 @@ +/* +Copyright 2010 Canonical Ltd. + +Authors: + Conor Curran + +This program is free software: you can redistribute it and/or modify it +under the terms of the GNU General Public License version 3, as published +by the Free Software Foundation. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranties of +MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR +PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program. If not, see . +*/ + +using Gee; +using GLib.Path; +using GLib.DirUtils; +using GLib.FileUtils; +using GLib.Timeout; +using GLib.Environment; + +// TODO: more refactoring needed here +public class FamiliarPlayersDB : GLib.Object +{ + private const string GROUP_NAME = "Seen Database"; + private const string KEY_NAME = "DesktopFiles"; + private HashMap players_DB; + private string file_name; + private string dir_name; + private KeyFile key_file; + private uint write_id; + + public FamiliarPlayersDB() + { + this.write_id = 0; + this.players_DB = new HashMap(); + this.dir_name = build_filename(get_user_cache_dir(), "indicators", "sound"); + this.file_name = build_filename(this.dir_name, "familiar-players-db.keyfile"); + if(create_key_file() && check_for_keys() && load_data_from_key_file()){ + debug("keyfiles in place and ready for action"); + } + else{ + this.key_file = null; + warning("FamiliarPlayersDB:: problems loading key file - can't go any further"); + } + } + + private bool create_key_file(){ + if (test(this.file_name, GLib.FileTest.EXISTS)) { + this.key_file = new KeyFile(); + try{ + if (this.key_file.load_from_file(this.file_name, KeyFileFlags.NONE) == true) { + return true; + } + } + catch(FileError e){ + warning("FamiliarPlayersDB - error trying to load KeyFile"); + } + } + return false; + } + + private bool check_for_keys(){ + try{ + if(this.key_file.has_key(GROUP_NAME, KEY_NAME) == true){ + return true; + } + } + catch(KeyFileError e){ + return false; + } + warning("Seen DB '%s' does not have key '%s' in group '%s'", this.file_name, KEY_NAME, GROUP_NAME); + return false; + } + + private bool load_data_from_key_file() + { + try{ + string[] desktops = this.key_file.get_string_list(GROUP_NAME, + KEY_NAME); + + int i = 0; + while (desktops[i] != null) { + this.players_DB.set(desktops[i], true); + } + return true; + } + catch(FileError error){ + warning("Error loading the Desktop string list"); + return false; + } + } + + private bool write_db() + { + KeyFile keyfile = new KeyFile(); + string[] desktops = {}; + //Set keys = this.players_DB.keys; + foreach(string key in this.players_DB.keys){ + desktops += key; + } + keyfile.set_string_list(GROUP_NAME, + KEY_NAME, + desktops); + size_t data_length; + string data = null; + try{ + data = keyfile.to_data(out data_length); + } + catch(Error e){ + warning("Problems dumping keyfile to a string"); + return false; + } + + if(create_with_parents(this.dir_name, 0700) != 0){ + warning("Unable to make directory: %s", this.dir_name); + return false; + } + + try{ + if(set_contents(this.file_name, data, (ssize_t)data_length) == false){ + warning("Unable to write out file '%s'", this.file_name); + } + } + catch(FileError err){ + warning("Unable to write out file '%s'", this.file_name); + } + return true; + } + + public void db_add(string desktop) + { + if(already_familiar(desktop) == false){ + if(this.write_id != 0){ + Source.remove(this.write_id); + this.write_id = 0; + } + this.write_id = Timeout.add_seconds(60, write_db); + this.players_DB.set(desktop.dup(), true); + } + } + + public bool already_familiar(string desktop) + { + return this.players_DB.get(desktop); + } +} \ No newline at end of file diff --git a/src/music-player-bridge.vala b/src/music-player-bridge.vala index b03ecbd..fb63866 100644 --- a/src/music-player-bridge.vala +++ b/src/music-player-bridge.vala @@ -1,5 +1,4 @@ /* -This service primarily controls PulseAudio and is driven by the sound indicator menu on the panel. Copyright 2010 Canonical Ltd. Authors: @@ -28,9 +27,11 @@ public class MusicPlayerBridge : GLib.Object private Listener listener; private Dbusmenu.Menuitem root_menu; private HashMap registered_clients; + private FamiliarPlayersDB playersDB; public MusicPlayerBridge() { + playersDB = new FamiliarPlayersDB(); registered_clients = new HashMap (); listener = Listener.ref_default(); listener.indicator_added.connect(on_indicator_added); @@ -46,26 +47,24 @@ public class MusicPlayerBridge : GLib.Object root_menu = menu; } - public void on_indicator_added(Indicate.ListenerServer object, Indicate.ListenerIndicator p0) - { - debug("MusicPlayerBridge-> on_indicator_added"); - } - - public void on_indicator_removed(Indicate.ListenerServer object, Indicate.ListenerIndicator p0) - { - debug("MusicPlayerBridge -> on_indicator_removed"); - } - - public void on_indicator_modified(Indicate.ListenerServer object, Indicate.ListenerIndicator p0, string s) - { - debug("MusicPlayerBridge -> indicator_modified with vale %s", s ); - } +//static void +//desktop_cb (IndicateListener * listener, IndicateListenerServer * server, gchar * value, gpointer data) - public void on_server_added(Indicate.ListenerServer object, string type) + public void desktop_info_callback(Indicate.Listener listener, + Indicate.ListenerServer server, + owned string value, void* data) + { + + } + + public void on_server_added(Indicate.ListenerServer object, string type) { debug("MusicPlayerBridge -> on_server_added with value %s", type); if(server_is_not_of_interest(type)) return; string client_name = type.split(".")[1]; + listener_get_server_property_cb cb = (listener_get_server_property_cb)desktop_info_callback; + this.listener.server_get_desktop(object, cb); + if (root_menu != null && client_name != null){ PlayerController ctrl = new PlayerController(root_menu, client_name, true); registered_clients.set(client_name, ctrl); @@ -98,6 +97,20 @@ public class MusicPlayerBridge : GLib.Object { debug("MusicPlayerBridge-> on_server_count_changed with value %u", i); } + public void on_indicator_added(Indicate.ListenerServer object, Indicate.ListenerIndicator p0) + { + debug("MusicPlayerBridge-> on_indicator_added"); + } + + public void on_indicator_removed(Indicate.ListenerServer object, Indicate.ListenerIndicator p0) + { + debug("MusicPlayerBridge -> on_indicator_removed"); + } + + public void on_indicator_modified(Indicate.ListenerServer object, Indicate.ListenerIndicator p0, string s) + { + debug("MusicPlayerBridge -> indicator_modified with vale %s", s ); + } } diff --git a/src/sound-service.c b/src/sound-service.c index bcdac07..ea04e4b 100644 --- a/src/sound-service.c +++ b/src/sound-service.c @@ -45,8 +45,8 @@ service_shutdown (IndicatorService *service, gpointer user_data) if (mainloop != NULL) { g_debug("Service shutdown !"); // TODO: uncomment for release !! - close_pulse_activites(); - g_main_loop_quit(mainloop); + //close_pulse_activites(); + //g_main_loop_quit(mainloop); } return; } -- cgit v1.2.3 From 98c55dde34ae7ed062ae22712b998ef4787b14ee Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Thu, 24 Jun 2010 14:09:49 +0100 Subject: record of played application being stored correctly in keyfile --- configure.ac | 4 ++-- src/Makefile.am | 2 +- src/familiar-players-db.vala | 9 +++++++-- src/music-player-bridge.vala | 40 ++++++++++++++++++++++------------------ src/player-item.vala | 19 +++++++++++++++++-- 5 files changed, 49 insertions(+), 25 deletions(-) diff --git a/configure.ac b/configure.ac index e55123e..781e815 100644 --- a/configure.ac +++ b/configure.ac @@ -1,10 +1,10 @@ -AC_INIT(indicator-sound, 0.3.1, conor.curran@canonical.com) +AC_INIT(indicator-sound, 0.3.2, conor.curran@canonical.com) AC_PREREQ(2.53) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(indicator-sound, 0.3.1) +AM_INIT_AUTOMAKE(indicator-sound, 0.3.2) AM_MAINTAINER_MODE diff --git a/src/Makefile.am b/src/Makefile.am index 685ef71..e64d13d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -64,8 +64,8 @@ music_bridge_VALAFLAGS = \ --ccode \ -H music-player-bridge.h -d . \ --library music-bridge \ + --vapidir=$(top_srcdir)/vapi/ \ --vapidir=./ \ - --vapidir=../vapi/ \ --thread \ --pkg gee-1.0 \ --pkg Indicate-0.2 \ diff --git a/src/familiar-players-db.vala b/src/familiar-players-db.vala index 5ed209b..3d7da1f 100644 --- a/src/familiar-players-db.vala +++ b/src/familiar-players-db.vala @@ -100,7 +100,6 @@ public class FamiliarPlayersDB : GLib.Object { KeyFile keyfile = new KeyFile(); string[] desktops = {}; - //Set keys = this.players_DB.keys; foreach(string key in this.players_DB.keys){ desktops += key; } @@ -133,7 +132,7 @@ public class FamiliarPlayersDB : GLib.Object return true; } - public void db_add(string desktop) + public void insert(string desktop) { if(already_familiar(desktop) == false){ if(this.write_id != 0){ @@ -149,4 +148,10 @@ public class FamiliarPlayersDB : GLib.Object { return this.players_DB.get(desktop); } + + public Gee.Set records() + { + return this.players_DB.keys; + } + } \ No newline at end of file diff --git a/src/music-player-bridge.vala b/src/music-player-bridge.vala index fb63866..02333a6 100644 --- a/src/music-player-bridge.vala +++ b/src/music-player-bridge.vala @@ -32,6 +32,7 @@ public class MusicPlayerBridge : GLib.Object public MusicPlayerBridge() { playersDB = new FamiliarPlayersDB(); + try_to_add_inactive_familiar_clients(); registered_clients = new HashMap (); listener = Listener.ref_default(); listener.indicator_added.connect(on_indicator_added); @@ -42,30 +43,20 @@ public class MusicPlayerBridge : GLib.Object listener.server_count_changed.connect(on_server_count_changed); } - public void set_root_menu_item(Dbusmenu.Menuitem menu) - { - root_menu = menu; - } - -//static void -//desktop_cb (IndicateListener * listener, IndicateListenerServer * server, gchar * value, gpointer data) - - public void desktop_info_callback(Indicate.Listener listener, - Indicate.ListenerServer server, - owned string value, void* data) - { - + private void try_to_add_inactive_familiar_clients(){ + //foreach(string app in this.playersDB.records()){ + // + //} } public void on_server_added(Indicate.ListenerServer object, string type) { debug("MusicPlayerBridge -> on_server_added with value %s", type); if(server_is_not_of_interest(type)) return; - string client_name = type.split(".")[1]; - listener_get_server_property_cb cb = (listener_get_server_property_cb)desktop_info_callback; - this.listener.server_get_desktop(object, cb); - + string client_name = type.split(".")[1]; if (root_menu != null && client_name != null){ + listener_get_server_property_cb cb = (listener_get_server_property_cb)desktop_info_callback; + this.listener.server_get_desktop(object, cb, this); PlayerController ctrl = new PlayerController(root_menu, client_name, true); registered_clients.set(client_name, ctrl); debug("client of name %s has successfully registered with us", client_name); @@ -93,7 +84,20 @@ public class MusicPlayerBridge : GLib.Object return false; } - public void on_server_count_changed(Indicate.ListenerServer object, uint i) + private void desktop_info_callback(Indicate.ListenerServer server, + owned string path, void* data) + { + debug("we got a desktop file path hopefully: %s", path); + MusicPlayerBridge bridge = data as MusicPlayerBridge; + bridge.playersDB.insert(path); + } + + public void set_root_menu_item(Dbusmenu.Menuitem menu) + { + root_menu = menu; + } + + public void on_server_count_changed(Indicate.ListenerServer object, uint i) { debug("MusicPlayerBridge-> on_server_count_changed with value %u", i); } diff --git a/src/player-item.vala b/src/player-item.vala index 09b0e6b..d1cf08c 100644 --- a/src/player-item.vala +++ b/src/player-item.vala @@ -28,17 +28,32 @@ public class PlayerItem : Dbusmenu.Menuitem { } + private static bool ensure_valid_updates(HashTable data, HashSet attributes) + { + if(data == null){ + return false; + } + if(data.size() < attributes.size){ + warning("update hash was too small for the target"); + return false; + } + return true; + } + public void update(HashTable data, HashSet attributes) { debug("PlayerItem::update()"); + if(ensure_valid_updates(data, attributes) == false){ + debug("PlayerItem::Update -> update hash is not what we were expecting"); + return; + } foreach(string property in attributes){ string[] input_keys = property.split("-"); string search_key = input_keys[input_keys.length-1 : input_keys.length][0]; debug("search key = %s", search_key); - Value v = data.lookup(search_key); - if (v.holds (typeof (string))){ + debug("with value : %s", v.get_string()); this.property_set(property, this.sanitize_string(v.get_string())); } else if (v.holds (typeof (int))){ -- cgit v1.2.3 From 81d9af3fc3f1d3784e623ede592e6d91032353ad Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Thu, 24 Jun 2010 17:23:39 +0100 Subject: moving towards offline application launching --- src/Makefile.am | 3 ++- src/familiar-players-db.vala | 9 +++------ src/metadata-menu-item.vala | 11 +++++++++++ src/music-player-bridge.vala | 35 +++++++++++++++++++++++++++++------ src/player-controller.vala | 14 ++++++-------- src/player-item.vala | 31 ++++++++++++++++++------------- src/sound-service.c | 4 ++-- src/transport-menu-item.vala | 5 +++++ 8 files changed, 76 insertions(+), 36 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index e64d13d..8805ff9 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -71,7 +71,8 @@ music_bridge_VALAFLAGS = \ --pkg Indicate-0.2 \ --pkg Dbusmenu-Glib-0.2 \ --pkg common-defs \ - --pkg dbus-glib-1 + --pkg dbus-glib-1 \ + --pkg gio-unix-2.0 $(MAINTAINER_VALAFLAGS) diff --git a/src/familiar-players-db.vala b/src/familiar-players-db.vala index 3d7da1f..88bc01f 100644 --- a/src/familiar-players-db.vala +++ b/src/familiar-players-db.vala @@ -78,15 +78,12 @@ public class FamiliarPlayersDB : GLib.Object return false; } - private bool load_data_from_key_file() - { + private bool load_data_from_key_file(){ try{ string[] desktops = this.key_file.get_string_list(GROUP_NAME, KEY_NAME); - - int i = 0; - while (desktops[i] != null) { - this.players_DB.set(desktops[i], true); + foreach(string s in desktops){ + this.players_DB.set(s, true); } return true; } diff --git a/src/metadata-menu-item.vala b/src/metadata-menu-item.vala index f62cd46..541fbf4 100644 --- a/src/metadata-menu-item.vala +++ b/src/metadata-menu-item.vala @@ -37,5 +37,16 @@ public class MetadataMenuitem : PlayerItem attrs.add(MENUITEM_ARTURL); return attrs; } + + public override void check_layout(){ + this.property_set_bool(MENUITEM_PROP_VISIBLE, this.populated()); + debug("check layout for the metadata = %s", this.populated().to_string()); + } + + public bool populated() + { + return (this.property_get(MENUITEM_TEXT_TITLE) != null && + this.property_get(MENUITEM_TEXT_TITLE) != ""); + } } \ No newline at end of file diff --git a/src/music-player-bridge.vala b/src/music-player-bridge.vala index 02333a6..6fc9032 100644 --- a/src/music-player-bridge.vala +++ b/src/music-player-bridge.vala @@ -20,6 +20,7 @@ with this program. If not, see . using Indicate; using Dbusmenu; using Gee; +using GLib; public class MusicPlayerBridge : GLib.Object { @@ -32,7 +33,6 @@ public class MusicPlayerBridge : GLib.Object public MusicPlayerBridge() { playersDB = new FamiliarPlayersDB(); - try_to_add_inactive_familiar_clients(); registered_clients = new HashMap (); listener = Listener.ref_default(); listener.indicator_added.connect(on_indicator_added); @@ -42,11 +42,33 @@ public class MusicPlayerBridge : GLib.Object listener.server_removed.connect(on_server_removed); listener.server_count_changed.connect(on_server_count_changed); } - + // Alpha 2 not in use ... yet. private void try_to_add_inactive_familiar_clients(){ - //foreach(string app in this.playersDB.records()){ - // - //} + // for now just use one of the entries. + int count = 0; + foreach(string app in this.playersDB.records()){ + if(count == 0){ + debug("we have found %s", app); + string[] bits = app.split("/"); + + try{ + string app_name = bits[bits.length -1].split(".")[0]; + debug("we have found %s", app_name); + PlayerController ctrl = new PlayerController(this.root_menu, + app_name, + false); + this.registered_clients.set(app_name, ctrl); + DesktopAppInfo info = new DesktopAppInfo.from_filename(app_name); + string desc = info.get_display_name(); + debug("description from app %s", desc); + count += 1; + } + catch(Error er){ + warning("desktop path in cache is not formatted as we have anticipated"); + } + } + break; + } } public void on_server_added(Indicate.ListenerServer object, string type) @@ -94,7 +116,8 @@ public class MusicPlayerBridge : GLib.Object public void set_root_menu_item(Dbusmenu.Menuitem menu) { - root_menu = menu; + this.root_menu = menu; + //try_to_add_inactive_familiar_clients(); } public void on_server_count_changed(Indicate.ListenerServer object, uint i) diff --git a/src/player-controller.vala b/src/player-controller.vala index 862bb29..0d8dc01 100644 --- a/src/player-controller.vala +++ b/src/player-controller.vala @@ -31,7 +31,8 @@ public class PlayerController : GLib.Object private bool is_active; public ArrayList custom_items; private MprisController mpris_adaptor; - + private string desktop_path; + public PlayerController(Dbusmenu.Menuitem root, string client_name, bool active) { this.root_menu = root; @@ -48,6 +49,10 @@ public class PlayerController : GLib.Object this.mpris_adaptor = new MprisController(this.name, this); } this.custom_items[TRANSPORT].set_adaptor(this.mpris_adaptor); + + // At start up if there is no metadata then hide the item. + // TODO: NOT working -> dbus menu bug ? + //((MetadataMenuitem)this.custom_items[METADATA]).check_layout(); } public void vanish() @@ -80,13 +85,6 @@ public class PlayerController : GLib.Object return true; } - //public void update_playing_info(HashMap data) - //{ - // debug("PlayerController - update_playing_info"); - // MetadataMenuitem item = this.custom_items[METADATA] as MetadataMenuitem; - // item.update(data, MetadataMenuitem.attributes_format()); - //} - private static string format_client_name(string client_name) { string formatted = client_name; diff --git a/src/player-item.vala b/src/player-item.vala index d1cf08c..7fcf912 100644 --- a/src/player-item.vala +++ b/src/player-item.vala @@ -27,24 +27,12 @@ public class PlayerItem : Dbusmenu.Menuitem public PlayerItem() { } - - private static bool ensure_valid_updates(HashTable data, HashSet attributes) - { - if(data == null){ - return false; - } - if(data.size() < attributes.size){ - warning("update hash was too small for the target"); - return false; - } - return true; - } public void update(HashTable data, HashSet attributes) { debug("PlayerItem::update()"); if(ensure_valid_updates(data, attributes) == false){ - debug("PlayerItem::Update -> update hash is not what we were expecting"); + debug("PlayerItem::Update -> The hashtable update does not contain what we were expecting - just leave it!"); return; } foreach(string property in attributes){ @@ -64,6 +52,8 @@ public class PlayerItem : Dbusmenu.Menuitem this.property_set_bool(property, v.get_boolean()); } } + // TODO: not working + //this.check_layout(); } public void set_adaptor(MprisController adaptor) @@ -71,6 +61,17 @@ public class PlayerItem : Dbusmenu.Menuitem this.mpris_adaptor = adaptor; } + private static bool ensure_valid_updates(HashTable data, HashSet attributes) + { + if(data == null){ + return false; + } + if(data.size() < attributes.size){ + warning("update hash was too small for the target"); + return false; + } + return true; + } public static string sanitize_string(string st) { @@ -100,5 +101,9 @@ public class PlayerItem : Dbusmenu.Menuitem separator.property_set(MENUITEM_PROP_TYPE, CLIENT_TYPES_SEPARATOR); return separator; } + + public virtual void check_layout(){ + warning("this should not be hit"); + } } diff --git a/src/sound-service.c b/src/sound-service.c index ea04e4b..bcdac07 100644 --- a/src/sound-service.c +++ b/src/sound-service.c @@ -45,8 +45,8 @@ service_shutdown (IndicatorService *service, gpointer user_data) if (mainloop != NULL) { g_debug("Service shutdown !"); // TODO: uncomment for release !! - //close_pulse_activites(); - //g_main_loop_quit(mainloop); + close_pulse_activites(); + g_main_loop_quit(mainloop); } return; } diff --git a/src/transport-menu-item.vala b/src/transport-menu-item.vala index 39a0cab..264e153 100644 --- a/src/transport-menu-item.vala +++ b/src/transport-menu-item.vala @@ -41,6 +41,11 @@ public class TransportMenuitem : PlayerItem this.mpris_adaptor.toggle_playback(input_value.get_boolean()); } + public override void check_layout(){ + // nothing to be done for this item - always active + } + + public static HashSet attributes_format() { HashSet attrs = new HashSet(); -- cgit v1.2.3 From 1d721c275ba6962d60f47b184849db7bd2a5290a Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Thu, 24 Jun 2010 17:24:29 +0100 Subject: and my hacked indicate vapi --- vapi/Indicate-0.2.vapi | 218 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 218 insertions(+) create mode 100644 vapi/Indicate-0.2.vapi diff --git a/vapi/Indicate-0.2.vapi b/vapi/Indicate-0.2.vapi new file mode 100644 index 0000000..1381037 --- /dev/null +++ b/vapi/Indicate-0.2.vapi @@ -0,0 +1,218 @@ +/* Indicate-0.2.vapi generated by vapigen, do not modify. */ + +[CCode (cprefix = "Indicate", lower_case_cprefix = "indicate_")] +namespace Indicate { + [CCode (cheader_filename = "libindicate/./indicator-messages.h,libindicate/./indicator.h,libindicate/./interests.h,libindicate/./listener.h,libindicate/./server.h")] + public class Indicator : GLib.Object { + public weak GLib.Object parent; + [CCode (has_construct_function = false)] + public Indicator (); + public bool get_displayed (); + public uint get_id (); + public virtual GLib.Value get_property (string key); + public GLib.Value get_property_value (string key); + public Indicate.Server get_server (); + public bool is_visible (); + public string[] list_properties (); + public void set_displayed (bool displayed); + public virtual void set_property (string key, GLib.Value data); + public void set_property_bool (string key, bool value); + public void set_property_int (string key, int value); + public void set_property_time (string key, GLib.TimeVal time); + public void set_property_value (string key, GLib.Value value); + public void set_server (Indicate.Server server); + [CCode (has_construct_function = false)] + public Indicator.with_server (Indicate.Server server); + public signal void displayed (bool object); + [HasEmitter] + public signal void hide (); + public signal void modified (string object); + [HasEmitter] + public signal void show (); + [HasEmitter] + public signal void user_display (uint object); + } + [CCode (cheader_filename = "libindicate/./indicator-messages.h,libindicate/./indicator.h,libindicate/./interests.h,libindicate/./listener.h,libindicate/./server.h")] + public class Listener : GLib.Object { + public weak GLib.Object parent; + [CCode (has_construct_function = false)] + public Listener (); + public void display (Indicate.ListenerServer server, Indicate.ListenerIndicator indicator, uint timestamp); + public void displayed (Indicate.ListenerServer server, Indicate.ListenerIndicator indicator, bool displayed); + public void get_property (Indicate.ListenerServer server, Indicate.ListenerIndicator indicator, owned string property, [CCode (delegate_target_pos = 0)] Indicate.listener_get_property_cb callback); + public void get_property_bool (Indicate.ListenerServer server, Indicate.ListenerIndicator indicator, owned string property, [CCode (delegate_target_pos = 0)] Indicate.listener_get_property_bool_cb callback); + public void get_property_int (Indicate.ListenerServer server, Indicate.ListenerIndicator indicator, owned string property, [CCode (delegate_target_pos = 0)] Indicate.listener_get_property_int_cb callback); + public void get_property_time (Indicate.ListenerServer server, Indicate.ListenerIndicator indicator, owned string property, [CCode (delegate_target_pos = 0)] Indicate.listener_get_property_time_cb callback); + public void get_property_value (Indicate.ListenerServer server, Indicate.ListenerIndicator indicator, owned string property, [CCode (delegate_target_pos = 0)] Indicate.listener_get_property_value_cb callback); + public static GLib.Type indicator_get_gtype (); + public static Indicate.Listener ref_default (); + public bool server_check_interest (Indicate.ListenerServer server, Indicate.Interests interest); + public void server_get_count (Indicate.ListenerServer server, [CCode (delegate_target_pos = 0)] Indicate.listener_get_server_uint_property_cb callback); + public void server_get_desktop (Indicate.ListenerServer server, [CCode (delegate_target_pos = 0)] Indicate.listener_get_server_property_cb callback, void* data); + public static GLib.Type server_get_gtype (); + public void server_get_menu (Indicate.ListenerServer server, [CCode (delegate_target_pos = 0)] Indicate.listener_get_server_property_cb callback); + public static void server_get_type (Indicate.Listener listener, Indicate.ListenerServer server, [CCode (delegate_target_pos = 0)] Indicate.listener_get_server_property_cb callback); + public void server_remove_interest (Indicate.ListenerServer server, Indicate.Interests interest); + public void server_show_interest (Indicate.ListenerServer server, Indicate.Interests interest); + public void set_default_max_indicators (int max); + public void set_server_max_indicators (Indicate.ListenerServer server, int max); + public signal void indicator_added (Indicate.ListenerServer object, Indicate.ListenerIndicator p0); + public signal void indicator_modified (Indicate.ListenerServer object, Indicate.ListenerIndicator p0, string p1); + public signal void indicator_removed (Indicate.ListenerServer object, Indicate.ListenerIndicator p0); + public signal void indicator_servers_report (); + public signal void server_added (Indicate.ListenerServer object, string p0); + public signal void server_count_changed (Indicate.ListenerServer object, uint p0); + public signal void server_removed (Indicate.ListenerServer object, string p0); + } + [CCode (cheader_filename = "libindicate/./indicator-messages.h,libindicate/./indicator.h,libindicate/./interests.h,libindicate/./listener.h,libindicate/./server.h")] + public class Server : GLib.Object { + public weak GLib.Object parent; + public void add_indicator (Indicate.Indicator indicator); + public virtual bool check_interest (Indicate.Interests interest); + public virtual bool get_indicator_count (out uint count) throws GLib.Error; + public virtual bool get_indicator_property (uint id, owned string property, GLib.Value value) throws GLib.Error; + public int get_max_indicators (); + public virtual uint get_next_id (); + public void hide (); + public virtual void indicator_added (uint id); + public virtual bool indicator_displayed (owned string sender, uint id, bool displayed) throws GLib.Error; + public virtual void indicator_removed (uint id); + public virtual int max_indicators_get (); + public virtual bool max_indicators_set (owned string sender, int max); + public static Indicate.Server ref_default (); + public void remove_indicator (Indicate.Indicator indicator); + public virtual bool remove_interest (owned string sender, Indicate.Interests interest); + public void set_count (uint count); + public static void set_dbus_object (string obj); + public void set_default (); + public void set_desktop_file (string path); + public void set_menu (Dbusmenu.Server menu); + public void set_type (string type); + public void show (); + public virtual bool show_indicator_to_user (uint id, uint timestamp) throws GLib.Error; + public virtual bool show_interest (owned string sender, Indicate.Interests interest); + public uint count { get; set; } + public string desktop { get; set; } + public string type { get; set; } + public signal void indicator_delete (uint object); + public signal void indicator_modified (uint object, string p0); + public signal void indicator_new (uint object); + public signal void interest_added (uint object); + public signal void interest_removed (uint object); + public signal void max_indicators_changed (int object); + public signal void server_count_changed (uint object); + public signal void server_display (uint object); + public signal void server_hide (string object); + public signal void server_show (string object); + } + [CCode (type_id = "INDICATE_TYPE_LISTENER_INDICATOR", cheader_filename = "libindicate/./indicator-messages.h,libindicate/./indicator.h,libindicate/./interests.h,libindicate/./listener.h,libindicate/./server.h")] + public struct ListenerIndicator { + public uint get_id (); + } + [CCode (type_id = "INDICATE_TYPE_LISTENER_SERVER", cheader_filename = "libindicate/./indicator-messages.h,libindicate/./indicator.h,libindicate/./interests.h,libindicate/./listener.h,libindicate/./server.h")] + public struct ListenerServer { + public unowned string get_dbusname (); + } + [CCode (cprefix = "INDICATE_INTEREST_", cheader_filename = "libindicate/./indicator-messages.h,libindicate/./indicator.h,libindicate/./interests.h,libindicate/./listener.h,libindicate/./server.h")] + public enum Interests { + NONE, + SERVER_DISPLAY, + SERVER_SIGNAL, + INDICATOR_DISPLAY, + INDICATOR_SIGNAL, + INDICATOR_COUNT, + LAST + } + [CCode (cheader_filename = "libindicate/./indicator-messages.h,libindicate/./indicator.h,libindicate/./interests.h,libindicate/./listener.h,libindicate/./server.h", has_target = false)] + public delegate string[] indicator_list_properties_slot_t (Indicate.Indicator indicator); + [CCode (cheader_filename = "libindicate/./indicator-messages.h,libindicate/./indicator.h,libindicate/./interests.h,libindicate/./listener.h,libindicate/./server.h", has_target = false)] + public delegate void listener_get_property_bool_cb (Indicate.Listener listener, Indicate.ListenerServer server, Indicate.ListenerIndicator indicator, owned string property, bool propertydata, void* data); + [CCode (cheader_filename = "libindicate/./indicator-messages.h,libindicate/./indicator.h,libindicate/./interests.h,libindicate/./listener.h,libindicate/./server.h", has_target = false)] + public delegate void listener_get_property_cb (Indicate.Listener listener, Indicate.ListenerServer server, Indicate.ListenerIndicator indicator, owned string property, string propertydata, void* data); + [CCode (cheader_filename = "libindicate/./indicator-messages.h,libindicate/./indicator.h,libindicate/./interests.h,libindicate/./listener.h,libindicate/./server.h", has_target = false)] + public delegate void listener_get_property_int_cb (Indicate.Listener listener, Indicate.ListenerServer server, Indicate.ListenerIndicator indicator, owned string property, int propertydata, void* data); + [CCode (cheader_filename = "libindicate/./indicator-messages.h,libindicate/./indicator.h,libindicate/./interests.h,libindicate/./listener.h,libindicate/./server.h", has_target = false)] + public delegate void listener_get_property_time_cb (Indicate.Listener listener, Indicate.ListenerServer server, Indicate.ListenerIndicator indicator, owned string property, GLib.TimeVal propertydata, void* data); + [CCode (cheader_filename = "libindicate/./indicator-messages.h,libindicate/./indicator.h,libindicate/./interests.h,libindicate/./listener.h,libindicate/./server.h", has_target = false)] + public delegate void listener_get_property_value_cb (Indicate.Listener listener, Indicate.ListenerServer server, Indicate.ListenerIndicator indicator, owned string property, GLib.Value propertydata, void* data); + [CCode (cname ="indicate_listener_get_server_property_cb", cheader_filename = "libindicate/./indicator-messages.h,libindicate/./indicator.h,libindicate/./interests.h,libindicate/./listener.h,libindicate/./server.h", has_target = false)] + public delegate void listener_get_server_property_cb (Indicate.Listener listener, Indicate.ListenerServer server, owned string value, void* data); + [CCode (cheader_filename = "libindicate/./indicator-messages.h,libindicate/./indicator.h,libindicate/./interests.h,libindicate/./listener.h,libindicate/./server.h", has_target = false)] + public delegate void listener_get_server_uint_property_cb (Indicate.Listener listener, Indicate.ListenerServer server, uint value, void* data); + [CCode (cheader_filename = "libindicate/./indicator-messages.h,libindicate/./indicator.h,libindicate/./interests.h,libindicate/./listener.h,libindicate/./server.h", has_target = false)] + public delegate bool server_get_indicator_list_slot_t (Indicate.Server server, out unowned Indicate.Indicator[] indicators); + [CCode (cheader_filename = "libindicate/./indicator-messages.h,libindicate/./indicator.h,libindicate/./interests.h,libindicate/./listener.h,libindicate/./server.h", has_target = false)] + public delegate bool server_get_indicator_properties_slot_t (Indicate.Server server, uint id, out string[] properties); + [CCode (cheader_filename = "libindicate/./indicator-messages.h,libindicate/./indicator.h,libindicate/./interests.h,libindicate/./listener.h,libindicate/./server.h", has_target = false)] + public delegate bool server_get_indicator_property_group_slot_t (Indicate.Server server, uint id, string[] properties, out string[] value); + [CCode (cheader_filename = "libindicate/./indicator-messages.h,libindicate/./indicator.h,libindicate/./interests.h,libindicate/./listener.h,libindicate/./server.h")] + public const int INDICATOR_H_INCLUDED__; + [CCode (cheader_filename = "libindicate/./indicator-messages.h,libindicate/./indicator.h,libindicate/./interests.h,libindicate/./listener.h,libindicate/./server.h")] + public const int INDICATOR_MESSAGES_H_INCLUDED__; + [CCode (cheader_filename = "libindicate/./indicator-messages.h,libindicate/./indicator.h,libindicate/./interests.h,libindicate/./listener.h,libindicate/./server.h")] + public const string INDICATOR_MESSAGES_PROP_ATTENTION; + [CCode (cheader_filename = "libindicate/./indicator-messages.h,libindicate/./indicator.h,libindicate/./interests.h,libindicate/./listener.h,libindicate/./server.h")] + public const string INDICATOR_MESSAGES_PROP_COUNT; + [CCode (cheader_filename = "libindicate/./indicator-messages.h,libindicate/./indicator.h,libindicate/./interests.h,libindicate/./listener.h,libindicate/./server.h")] + public const string INDICATOR_MESSAGES_PROP_ICON; + [CCode (cheader_filename = "libindicate/./indicator-messages.h,libindicate/./indicator.h,libindicate/./interests.h,libindicate/./listener.h,libindicate/./server.h")] + public const string INDICATOR_MESSAGES_PROP_NAME; + [CCode (cheader_filename = "libindicate/./indicator-messages.h,libindicate/./indicator.h,libindicate/./interests.h,libindicate/./listener.h,libindicate/./server.h")] + public const string INDICATOR_MESSAGES_PROP_TIME; + [CCode (cheader_filename = "libindicate/./indicator-messages.h,libindicate/./indicator.h,libindicate/./interests.h,libindicate/./listener.h,libindicate/./server.h")] + public const string INDICATOR_MESSAGES_SERVER_TYPE; + [CCode (cheader_filename = "libindicate/./indicator-messages.h,libindicate/./indicator.h,libindicate/./interests.h,libindicate/./listener.h,libindicate/./server.h")] + public const string INDICATOR_SIGNAL_DISPLAY; + [CCode (cheader_filename = "libindicate/./indicator-messages.h,libindicate/./indicator.h,libindicate/./interests.h,libindicate/./listener.h,libindicate/./server.h")] + public const string INDICATOR_SIGNAL_DISPLAYED; + [CCode (cheader_filename = "libindicate/./indicator-messages.h,libindicate/./indicator.h,libindicate/./interests.h,libindicate/./listener.h,libindicate/./server.h")] + public const string INDICATOR_SIGNAL_HIDE; + [CCode (cheader_filename = "libindicate/./indicator-messages.h,libindicate/./indicator.h,libindicate/./interests.h,libindicate/./listener.h,libindicate/./server.h")] + public const string INDICATOR_SIGNAL_MODIFIED; + [CCode (cheader_filename = "libindicate/./indicator-messages.h,libindicate/./indicator.h,libindicate/./interests.h,libindicate/./listener.h,libindicate/./server.h")] + public const string INDICATOR_SIGNAL_SHOW; + [CCode (cheader_filename = "libindicate/./indicator-messages.h,libindicate/./indicator.h,libindicate/./interests.h,libindicate/./listener.h,libindicate/./server.h")] + public const string INDICATOR_VALUE_FALSE; + [CCode (cheader_filename = "libindicate/./indicator-messages.h,libindicate/./indicator.h,libindicate/./interests.h,libindicate/./listener.h,libindicate/./server.h")] + public const string INDICATOR_VALUE_TRUE; + [CCode (cheader_filename = "libindicate/./indicator-messages.h,libindicate/./indicator.h,libindicate/./interests.h,libindicate/./listener.h,libindicate/./server.h")] + public const int INTERESTS_H_INCLUDED__; + [CCode (cheader_filename = "libindicate/./indicator-messages.h,libindicate/./indicator.h,libindicate/./interests.h,libindicate/./listener.h,libindicate/./server.h")] + public const int LISTENER_H_INCLUDED__; + [CCode (cheader_filename = "libindicate/./indicator-messages.h,libindicate/./indicator.h,libindicate/./interests.h,libindicate/./listener.h,libindicate/./server.h")] + public const string LISTENER_SIGNAL_INDICATOR_ADDED; + [CCode (cheader_filename = "libindicate/./indicator-messages.h,libindicate/./indicator.h,libindicate/./interests.h,libindicate/./listener.h,libindicate/./server.h")] + public const string LISTENER_SIGNAL_INDICATOR_MODIFIED; + [CCode (cheader_filename = "libindicate/./indicator-messages.h,libindicate/./indicator.h,libindicate/./interests.h,libindicate/./listener.h,libindicate/./server.h")] + public const string LISTENER_SIGNAL_INDICATOR_REMOVED; + [CCode (cheader_filename = "libindicate/./indicator-messages.h,libindicate/./indicator.h,libindicate/./interests.h,libindicate/./listener.h,libindicate/./server.h")] + public const string LISTENER_SIGNAL_SERVER_ADDED; + [CCode (cheader_filename = "libindicate/./indicator-messages.h,libindicate/./indicator.h,libindicate/./interests.h,libindicate/./listener.h,libindicate/./server.h")] + public const string LISTENER_SIGNAL_SERVER_COUNT_CHANGED; + [CCode (cheader_filename = "libindicate/./indicator-messages.h,libindicate/./indicator.h,libindicate/./interests.h,libindicate/./listener.h,libindicate/./server.h")] + public const string LISTENER_SIGNAL_SERVER_REMOVED; + [CCode (cheader_filename = "libindicate/./indicator-messages.h,libindicate/./indicator.h,libindicate/./interests.h,libindicate/./listener.h,libindicate/./server.h")] + public const int SERVER_H_INCLUDED__; + [CCode (cheader_filename = "libindicate/./indicator-messages.h,libindicate/./indicator.h,libindicate/./interests.h,libindicate/./listener.h,libindicate/./server.h")] + public const int SERVER_INDICATOR_NULL; + [CCode (cheader_filename = "libindicate/./indicator-messages.h,libindicate/./indicator.h,libindicate/./interests.h,libindicate/./listener.h,libindicate/./server.h")] + public const string SERVER_SIGNAL_INDICATOR_ADDED; + [CCode (cheader_filename = "libindicate/./indicator-messages.h,libindicate/./indicator.h,libindicate/./interests.h,libindicate/./listener.h,libindicate/./server.h")] + public const string SERVER_SIGNAL_INDICATOR_MODIFIED; + [CCode (cheader_filename = "libindicate/./indicator-messages.h,libindicate/./indicator.h,libindicate/./interests.h,libindicate/./listener.h,libindicate/./server.h")] + public const string SERVER_SIGNAL_INDICATOR_REMOVED; + [CCode (cheader_filename = "libindicate/./indicator-messages.h,libindicate/./indicator.h,libindicate/./interests.h,libindicate/./listener.h,libindicate/./server.h")] + public const string SERVER_SIGNAL_INTEREST_ADDED; + [CCode (cheader_filename = "libindicate/./indicator-messages.h,libindicate/./indicator.h,libindicate/./interests.h,libindicate/./listener.h,libindicate/./server.h")] + public const string SERVER_SIGNAL_INTEREST_REMOVED; + [CCode (cheader_filename = "libindicate/./indicator-messages.h,libindicate/./indicator.h,libindicate/./interests.h,libindicate/./listener.h,libindicate/./server.h")] + public const string SERVER_SIGNAL_MAX_INDICATORS_CHANGED; + [CCode (cheader_filename = "libindicate/./indicator-messages.h,libindicate/./indicator.h,libindicate/./interests.h,libindicate/./listener.h,libindicate/./server.h")] + public const string SERVER_SIGNAL_SERVER_COUNT_CHANGED; + [CCode (cheader_filename = "libindicate/./indicator-messages.h,libindicate/./indicator.h,libindicate/./interests.h,libindicate/./listener.h,libindicate/./server.h")] + public const string SERVER_SIGNAL_SERVER_DISPLAY; + [CCode (cheader_filename = "libindicate/./indicator-messages.h,libindicate/./indicator.h,libindicate/./interests.h,libindicate/./listener.h,libindicate/./server.h")] + public const string SERVER_SIGNAL_SERVER_HIDE; + [CCode (cheader_filename = "libindicate/./indicator-messages.h,libindicate/./indicator.h,libindicate/./interests.h,libindicate/./listener.h,libindicate/./server.h")] + public const string SERVER_SIGNAL_SERVER_SHOW; +} -- cgit v1.2.3