aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTed Gould <ted@canonical.com>2009-02-12 13:10:19 -0600
committerTed Gould <ted@canonical.com>2009-02-12 13:10:19 -0600
commit1a5e21eb86c396d5535bfa4f74255740c8ee25d3 (patch)
treed4cbe9a66946333fc525a3ff225add6af65b29a0 /tests
parentb94d3a706d4f3e93e4e23dd908ffc0704add19f8 (diff)
downloadlibayatana-indicator-1a5e21eb86c396d5535bfa4f74255740c8ee25d3.tar.gz
libayatana-indicator-1a5e21eb86c396d5535bfa4f74255740c8ee25d3.tar.bz2
libayatana-indicator-1a5e21eb86c396d5535bfa4f74255740c8ee25d3.zip
Added in a way to print the values of properties while they change. More later, but a start.
Diffstat (limited to 'tests')
-rw-r--r--tests/listen-and-print.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/tests/listen-and-print.c b/tests/listen-and-print.c
index 6e1104d..dca299b 100644
--- a/tests/listen-and-print.c
+++ b/tests/listen-and-print.c
@@ -23,9 +23,60 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include "libindicate/listener.h"
static void
+show_property_cb (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * property, gchar * propertydata, gpointer data)
+{
+ g_debug("Indicator Property: %s %d %s %s", INDICATE_LISTENER_SERVER_DBUS_NAME(server), INDICATE_LISTENER_INDICATOR_ID(indicator), property, propertydata);
+ return;
+}
+
+static void
+show_property_time_cb (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * property, GTimeVal * propertydata, gpointer data)
+{
+ time_t timet;
+ struct tm * structtm;
+
+ timet = propertydata->tv_sec;
+ structtm = localtime(&timet);
+
+ gchar timestring[80];
+ strftime(timestring, 80, "%I:%M", structtm);
+
+ g_debug("Indicator Property: %s %d %s %s", INDICATE_LISTENER_SERVER_DBUS_NAME(server), INDICATE_LISTENER_INDICATOR_ID(indicator), property, timestring);
+ return;
+}
+
+static void
+show_property_icon_cb (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * property, GdkPixbuf * propertydata, gpointer data)
+{
+
+
+}
+
+static void
+show_property (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * property)
+{
+ if (!strcmp(property, "icon")) {
+ indicate_listener_get_property_icon(listener, server, indicator, property, show_property_icon_cb, NULL);
+ } else if (!strcmp(property, "time")) {
+ indicate_listener_get_property_time(listener, server, indicator, property, show_property_time_cb, NULL);
+ } else {
+ indicate_listener_get_property(listener, server, indicator, property, show_property_cb, NULL);
+ }
+
+ return;
+}
+
+static void
+get_properties (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator)
+{
+ //TODO: Not in API yet.
+}
+
+static void
indicator_added (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * type, gpointer data)
{
g_debug("Indicator Added: %s %d %s", INDICATE_LISTENER_SERVER_DBUS_NAME(server), INDICATE_LISTENER_INDICATOR_ID(indicator), type);
+ get_properties(listener, server, indicator);
}
static void
@@ -38,6 +89,7 @@ static void
indicator_modified (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * type, gchar * property, gpointer data)
{
g_debug("Indicator Modified: %s %d %s %s", INDICATE_LISTENER_SERVER_DBUS_NAME(server), INDICATE_LISTENER_INDICATOR_ID(indicator), type, property);
+ show_property(listener, server, indicator, property);
}
static void