aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.bzrignore44
-rw-r--r--Makefile.am3
-rw-r--r--configure.ac38
-rw-r--r--debian/changelog80
-rw-r--r--debian/control60
-rw-r--r--debian/libindicate-dev.install4
-rw-r--r--debian/libindicate-doc.install2
-rw-r--r--debian/libindicate-gtk-dev.install4
-rw-r--r--debian/libindicate-gtk0.install1
-rw-r--r--debian/libindicate2.install (renamed from debian/libindicate1.install)0
-rw-r--r--debian/libindicator-dev.install2
-rw-r--r--docs/reference/Makefile.am2
-rw-r--r--docs/reference/libindicate-docs.sgml34
-rw-r--r--docs/reference/libindicate-sections.txt154
-rw-r--r--docs/reference/tmpl/libindicate-unused.sgml654
-rw-r--r--examples/Makefile.am78
-rw-r--r--examples/im-client.c (renamed from tests/im-client.c)1
-rw-r--r--examples/indicate-alot.c (renamed from tests/indicate-alot.c)0
-rw-r--r--examples/indicate-and-crash.c (renamed from tests/indicate-and-crash.c)0
-rw-r--r--examples/listen-and-print.c (renamed from tests/listen-and-print.c)1
-rw-r--r--examples/show-hide-server.c (renamed from tests/show-hide-server.c)0
-rwxr-xr-xexamples/test.js (renamed from tests/test.js)0
-rw-r--r--libindicate-gtk/Makefile.am72
-rw-r--r--libindicate-gtk/indicate-gtk.pc.in14
-rw-r--r--libindicate-gtk/indicator.c74
-rw-r--r--libindicate-gtk/indicator.h44
-rw-r--r--libindicate-gtk/listener.c148
-rw-r--r--libindicate-gtk/listener.h57
-rw-r--r--libindicate/Makefile.am60
-rw-r--r--libindicate/indicate.pc.in2
-rw-r--r--libindicate/indicator-message.c7
-rw-r--r--libindicate/indicator-message.h39
-rw-r--r--libindicate/indicator.c205
-rw-r--r--libindicate/indicator.h72
-rw-r--r--libindicate/interests.h5
-rw-r--r--libindicate/listener-private.h63
-rw-r--r--libindicate/listener.c239
-rw-r--r--libindicate/listener.h14
-rw-r--r--libindicate/server-marshal.list29
-rw-r--r--libindicate/server.c232
-rw-r--r--libindicate/server.h87
-rw-r--r--libindicator/Makefile.am14
-rw-r--r--libindicator/indicator.h34
-rw-r--r--libindicator/indicator.pc.in16
-rw-r--r--src/Makefile.am3
-rw-r--r--src/applet-main.c64
-rw-r--r--tests/Makefile.am153
-rw-r--r--tests/test-interests-client.c63
-rw-r--r--tests/test-interests-server.c45
-rw-r--r--tests/test-interests-server1.c41
-rw-r--r--tests/test-interests-server2.c41
-rw-r--r--tests/test-interests-server3.c41
-rw-r--r--tests/test-interests-server4.c41
-rw-r--r--tests/test-interests-server5.c41
-rw-r--r--tests/test-simple-client.c30
-rw-r--r--tests/test-simple-server.c39
-rw-r--r--tests/test-thousand-indicators-client.c34
-rw-r--r--tests/test-thousand-indicators-server.c43
-rwxr-xr-xtests/test_interests5
-rwxr-xr-xtests/test_interests_multi5
-rwxr-xr-xtests/test_simple5
-rwxr-xr-xtests/test_thousand_indicators5
62 files changed, 2932 insertions, 456 deletions
diff --git a/.bzrignore b/.bzrignore
index 3548564..d1781cd 100644
--- a/.bzrignore
+++ b/.bzrignore
@@ -55,3 +55,47 @@ tests/indicate-alot
tests/indicate-and-crash
tests/listen-and-print
tests/show-hide-server
+libindicate/indicate-enum-types.c
+libindicate/indicate-enum-types.h
+libindicate/libindicate_la-indicate-enum-types.lo
+libindicate/s-enum-types-c
+libindicate/s-enum-types-h
+indicator.pc
+examples/.deps
+examples/.libs
+examples/im-client
+examples/indicate-alot
+examples/indicate-and-crash
+examples/listen-and-print
+examples/show-hide-server
+test-simple-client
+test-simple-server
+test-interests-client
+test-interests-server
+test-interests-server1
+test-interests-server2
+test-interests-server3
+test-interests-server4
+test-interests-server5
+test-thousand-indicators-server
+test-thousand-indicators-client
+libindicate_la-server-marshal.lo
+server-marshal.c
+server-marshal.h
+libindicate-gtk.la
+libindicate_gtk_la-indicator.lo
+libindicate_gtk_la-indicator.o
+libindicate_gtk_la-listener.lo
+libindicate_gtk_la-listener.o
+indicate-gtk.pc
+.deps
+.libs
+indicator-applet-*.tar.gz
+docs/reference/tmpl/indicator-message.sgml
+docs/reference/tmpl/indicator-message.sgml.bak
+docs/reference/tmpl/indicator.sgml.bak
+docs/reference/tmpl/libindicate-unused.sgml.bak
+docs/reference/tmpl/listener.sgml
+docs/reference/tmpl/listener.sgml.bak
+docs/reference/tmpl/server.sgml
+docs/reference/tmpl/server.sgml.bak
diff --git a/Makefile.am b/Makefile.am
index d4f7ca2..bdd32f4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2,6 +2,9 @@
SUBDIRS = \
src \
libindicate \
+ libindicate-gtk \
+ libindicator \
+ examples \
tests \
data \
po \
diff --git a/configure.ac b/configure.ac
index 6e5d253..471512f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4,9 +4,10 @@ AC_INIT(src/applet-main.c)
AC_PREREQ(2.53)
AM_CONFIG_HEADER(config.h)
-AM_INIT_AUTOMAKE(indicator-applet, 0.1.6)
+AM_INIT_AUTOMAKE(indicator-applet, 0.2.0dev)
AM_MAINTAINER_MODE
+m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES])
IT_PROG_INTLTOOL([0.35.0])
AC_ISC_POSIX
@@ -22,7 +23,7 @@ AC_CONFIG_MACRO_DIR([m4])
# Libindicate versioning
###########################
-LIBINDICATE_CURRENT=1
+LIBINDICATE_CURRENT=2
LIBINDICATE_REVISION=0
LIBINDICATE_AGE=0
@@ -31,6 +32,18 @@ AC_SUBST(LIBINDICATE_REVISION)
AC_SUBST(LIBINDICATE_AGE)
###########################
+# Libindicate versioning
+###########################
+
+LIBINDICATEGTK_CURRENT=0
+LIBINDICATEGTK_REVISION=0
+LIBINDICATEGTK_AGE=0
+
+AC_SUBST(LIBINDICATEGTK_CURRENT)
+AC_SUBST(LIBINDICATEGTK_REVISION)
+AC_SUBST(LIBINDICATEGTK_AGE)
+
+###########################
# Dependencies
###########################
@@ -49,15 +62,25 @@ AM_GCONF_SOURCE_2
GLIB_REQUIRED_VERSION=2.18
GIO_REQUIRED_VERSION=2.18
-GDK_PIXBUF_REQUIRED_VERSION=2.12
+XML_REQUIRED_VERSION=2.6
PKG_CHECK_MODULES(LIBINDICATE, glib-2.0 >= $GLIB_REQUIRED_VERSION
gio-2.0 >= $GIO_REQUIRED_VERSION
- gdk-pixbuf-2.0 >= $GDK_PIXBUF_REQUIRED_VERSION
- dbus-glib-1 >= $DBUS_REQUIRED_VERSION)
+ dbus-glib-1 >= $DBUS_REQUIRED_VERSION
+ libxml-2.0 >= $XML_REQUIRED_VERSION)
AC_SUBST(LIBINDICATE_CFLAGS)
AC_SUBST(LIBINDICATE_LIBS)
+GDK_PIXBUF_REQUIRED_VERSION=2.12
+
+PKG_CHECK_MODULES(LIBINDICATEGTK, glib-2.0 >= $GLIB_REQUIRED_VERSION
+ gio-2.0 >= $GIO_REQUIRED_VERSION
+ gdk-pixbuf-2.0 >= $GDK_PIXBUF_REQUIRED_VERSION
+ gtk+-2.0 >= $GTK_REQUIRED_VERSION
+ dbus-glib-1 >= $DBUS_REQUIRED_VERSION)
+AC_SUBST(LIBINDICATEGTK_CFLAGS)
+AC_SUBST(LIBINDICATEGTK_LIBS)
+
###########################
# GObject Introspection
###########################
@@ -159,6 +182,11 @@ Makefile
src/Makefile
libindicate/Makefile
libindicate/indicate.pc
+libindicate-gtk/Makefile
+libindicate-gtk/indicate-gtk.pc
+libindicator/Makefile
+libindicator/indicator.pc
+examples/Makefile
tests/Makefile
data/Makefile
po/Makefile.in
diff --git a/debian/changelog b/debian/changelog
index 8c77adb..d49dfa2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,83 @@
+indicator-applet (0.2.0~bzr319-0ubuntu1~ppa4) karmic; urgency=low
+
+ * Upstream fix to PC file.
+
+ -- Ted Gould <ted@ubuntu.com> Tue, 04 Aug 2009 12:29:39 +0100
+
+indicator-applet (0.2.0~bzr319-0ubuntu1~ppa3) karmic; urgency=low
+
+ * debian/control: Fixing the library reference of
+ libindicate-gtk-dev
+
+ -- Ted Gould <ted@ubuntu.com> Tue, 04 Aug 2009 10:53:48 +0100
+
+indicator-applet (0.2.0~bzr319-0ubuntu1~ppa2) karmic; urgency=low
+
+ * Forgot to autogen.sh
+
+ -- Ted Gould <ted@ubuntu.com> Tue, 04 Aug 2009 10:51:47 +0100
+
+indicator-applet (0.2.0~bzr319-0ubuntu1~ppa1) karmic; urgency=low
+
+ * Merging in upstream code to split out libindicate-gtk
+ * debian/control:
+ * Changing the version number of libindcate to 2 to match
+ the .so numbering.
+ * Creating packages for libindicate-gtk
+ * Added libindicate-gtk-dev.install and libindicate-gtk0.install
+ for the new library.
+ * Renamed libindicate1.install to libindicate2.install to match
+ the package name change.
+ * Modified libindicate-dev to be more specific about the header
+ files that it grabs.
+
+ -- Ted Gould <ted@ubuntu.com> Tue, 04 Aug 2009 10:27:31 +0100
+
+indicator-applet (0.2.0~bzr309-0ubuntu3) karmic; urgency=low
+
+ * Now moving on to Karmic
+
+ -- Ted Gould <ted@ubuntu.com> Fri, 17 Jul 2009 21:24:41 -0500
+
+indicator-applet (0.2.0~bzr309-0ubuntu2) jaunty; urgency=low
+
+ * debian/control, debian/libindicate-doc.install: Merging in Ken
+ Vandine's work on making a -doc package for libindicate.
+
+ -- Ted Gould <ted@ubuntu.com> Fri, 17 Jul 2009 21:23:41 -0500
+
+indicator-applet (0.2.0~bzr309-0ubuntu1) jaunty; urgency=low
+
+ * Merge from upstream, includes documentation.
+
+ -- Ted Gould <ted@ubuntu.com> Tue, 05 May 2009 16:44:29 +0100
+
+indicator-applet (0.2.0~bzr307-0ubuntu2) jaunty; urgency=low
+
+ * Increment for PPA. Forgot to autogen.sh
+
+ -- Ted Gould <ted@ubuntu.com> Mon, 27 Apr 2009 11:06:45 -0500
+
+indicator-applet (0.2.0~bzr307-0ubuntu1) jaunty; urgency=low
+
+ * Upstream Snapshot: Adding in a test suite.
+ * debian/control: Adding a build-dep on dbus-test-runner
+
+ -- Ted Gould <ted@ubuntu.com> Mon, 27 Apr 2009 10:52:28 -0500
+
+indicator-applet (0.2.0~bzr305-0ubuntu1) jaunty; urgency=low
+
+ * Upstream snapshot
+ * debian/control:
+ * Add in package libindicator-dev
+ * Add build depends on libxml2-dev for upstream dep
+ * debian/libindicate-dev.install: Add greater specificity on what
+ gets installed to not get confused with files from libindicator
+ * debian/libindicator-dev.install: Specify which files should be
+ put into the development package.
+
+ -- Ted Gould <ted@ubuntu.com> Wed, 22 Apr 2009 23:46:28 -0500
+
indicator-applet (0.1.6-0ubuntu1) jaunty; urgency=low
* New upstream version
diff --git a/debian/control b/debian/control
index d269a2d..23e0158 100644
--- a/debian/control
+++ b/debian/control
@@ -10,7 +10,8 @@ Build-Depends: debhelper (>= 5.0),
gnome-doc-utils,
libgnomeui-dev,
libtool,
- intltool
+ intltool,
+ libxml2-dev
Standards-Version: 3.8.0
Homepage: https://launchpad.net/indicator-applet
Vcs-Bzr: http://bazaar.launchpad.net/~ubuntu-core-dev/indicator-applet/ubuntu
@@ -28,7 +29,7 @@ Description: GNOME panel indicator applet
Currently this includes support for messaging applications in the
indicator-messages package.
-Package: libindicate1
+Package: libindicate2
Section: libs
Conflicts: libindicate
Replaces: libindicate
@@ -46,7 +47,32 @@ Section: libdevel
Architecture: any
Depends: ${shlibs:Depends},
${misc:Depends},
- libindicate1 (= ${binary:Version}),
+ libindicate2 (= ${binary:Version}),
+ libdbus-glib-1-dev (>= 0.76)
+Description: GNOME panel indicator applet - shared library
+ indicator-applet is an applet to display information from
+ various applications consistently in the GNOME panel.
+ .
+ This package contains files that are needed to build applications.
+
+Package: libindicate-gtk0
+Section: libs
+Architecture: any
+Depends: ${shlibs:Depends},
+ ${misc:Depends}
+Description: GNOME panel indicator applet - shared library
+ indicator-applet is an applet to display information from
+ various applications consistently in the GNOME panel.
+ .
+ This package contains shared libraries to be used by applications.
+
+Package: libindicate-gtk-dev
+Section: libdevel
+Architecture: any
+Depends: ${shlibs:Depends},
+ ${misc:Depends},
+ libindicate-gtk0 (= ${binary:Version}),
+ libindicate-dev (= ${binary:Version}),
libdbus-glib-1-dev (>= 0.76),
libgtk2.0-dev (>= 2.12.0)
Description: GNOME panel indicator applet - shared library
@@ -54,3 +80,31 @@ Description: GNOME panel indicator applet - shared library
various applications consistently in the GNOME panel.
.
This package contains files that are needed to build applications.
+
+Package: libindicator-dev
+Section: libdevel
+Architecture: any
+Depends: ${shlibs:Depends},
+ ${misc:Depends},
+ libgtk2.0-dev (>= 2.12.0)
+Description: GNOME panel indicator applet - shared library
+ This library contains information to build indicators to go into
+ the indicator applet.
+ .
+ This package contains files that are needed to build applications.
+
+Package: libindicate-doc
+Section: doc
+Architecture: any
+Depends: ${shlibs:Depends},
+ ${misc:Depends},
+ libindicate2 (= ${binary:Version}),
+ libindicate-gtk0 (= ${binary:Version}),
+ libdbus-glib-1-dev (>= 0.76),
+ libgtk2.0-dev (>= 2.12.0)
+Description: GNOME panel indicator applet - shared library
+ indicator-applet is an applet to display information from
+ various applications consistently in the GNOME panel.ยท
+ .
+ This package contains files that are needed to build applications.
+
diff --git a/debian/libindicate-dev.install b/debian/libindicate-dev.install
index 4623919..81e1396 100644
--- a/debian/libindicate-dev.install
+++ b/debian/libindicate-dev.install
@@ -1,4 +1,4 @@
-debian/tmp/usr/include/
-debian/tmp/usr/lib/pkgconfig
+debian/tmp/usr/include/libindicate-0.1/libindicate/*
+debian/tmp/usr/lib/pkgconfig/indicate.pc
debian/tmp/usr/lib/libindicate.a
debian/tmp/usr/lib/libindicate.so
diff --git a/debian/libindicate-doc.install b/debian/libindicate-doc.install
new file mode 100644
index 0000000..55af9eb
--- /dev/null
+++ b/debian/libindicate-doc.install
@@ -0,0 +1,2 @@
+debian/tmp/usr/share/gtk-doc/html/libindicate/*
+debian/tmp/usr/share/doc/indicator-applet/examples/*
diff --git a/debian/libindicate-gtk-dev.install b/debian/libindicate-gtk-dev.install
new file mode 100644
index 0000000..5f0e682
--- /dev/null
+++ b/debian/libindicate-gtk-dev.install
@@ -0,0 +1,4 @@
+debian/tmp/usr/include/libindicate-0.1/libindicate-gtk/*
+debian/tmp/usr/lib/pkgconfig/indicate-gtk.pc
+debian/tmp/usr/lib/libindicate-gtk.a
+debian/tmp/usr/lib/libindicate-gtk.so
diff --git a/debian/libindicate-gtk0.install b/debian/libindicate-gtk0.install
new file mode 100644
index 0000000..fc6b412
--- /dev/null
+++ b/debian/libindicate-gtk0.install
@@ -0,0 +1 @@
+debian/tmp/usr/lib/libindicate-gtk.so.*
diff --git a/debian/libindicate1.install b/debian/libindicate2.install
index 0618a58..0618a58 100644
--- a/debian/libindicate1.install
+++ b/debian/libindicate2.install
diff --git a/debian/libindicator-dev.install b/debian/libindicator-dev.install
new file mode 100644
index 0000000..7e7d9db
--- /dev/null
+++ b/debian/libindicator-dev.install
@@ -0,0 +1,2 @@
+debian/tmp/usr/include/libindicator*
+debian/tmp/usr/lib/pkgconfig/indicator.pc
diff --git a/docs/reference/Makefile.am b/docs/reference/Makefile.am
index 759465e..2589179 100644
--- a/docs/reference/Makefile.am
+++ b/docs/reference/Makefile.am
@@ -47,7 +47,7 @@ CFILE_GLOB=$(top_srcdir)/libindicate/*.c
# Header files to ignore when scanning.
# e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h
-IGNORE_HFILES=
+IGNORE_HFILES=dbus-indicate-client.h dbus-indicate-server.h dbus-listener-client.h dbus-listener-server.h listener-marshal.h
# Images to copy into HTML directory.
# e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png
diff --git a/docs/reference/libindicate-docs.sgml b/docs/reference/libindicate-docs.sgml
index 0f1ccd1..c3038d3 100644
--- a/docs/reference/libindicate-docs.sgml
+++ b/docs/reference/libindicate-docs.sgml
@@ -1,24 +1,32 @@
<?xml version="1.0"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
-<book id="index" xmlns:xi="http://www.w3.org/2003/XInclude">
+<book id="libindicatebook" xmlns:xi="http://www.w3.org/2003/XInclude">
+
<bookinfo>
<title>libindicate Reference Manual</title>
- <releaseinfo>
- for libindicate [VERSION]
- The latest version of this documentation can be found on-line at
- <ulink role="online-location" url="http://[SERVER]/libindicate/index.html">http://[SERVER]/libindicate/</ulink>.
- </releaseinfo>
</bookinfo>
- <chapter>
- <title>[Insert title here]</title>
- </chapter>
+<part id="base">
+ <title>Base Classes for Applications</title>
+ <xi:include href="xml/indicator.xml" />
+ <xi:include href="xml/server.xml" />
+</part>
+
+<part id="subclass">
+ <title>Subclasses for specific indicators</title>
+ <xi:include href="xml/indicator-message.xml" />
+</part>
- <chapter>
- <title>libindicate Indicator</title>
- <xi:include href="xml/indicator.xml" />
- </chapter>
+<part id="listeners">
+ <title>Classes for Listeners</title>
+ <xi:include href="xml/listener.xml" />
+</part>
+<part id="index">
+ <index>
+ <title>Index of all Symbols</title>
+ </index>
+</part>
</book>
diff --git a/docs/reference/libindicate-sections.txt b/docs/reference/libindicate-sections.txt
index f5f3290..6e2a8cd 100644
--- a/docs/reference/libindicate-sections.txt
+++ b/docs/reference/libindicate-sections.txt
@@ -2,148 +2,62 @@
<SECTION>
<FILE>indicator</FILE>
-<TITLE>Everything</TITLE>
-
-INDICATE_INDICATOR
-INDICATE_INDICATOR_CLASS
-INDICATE_INDICATOR_GET_CLASS
-INDICATE_INDICATOR_MESSAGE
-INDICATE_INDICATOR_MESSAGE_CLASS
-INDICATE_INDICATOR_MESSAGE_GET_CLASS
-INDICATE_INDICATOR_SIGNAL_DISPLAY
-INDICATE_INDICATOR_SIGNAL_HIDE
-INDICATE_INDICATOR_SIGNAL_MODIFIED
-INDICATE_INDICATOR_SIGNAL_SHOW
-INDICATE_IS_INDICATOR
-INDICATE_IS_INDICATOR_CLASS
-INDICATE_IS_INDICATOR_MESSAGE
-INDICATE_IS_INDICATOR_MESSAGE_CLASS
-INDICATE_IS_LISTENER
-INDICATE_IS_LISTENER_CLASS
-INDICATE_IS_SERVER
-INDICATE_IS_SERVER_CLASS
-INDICATE_LISTENER
-INDICATE_LISTENER_CLASS
-INDICATE_LISTENER_GET_CLASS
-INDICATE_LISTENER_INDICATOR_ID
-INDICATE_LISTENER_SERVER_DBUS_NAME
-INDICATE_LISTENER_SIGNAL_INDICATOR_ADDED
-INDICATE_LISTENER_SIGNAL_INDICATOR_MODIFIED
-INDICATE_LISTENER_SIGNAL_INDICATOR_REMOVED
-INDICATE_LISTENER_SIGNAL_SERVER_ADDED
-INDICATE_LISTENER_SIGNAL_SERVER_REMOVED
-INDICATE_SERVER
-INDICATE_SERVER_CLASS
-INDICATE_SERVER_GET_CLASS
-INDICATE_TYPE_INDICATOR
-INDICATE_TYPE_INDICATOR_MESSAGE
-INDICATE_TYPE_LISTENER
-INDICATE_TYPE_SERVER
+<TITLE>IndicateIndicator</TITLE>
IndicateIndicator
IndicateIndicatorClass
-IndicateIndicatorMessage
-IndicateIndicatorMessageClass
-IndicateListener
-IndicateListenerClass
-IndicateListenerIndicator
-IndicateListenerServer
-IndicateServer
-IndicateServerClass
-dbus_g_proxy_begin_call
-dbus_glib_marshal_indicate_server_BOOLEAN__POINTER_POINTER
-dbus_glib_marshal_indicate_server_BOOLEAN__STRING_POINTER_POINTER
-dbus_glib_marshal_indicate_server_BOOLEAN__UINT_BOXED_POINTER_POINTER
-dbus_glib_marshal_indicate_server_BOOLEAN__UINT_POINTER
-dbus_glib_marshal_indicate_server_BOOLEAN__UINT_POINTER_POINTER
-dbus_glib_marshal_indicate_server_BOOLEAN__UINT_STRING_POINTER_POINTER
-g_marshal_value_peek_boolean
-g_marshal_value_peek_boxed
-g_marshal_value_peek_char
-g_marshal_value_peek_double
-g_marshal_value_peek_enum
-g_marshal_value_peek_flags
-g_marshal_value_peek_float
-g_marshal_value_peek_int
-g_marshal_value_peek_int64
-g_marshal_value_peek_long
-g_marshal_value_peek_object
-g_marshal_value_peek_param
-g_marshal_value_peek_pointer
-g_marshal_value_peek_string
-g_marshal_value_peek_uchar
-g_marshal_value_peek_uint
-g_marshal_value_peek_uint64
-g_marshal_value_peek_ulong
indicate_indicator_get_id
indicate_indicator_get_indicator_type
indicate_indicator_get_property
-indicate_indicator_get_type
indicate_indicator_hide
indicate_indicator_is_visible
indicate_indicator_list_properties
-indicate_indicator_message_get_type
-indicate_indicator_message_new
indicate_indicator_new
indicate_indicator_set_property
+indicate_indicator_set_property_icon
+indicate_indicator_set_property_time
indicate_indicator_show
indicate_indicator_user_display
-indicate_listener_display
-indicate_listener_get_property
-indicate_listener_get_property_cb
-indicate_listener_get_type
-indicate_listener_marshal_VOID__POINTER_POINTER_STRING
-indicate_listener_marshal_VOID__POINTER_POINTER_STRING_STRING
-indicate_listener_marshal_VOID__UINT_STRING
-indicate_listener_new
+</SECTION>
+
+<SECTION>
+<FILE>indicator-message</FILE>
+<TITLE>IndicateIndicatorMessage</TITLE>
+IndicateIndicatorMessage
+IndicateIndicatorMessageClass
+indicate_indicator_message_new
+</SECTION>
+
+<SECTION>
+<FILE>server</FILE>
+<TITLE>IndicateServer</TITLE>
+IndicateServer
+IndicateServerClass
indicate_server_add_indicator
+indicate_server_check_interest
indicate_server_emit_indicator_added
indicate_server_emit_indicator_modified
indicate_server_emit_indicator_removed
-indicate_server_get_desktop
-indicate_server_get_indicator_count
-indicate_server_get_indicator_count_by_type
-indicate_server_get_indicator_list
-indicate_server_get_indicator_list_by_type
-indicate_server_get_indicator_properties
-indicate_server_get_indicator_property
-indicate_server_get_indicator_property_group
+indicate_server_emit_server_display
indicate_server_get_next_id
-indicate_server_get_type
indicate_server_hide
-indicate_server_new
indicate_server_ref_default
indicate_server_remove_indicator
-indicate_server_set_dbus_object
indicate_server_set_default
indicate_server_set_desktop_file
+indicate_server_set_type
indicate_server_show
-indicate_server_show_indicator_to_user
-org_freedesktop_indicator_get_desktop
-org_freedesktop_indicator_get_desktop_async
-org_freedesktop_indicator_get_desktop_reply
-org_freedesktop_indicator_get_indicator_count
-org_freedesktop_indicator_get_indicator_count_async
-org_freedesktop_indicator_get_indicator_count_by_type
-org_freedesktop_indicator_get_indicator_count_by_type_async
-org_freedesktop_indicator_get_indicator_count_by_type_reply
-org_freedesktop_indicator_get_indicator_count_reply
-org_freedesktop_indicator_get_indicator_list
-org_freedesktop_indicator_get_indicator_list_async
-org_freedesktop_indicator_get_indicator_list_by_type
-org_freedesktop_indicator_get_indicator_list_by_type_async
-org_freedesktop_indicator_get_indicator_list_by_type_reply
-org_freedesktop_indicator_get_indicator_list_reply
-org_freedesktop_indicator_get_indicator_properties
-org_freedesktop_indicator_get_indicator_properties_async
-org_freedesktop_indicator_get_indicator_properties_reply
-org_freedesktop_indicator_get_indicator_property
-org_freedesktop_indicator_get_indicator_property_async
-org_freedesktop_indicator_get_indicator_property_group
-org_freedesktop_indicator_get_indicator_property_group_async
-org_freedesktop_indicator_get_indicator_property_group_reply
-org_freedesktop_indicator_get_indicator_property_reply
-org_freedesktop_indicator_show_indicator_to_user
-org_freedesktop_indicator_show_indicator_to_user_async
-org_freedesktop_indicator_show_indicator_to_user_reply
+</SECTION>
+<SECTION>
+<FILE>listener</FILE>
+<TITLE>IndicateListener</TITLE>
+IndicateListener
+IndicateListenerClass
+IndicateListenerIndicator
+IndicateListenerServer
+indicate_listener_display
+indicate_listener_get_property
+indicate_listener_get_property_cb
+indicate_listener_new
</SECTION>
+
diff --git a/docs/reference/tmpl/libindicate-unused.sgml b/docs/reference/tmpl/libindicate-unused.sgml
index d4e3767..8f457e2 100644
--- a/docs/reference/tmpl/libindicate-unused.sgml
+++ b/docs/reference/tmpl/libindicate-unused.sgml
@@ -1,195 +1,655 @@
-<!-- ##### FUNCTION dbus_glib_marshal_indicate_server_BOOLEAN__POINTER_POINTER ##### -->
+<!-- ##### MACRO INDICATE_INDICATOR ##### -->
<para>
</para>
-@closure:
-@return_value:
-@n_param_values:
-@param_values:
-@invocation_hint:
-@marshal_data:
+@object:
-<!-- ##### FUNCTION dbus_glib_marshal_indicate_server_BOOLEAN__STRING_POINTER_POINTER ##### -->
+<!-- ##### MACRO INDICATE_INDICATOR_CLASS ##### -->
<para>
</para>
-@closure:
-@return_value:
-@n_param_values:
-@param_values:
-@invocation_hint:
-@marshal_data:
+@klass:
-<!-- ##### FUNCTION dbus_glib_marshal_indicate_server_BOOLEAN__UINT_BOXED_POINTER_POINTER ##### -->
+<!-- ##### MACRO INDICATE_INDICATOR_GET_CLASS ##### -->
<para>
</para>
-@closure:
-@return_value:
-@n_param_values:
-@param_values:
-@invocation_hint:
-@marshal_data:
+@object:
-<!-- ##### FUNCTION dbus_glib_marshal_indicate_server_BOOLEAN__UINT_POINTER ##### -->
+<!-- ##### MACRO INDICATE_INDICATOR_MESSAGE ##### -->
<para>
</para>
-@closure:
-@return_value:
-@n_param_values:
-@param_values:
-@invocation_hint:
-@marshal_data:
+@obj:
-<!-- ##### FUNCTION dbus_glib_marshal_indicate_server_BOOLEAN__UINT_POINTER_POINTER ##### -->
+<!-- ##### MACRO INDICATE_INDICATOR_MESSAGE_CLASS ##### -->
<para>
</para>
-@closure:
-@return_value:
-@n_param_values:
-@param_values:
-@invocation_hint:
-@marshal_data:
+@klass:
-<!-- ##### FUNCTION dbus_glib_marshal_indicate_server_BOOLEAN__UINT_STRING_POINTER_POINTER ##### -->
+<!-- ##### MACRO INDICATE_INDICATOR_MESSAGE_GET_CLASS ##### -->
<para>
</para>
-@closure:
-@return_value:
-@n_param_values:
-@param_values:
-@invocation_hint:
-@marshal_data:
+@obj:
-<!-- ##### FUNCTION indicate_listener_marshal_VOID__POINTER_POINTER_STRING ##### -->
+<!-- ##### MACRO INDICATE_INDICATOR_SIGNAL_DISPLAY ##### -->
<para>
</para>
-@closure:
-@return_value:
-@n_param_values:
-@param_values:
-@invocation_hint:
-@marshal_data:
-<!-- ##### FUNCTION indicate_listener_marshal_VOID__POINTER_POINTER_STRING_STRING ##### -->
+<!-- ##### MACRO INDICATE_INDICATOR_SIGNAL_HIDE ##### -->
<para>
</para>
-@closure:
-@return_value:
-@n_param_values:
-@param_values:
-@invocation_hint:
-@marshal_data:
-<!-- ##### FUNCTION indicate_listener_marshal_VOID__UINT_STRING ##### -->
+<!-- ##### MACRO INDICATE_INDICATOR_SIGNAL_MODIFIED ##### -->
<para>
</para>
-@closure:
-@return_value:
-@n_param_values:
-@param_values:
-@invocation_hint:
-@marshal_data:
-<!-- ##### FUNCTION indicate_server_get_indicator_count ##### -->
+<!-- ##### MACRO INDICATE_INDICATOR_SIGNAL_SHOW ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO INDICATE_IS_INDICATOR ##### -->
+<para>
+
+</para>
+
+@object:
+
+<!-- ##### MACRO INDICATE_IS_INDICATOR_CLASS ##### -->
+<para>
+
+</para>
+
+@klass:
+
+<!-- ##### MACRO INDICATE_IS_INDICATOR_MESSAGE ##### -->
+<para>
+
+</para>
+
+@obj:
+
+<!-- ##### MACRO INDICATE_IS_INDICATOR_MESSAGE_CLASS ##### -->
+<para>
+
+</para>
+
+@klass:
+
+<!-- ##### MACRO INDICATE_IS_LISTENER ##### -->
+<para>
+
+</para>
+
+@object:
+
+<!-- ##### MACRO INDICATE_IS_LISTENER_CLASS ##### -->
+<para>
+
+</para>
+
+@klass:
+
+<!-- ##### MACRO INDICATE_IS_SERVER ##### -->
+<para>
+
+</para>
+
+@object:
+
+<!-- ##### MACRO INDICATE_IS_SERVER_CLASS ##### -->
+<para>
+
+</para>
+
+@klass:
+
+<!-- ##### MACRO INDICATE_LISTENER ##### -->
+<para>
+
+</para>
+
+@object:
+
+<!-- ##### MACRO INDICATE_LISTENER_CLASS ##### -->
+<para>
+
+</para>
+
+@klass:
+
+<!-- ##### MACRO INDICATE_LISTENER_GET_CLASS ##### -->
+<para>
+
+</para>
+
+@object:
+
+<!-- ##### MACRO INDICATE_LISTENER_INDICATOR_ID ##### -->
+<para>
+
+</para>
+
+@indicator:
+
+<!-- ##### MACRO INDICATE_LISTENER_SERVER_DBUS_NAME ##### -->
<para>
</para>
@server:
-@count:
-@error:
+
+<!-- ##### MACRO INDICATE_LISTENER_SIGNAL_INDICATOR_ADDED ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO INDICATE_LISTENER_SIGNAL_INDICATOR_MODIFIED ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO INDICATE_LISTENER_SIGNAL_INDICATOR_REMOVED ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO INDICATE_LISTENER_SIGNAL_SERVER_ADDED ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO INDICATE_LISTENER_SIGNAL_SERVER_REMOVED ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO INDICATE_SERVER ##### -->
+<para>
+
+</para>
+
+@object:
+
+<!-- ##### MACRO INDICATE_SERVER_CLASS ##### -->
+<para>
+
+</para>
+
+@klass:
+
+<!-- ##### MACRO INDICATE_SERVER_GET_CLASS ##### -->
+<para>
+
+</para>
+
+@object:
+
+<!-- ##### MACRO INDICATE_TYPE_INDICATOR ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO INDICATE_TYPE_INDICATOR_MESSAGE ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO INDICATE_TYPE_LISTENER ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO INDICATE_TYPE_SERVER ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### FUNCTION dbus_g_proxy_begin_call ##### -->
+<para>
+
+</para>
+
+@Param1:
@Returns:
-<!-- ##### FUNCTION indicate_server_get_indicator_count_by_type ##### -->
+<!-- ##### MACRO g_marshal_value_peek_boolean ##### -->
+<para>
+
+</para>
+
+@v:
+
+<!-- ##### MACRO g_marshal_value_peek_boxed ##### -->
+<para>
+
+</para>
+
+@v:
+
+<!-- ##### MACRO g_marshal_value_peek_char ##### -->
+<para>
+
+</para>
+
+@v:
+
+<!-- ##### MACRO g_marshal_value_peek_double ##### -->
+<para>
+
+</para>
+
+@v:
+
+<!-- ##### MACRO g_marshal_value_peek_enum ##### -->
+<para>
+
+</para>
+
+@v:
+
+<!-- ##### MACRO g_marshal_value_peek_flags ##### -->
+<para>
+
+</para>
+
+@v:
+
+<!-- ##### MACRO g_marshal_value_peek_float ##### -->
+<para>
+
+</para>
+
+@v:
+
+<!-- ##### MACRO g_marshal_value_peek_int ##### -->
+<para>
+
+</para>
+
+@v:
+
+<!-- ##### MACRO g_marshal_value_peek_int64 ##### -->
+<para>
+
+</para>
+
+@v:
+
+<!-- ##### MACRO g_marshal_value_peek_long ##### -->
+<para>
+
+</para>
+
+@v:
+
+<!-- ##### MACRO g_marshal_value_peek_object ##### -->
+<para>
+
+</para>
+
+@v:
+
+<!-- ##### MACRO g_marshal_value_peek_param ##### -->
+<para>
+
+</para>
+
+@v:
+
+<!-- ##### MACRO g_marshal_value_peek_pointer ##### -->
+<para>
+
+</para>
+
+@v:
+
+<!-- ##### MACRO g_marshal_value_peek_string ##### -->
+<para>
+
+</para>
+
+@v:
+
+<!-- ##### MACRO g_marshal_value_peek_uchar ##### -->
+<para>
+
+</para>
+
+@v:
+
+<!-- ##### MACRO g_marshal_value_peek_uint ##### -->
+<para>
+
+</para>
+
+@v:
+
+<!-- ##### MACRO g_marshal_value_peek_uint64 ##### -->
+<para>
+
+</para>
+
+@v:
+
+<!-- ##### MACRO g_marshal_value_peek_ulong ##### -->
+<para>
+
+</para>
+
+@v:
+
+<!-- ##### FUNCTION indicate_indicator_get_type ##### -->
<para>
</para>
-@server:
-@type:
-@count:
-@error:
@Returns:
-<!-- ##### FUNCTION indicate_server_get_indicator_list ##### -->
+<!-- ##### FUNCTION indicate_indicator_message_get_type ##### -->
<para>
</para>
-@server:
-@indicators:
-@error:
@Returns:
-<!-- ##### FUNCTION indicate_server_get_indicator_list_by_type ##### -->
+<!-- ##### FUNCTION indicate_indicator_set_property_icon ##### -->
+<para>
+
+</para>
+
+@indicator:
+@key:
+@data:
+
+<!-- ##### FUNCTION indicate_listener_get_type ##### -->
<para>
</para>
-@server:
-@type:
-@indicators:
-@error:
@Returns:
-<!-- ##### FUNCTION indicate_server_get_indicator_properties ##### -->
+<!-- ##### FUNCTION indicate_server_get_type ##### -->
<para>
</para>
-@server:
-@id:
-@properties:
+@Returns:
+
+<!-- ##### FUNCTION indicate_server_new ##### -->
+<para>
+
+</para>
+
+@Returns:
+
+<!-- ##### FUNCTION indicate_server_set_dbus_object ##### -->
+<para>
+
+</para>
+
+@obj:
+
+<!-- ##### FUNCTION org_freedesktop_indicator_get_indicator_count ##### -->
+<para>
+
+</para>
+
+@proxy:
+@OUT_indicator_count:
+@Returns:
+
+<!-- ##### FUNCTION org_freedesktop_indicator_get_indicator_count_async ##### -->
+<para>
+
+</para>
+
+@proxy:
+@callback:
+@Returns:
+
+<!-- ##### FUNCTION org_freedesktop_indicator_get_indicator_count_by_type ##### -->
+<para>
+
+</para>
+
+@proxy:
+@IN_type:
+@OUT_indicator_count:
+@Returns:
+
+<!-- ##### FUNCTION org_freedesktop_indicator_get_indicator_count_by_type_async ##### -->
+<para>
+
+</para>
+
+@proxy:
+@IN_type:
+@callback:
+@Returns:
+
+<!-- ##### USER_FUNCTION org_freedesktop_indicator_get_indicator_count_by_type_reply ##### -->
+<para>
+
+</para>
+
+@proxy:
+@OUT_indicator_count:
+@error:
+@userdata:
+
+<!-- ##### USER_FUNCTION org_freedesktop_indicator_get_indicator_count_reply ##### -->
+<para>
+
+</para>
+
+@proxy:
+@OUT_indicator_count:
@error:
+@userdata:
+
+<!-- ##### FUNCTION org_freedesktop_indicator_get_indicator_list ##### -->
+<para>
+
+</para>
+
+@proxy:
+@OUT_indicators:
@Returns:
-<!-- ##### FUNCTION indicate_server_get_indicator_property ##### -->
+<!-- ##### FUNCTION org_freedesktop_indicator_get_indicator_list_async ##### -->
<para>
</para>
-@server:
-@id:
-@property:
-@value:
+@proxy:
+@callback:
+@Returns:
+
+<!-- ##### FUNCTION org_freedesktop_indicator_get_indicator_list_by_type ##### -->
+<para>
+
+</para>
+
+@proxy:
+@IN_type:
+@OUT_indicators:
+@Returns:
+
+<!-- ##### FUNCTION org_freedesktop_indicator_get_indicator_list_by_type_async ##### -->
+<para>
+
+</para>
+
+@proxy:
+@IN_type:
+@callback:
+@Returns:
+
+<!-- ##### USER_FUNCTION org_freedesktop_indicator_get_indicator_list_by_type_reply ##### -->
+<para>
+
+</para>
+
+@proxy:
+@OUT_indicators:
+@error:
+@userdata:
+
+<!-- ##### USER_FUNCTION org_freedesktop_indicator_get_indicator_list_reply ##### -->
+<para>
+
+</para>
+
+@proxy:
+@OUT_indicators:
@error:
+@userdata:
+
+<!-- ##### FUNCTION org_freedesktop_indicator_get_indicator_properties ##### -->
+<para>
+
+</para>
+
+@proxy:
+@IN_id:
+@OUT_properties:
@Returns:
-<!-- ##### FUNCTION indicate_server_get_indicator_property_group ##### -->
+<!-- ##### FUNCTION org_freedesktop_indicator_get_indicator_properties_async ##### -->
<para>
</para>
-@server:
-@id:
-@properties:
-@value:
+@proxy:
+@IN_id:
+@callback:
+@Returns:
+
+<!-- ##### USER_FUNCTION org_freedesktop_indicator_get_indicator_properties_reply ##### -->
+<para>
+
+</para>
+
+@proxy:
+@OUT_properties:
@error:
+@userdata:
+
+<!-- ##### FUNCTION org_freedesktop_indicator_get_indicator_property ##### -->
+<para>
+
+</para>
+
+@proxy:
+@IN_id:
+@IN_property:
+@OUT_value:
@Returns:
-<!-- ##### FUNCTION indicate_server_show_indicator_to_user ##### -->
+<!-- ##### FUNCTION org_freedesktop_indicator_get_indicator_property_async ##### -->
<para>
</para>
-@server:
-@id:
+@proxy:
+@IN_id:
+@IN_property:
+@callback:
+@Returns:
+
+<!-- ##### FUNCTION org_freedesktop_indicator_get_indicator_property_group ##### -->
+<para>
+
+</para>
+
+@proxy:
+@IN_id:
+@IN_properties:
+@OUT_values:
+@Returns:
+
+<!-- ##### FUNCTION org_freedesktop_indicator_get_indicator_property_group_async ##### -->
+<para>
+
+</para>
+
+@proxy:
+@IN_id:
+@IN_properties:
+@callback:
+@Returns:
+
+<!-- ##### USER_FUNCTION org_freedesktop_indicator_get_indicator_property_group_reply ##### -->
+<para>
+
+</para>
+
+@proxy:
+@OUT_values:
@error:
+@userdata:
+
+<!-- ##### USER_FUNCTION org_freedesktop_indicator_get_indicator_property_reply ##### -->
+<para>
+
+</para>
+
+@proxy:
+@OUT_value:
+@error:
+@userdata:
+
+<!-- ##### FUNCTION org_freedesktop_indicator_show_indicator_to_user ##### -->
+<para>
+
+</para>
+
+@proxy:
+@IN_id:
@Returns:
+<!-- ##### FUNCTION org_freedesktop_indicator_show_indicator_to_user_async ##### -->
+<para>
+
+</para>
+
+@proxy:
+@IN_id:
+@callback:
+@Returns:
+
+<!-- ##### USER_FUNCTION org_freedesktop_indicator_show_indicator_to_user_reply ##### -->
+<para>
+
+</para>
+
+@proxy:
+@error:
+@userdata:
+
diff --git a/examples/Makefile.am b/examples/Makefile.am
new file mode 100644
index 0000000..d6b74c6
--- /dev/null
+++ b/examples/Makefile.am
@@ -0,0 +1,78 @@
+
+libexec_PROGRAMS = \
+ indicate-and-crash \
+ indicate-alot \
+ listen-and-print \
+ im-client \
+ show-hide-server
+
+indicate_and_crash_SOURCES = \
+ indicate-and-crash.c
+
+indicate_and_crash_CFLAGS = \
+ -I $(srcdir)/.. \
+ $(LIBINDICATE_CFLAGS)
+
+indicate_and_crash_LDADD = \
+ ../libindicate/libindicate.la \
+ $(LIBINDICATE_LIBS)
+
+indicate_alot_SOURCES = \
+ indicate-alot.c
+
+indicate_alot_CFLAGS = \
+ -I $(srcdir)/.. \
+ $(LIBINDICATE_CFLAGS)
+
+indicate_alot_LDADD = \
+ ../libindicate/libindicate.la \
+ $(LIBINDICATE_LIBS)
+
+listen_and_print_SOURCES = \
+ listen-and-print.c
+
+listen_and_print_CFLAGS = \
+ -I $(srcdir)/.. \
+ $(LIBINDICATE_CFLAGS) \
+ $(LIBINDICATEGTK_CFLAGS)
+
+listen_and_print_LDADD = \
+ ../libindicate/libindicate.la \
+ ../libindicate-gtk/libindicate-gtk.la \
+ $(LIBINDICATE_LIBS) \
+ $(LIBINDICATEGTK_LIBS)
+
+im_client_SOURCES = \
+ im-client.c
+
+im_client_CFLAGS = \
+ -I $(srcdir)/.. \
+ $(LIBINDICATE_CFLAGS) \
+ $(LIBINDICATEGTK_CFLAGS)
+
+im_client_LDADD = \
+ ../libindicate/libindicate.la \
+ ../libindicate-gtk/libindicate-gtk.la \
+ $(LIBINDICATE_LIBS) \
+ $(LIBINDICATEGTK_LIBS)
+
+show_hide_server_SOURCES = \
+ show-hide-server.c
+
+show_hide_server_CFLAGS = \
+ -I $(srcdir)/.. \
+ $(LIBINDICATE_CFLAGS)
+
+show_hide_server_LDADD = \
+ ../libindicate/libindicate.la \
+ $(LIBINDICATE_LIBS)
+
+examplesdir = $(docdir)/examples/
+
+examples_DATA = \
+ $(indicate_and_crash_SOURCES) \
+ $(indicate_alot_SOURCES) \
+ $(listen_and_print_SOURCES) \
+ $(im_client_SOURCES)
+
+EXTRA_DIST = $(examples_DATA)
diff --git a/tests/im-client.c b/examples/im-client.c
index bf2fbb2..502484d 100644
--- a/tests/im-client.c
+++ b/examples/im-client.c
@@ -22,6 +22,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <glib.h>
#include "libindicate/server.h"
#include "libindicate/indicator-message.h"
+#include "libindicate-gtk/indicator.h"
gchar * patha = "/usr/share/icons/hicolor/16x16/apps/empathy.png";
gchar * pathb = "/usr/share/icons/hicolor/22x22/apps/empathy.png";
diff --git a/tests/indicate-alot.c b/examples/indicate-alot.c
index 479040b..479040b 100644
--- a/tests/indicate-alot.c
+++ b/examples/indicate-alot.c
diff --git a/tests/indicate-and-crash.c b/examples/indicate-and-crash.c
index c002a54..c002a54 100644
--- a/tests/indicate-and-crash.c
+++ b/examples/indicate-and-crash.c
diff --git a/tests/listen-and-print.c b/examples/listen-and-print.c
index dcad92b..57cb7be 100644
--- a/tests/listen-and-print.c
+++ b/examples/listen-and-print.c
@@ -21,6 +21,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <glib.h>
#include "libindicate/listener.h"
+#include "libindicate-gtk/listener.h"
static void
show_property_cb (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * property, gchar * propertydata, gpointer data)
diff --git a/tests/show-hide-server.c b/examples/show-hide-server.c
index 23c1ea1..23c1ea1 100644
--- a/tests/show-hide-server.c
+++ b/examples/show-hide-server.c
diff --git a/tests/test.js b/examples/test.js
index 45b0d05..45b0d05 100755
--- a/tests/test.js
+++ b/examples/test.js
diff --git a/libindicate-gtk/Makefile.am b/libindicate-gtk/Makefile.am
new file mode 100644
index 0000000..2085b47
--- /dev/null
+++ b/libindicate-gtk/Makefile.am
@@ -0,0 +1,72 @@
+
+INCLUDES= \
+ -DG_LOG_DOMAIN=\"libindicate-gtk\"
+
+EXTRA_DIST = \
+ indicate-gtk.pc.in
+
+lib_LTLIBRARIES = \
+ libindicate-gtk.la
+
+libindicate_gtkincludedir=$(includedir)/libindicate-0.1/libindicate-gtk
+
+indicate_gtk_headers = \
+ indicator.h \
+ listener.h
+
+libindicate_gtkinclude_HEADERS = \
+ $(indicate_gtk_headers)
+
+libindicate_gtk_la_SOURCES = \
+ $(indicate_gtk_headers) \
+ indicator.c \
+ listener.c
+
+libindicate_gtk_la_LDFLAGS = \
+ -version-info $(LIBINDICATEGTK_CURRENT):$(LIBINDICATEGTK_REVISION):$(LIBINDICATEGTK_AGE) \
+ -no-undefined \
+ -export-symbols-regex "^[^_d].*"
+
+libindicate_gtk_la_CFLAGS = \
+ -I $(srcdir)/.. \
+ $(LIBINDICATEGTK_CFLAGS)
+
+libindicate_gtk_la_LIBADD = \
+ ../libindicate/libindicate.la \
+ $(LIBINDICATEGTK_LIBS)
+
+pkgconfig_DATA = indicate-gtk.pc
+pkgconfigdir = $(libdir)/pkgconfig
+
+if USE_GIR
+
+gobjectintrospection_gir_DATA = \
+ Indicate-gtk-0.1.gir
+gobjectintrospection_girdir = $(datadir)/gir
+
+gobjectintrospection_type_DATA = \
+ Indicate-gtk-0.1.typelib
+gobjectintrospection_typedir = $(libdir)/girepository
+
+irscanner_headers = $(patsubst %,$(srcdir)/%,$(indicate_headers))
+Indicate-gtk-0.1.gir: $(irscanner_headers)
+ $(G_IR_SCANNER) \
+ -v --namespace IndicateGtk \
+ --nsversion=0.1 \
+ --add-include-path=$(srcdir) \
+ --include=GObject-2.0 \
+ --include=GLib-2.0 \
+ --include=GdkPixbuf-2.0 \
+ --library=indicate --pkg indicate \
+ --output Indicate-gtk-0.1.gir $(irscanner_headers)
+
+Indicate-gtk-0.1.typelib: Indicate-gtk-0.1.gir
+ $(G_IR_COMPILER) \
+ --includedir=$(srcdir) Indicate-gtk-0.1.gir \
+ -o Indicate-gtk-0.1.typelib
+
+DISTCLEANFILES = \
+ Indicate-gtk-0.1.gir \
+ Indicate-gtk-0.1.typelib
+
+endif
diff --git a/libindicate-gtk/indicate-gtk.pc.in b/libindicate-gtk/indicate-gtk.pc.in
new file mode 100644
index 0000000..28e3c81
--- /dev/null
+++ b/libindicate-gtk/indicate-gtk.pc.in
@@ -0,0 +1,14 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+bindir=@bindir@
+includedir=@includedir@
+
+Cflags: -I${includedir}/libindicate-0.1
+Requires: gtk+-2.0 indicate
+Libs: -L${libdir} -lindicate-gtk
+
+Name: libindicate-gtk
+Description: libindicate GTK stuff.
+Version: @VERSION@
+
diff --git a/libindicate-gtk/indicator.c b/libindicate-gtk/indicator.c
new file mode 100644
index 0000000..a575849
--- /dev/null
+++ b/libindicate-gtk/indicator.c
@@ -0,0 +1,74 @@
+/*
+A library to allow applictions to provide simple indications of
+information to be displayed to users of the application through the
+interface shell.
+
+Copyright 2009 Canonical Ltd.
+
+Authors:
+ Ted Gould <ted@canonical.com>
+
+This program is free software: you can redistribute it and/or modify it
+under the terms of either or both of the following licenses:
+
+1) the GNU Lesser General Public License version 3, as published by the
+Free Software Foundation; and/or
+2) the GNU Lesser General Public License version 2.1, 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 applicable version of the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of both the GNU Lesser General Public
+License version 3 and version 2.1 along with this program. If not, see
+<http://www.gnu.org/licenses/>
+*/
+
+#include "indicator.h"
+
+/**
+ indicate_indicator_set_property_icon:
+ @indicator: a #IndicateIndicator to act on
+ @key: name of the property
+ @data: icon to set property with
+
+ This is a helper function that wraps around #indicate_indicator_set_property
+ but takes an #GdkPixbuf parameter. It then takes the @data
+ parameter, turns it into a PNG, base64 encodes it and then
+ uses that data to call #indicate_indicator_set_property.
+*/
+void
+indicate_indicator_set_property_icon (IndicateIndicator * indicator, const gchar * key, const GdkPixbuf * data)
+{
+ if (!GDK_IS_PIXBUF(data)) {
+ g_warning("Invalide GdkPixbuf");
+ return;
+ }
+
+ GError * error = NULL;
+ gchar * png_data;
+ gsize png_data_len;
+
+ if (!gdk_pixbuf_save_to_buffer((GdkPixbuf *)data, &png_data, &png_data_len, "png", &error, NULL)) {
+ if (error == NULL) {
+ g_warning("Unable to create pixbuf data stream: %d", png_data_len);
+ } else {
+ g_warning("Unable to create pixbuf data stream: %s", error->message);
+ g_error_free(error);
+ error = NULL;
+ }
+
+ return;
+ }
+
+ gchar * prop_str = g_base64_encode((guchar *)png_data, png_data_len);
+ indicate_indicator_set_property(indicator, key, prop_str);
+
+ g_free(prop_str);
+ g_free(png_data);
+
+ return;
+}
diff --git a/libindicate-gtk/indicator.h b/libindicate-gtk/indicator.h
new file mode 100644
index 0000000..43e264f
--- /dev/null
+++ b/libindicate-gtk/indicator.h
@@ -0,0 +1,44 @@
+/*
+A library to allow applictions to provide simple indications of
+information to be displayed to users of the application through the
+interface shell.
+
+Copyright 2009 Canonical Ltd.
+
+Authors:
+ Ted Gould <ted@canonical.com>
+
+This program is free software: you can redistribute it and/or modify it
+under the terms of either or both of the following licenses:
+
+1) the GNU Lesser General Public License version 3, as published by the
+Free Software Foundation; and/or
+2) the GNU Lesser General Public License version 2.1, 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 applicable version of the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of both the GNU Lesser General Public
+License version 3 and version 2.1 along with this program. If not, see
+<http://www.gnu.org/licenses/>
+*/
+
+#ifndef INDICATE_GTK_INDICATOR_H_INCLUDED__
+#define INDICATE_GTK_INDICATOR_H_INCLUDED__ 1
+
+#include <glib.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
+#include "libindicate/indicator.h"
+
+G_BEGIN_DECLS
+
+/* Properties handling */
+void indicate_indicator_set_property_icon (IndicateIndicator * indicator, const gchar * key, const GdkPixbuf * data);
+
+G_END_DECLS
+
+#endif /* INDICATE_GTK_INDICATOR_H_INCLUDED__ */
diff --git a/libindicate-gtk/listener.c b/libindicate-gtk/listener.c
new file mode 100644
index 0000000..dceb05b
--- /dev/null
+++ b/libindicate-gtk/listener.c
@@ -0,0 +1,148 @@
+/*
+A library to allow applictions to provide simple indications of
+information to be displayed to users of the application through the
+interface shell.
+
+Copyright 2009 Canonical Ltd.
+
+Authors:
+ Ted Gould <ted@canonical.com>
+
+This program is free software: you can redistribute it and/or modify it
+under the terms of either or both of the following licenses:
+
+1) the GNU Lesser General Public License version 3, as published by the
+Free Software Foundation; and/or
+2) the GNU Lesser General Public License version 2.1, 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 applicable version of the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of both the GNU Lesser General Public
+License version 3 and version 2.1 along with this program. If not, see
+<http://www.gnu.org/licenses/>
+*/
+
+#include "listener.h"
+#include <dbus/dbus-glib-bindings.h>
+
+#include "../libindicate/dbus-indicate-client.h"
+#include "../libindicate/listener-private.h"
+
+typedef enum _get_property_type get_property_type;
+enum _get_property_type {
+ PROPERTY_TYPE_STRING,
+ PROPERTY_TYPE_TIME,
+ PROPERTY_TYPE_ICON
+};
+
+typedef struct _get_property_t get_property_t;
+struct _get_property_t {
+ GCallback cb;
+ gpointer data;
+ IndicateListener * listener;
+ IndicateListenerServer * server;
+ IndicateListenerIndicator * indicator;
+ gchar * property;
+ get_property_type type;
+};
+
+static void
+get_property_cb (DBusGProxy *proxy, char * OUT_value, GError *error, gpointer userdata)
+{
+ get_property_t * get_property_data = (get_property_t *)userdata;
+
+ if (error != NULL) {
+ g_warning("Unable to get property data: %s", error->message);
+ g_error_free(error);
+ return;
+ }
+
+ switch (get_property_data->type) {
+ case PROPERTY_TYPE_STRING: {
+ indicate_listener_get_property_cb cb = (indicate_listener_get_property_cb)get_property_data->cb;
+ cb(get_property_data->listener, get_property_data->server, get_property_data->indicator, get_property_data->property, OUT_value, get_property_data->data);
+ break;
+ }
+ case PROPERTY_TYPE_ICON: {
+ indicate_listener_get_property_icon_cb cb = (indicate_listener_get_property_icon_cb)get_property_data->cb;
+
+ /* There is no icon */
+ if (OUT_value == NULL || OUT_value[0] == '\0') {
+ break;
+ }
+
+ gsize length = 0;
+ guchar * icondata = g_base64_decode(OUT_value, &length);
+
+ GInputStream * input = g_memory_input_stream_new_from_data(icondata, length, NULL);
+ if (input == NULL) {
+ g_warning("Cound not create input stream from icon property data");
+ g_free(icondata);
+ break;
+ }
+
+ GError * error = NULL;
+ GdkPixbuf * icon = gdk_pixbuf_new_from_stream(input, NULL, &error);
+ if (icon != NULL) {
+ cb(get_property_data->listener, get_property_data->server, get_property_data->indicator, get_property_data->property, icon, get_property_data->data);
+ }
+
+ if (error != NULL) {
+ g_warning("Unable to build Pixbuf from icon data: %s", error->message);
+ g_error_free(error);
+ }
+
+ error = NULL;
+ g_input_stream_close(input, NULL, &error);
+ if (error != NULL) {
+ g_warning("Unable to close input stream: %s", error->message);
+ g_error_free(error);
+ }
+ g_free(icondata);
+ break;
+ }
+ case PROPERTY_TYPE_TIME: {
+ indicate_listener_get_property_time_cb cb = (indicate_listener_get_property_time_cb)get_property_data->cb;
+ GTimeVal time;
+ if (g_time_val_from_iso8601(OUT_value, &time)) {
+ cb(get_property_data->listener, get_property_data->server, get_property_data->indicator, get_property_data->property, &time, get_property_data->data);
+ }
+ break;
+ }
+ }
+
+ g_free(get_property_data->property);
+ g_free(get_property_data);
+
+ return;
+};
+
+static void
+get_property_helper (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * property, GCallback callback, gpointer data, get_property_type prop_type)
+{
+ /* g_debug("get_property_helper: %s %d", property, prop_type); */
+ /* TODO: Do we need to somehow refcount the server/indicator while we're waiting on this? */
+ get_property_t * get_property_data = g_new(get_property_t, 1);
+ get_property_data->cb = callback;
+ get_property_data->data = data;
+ get_property_data->listener = listener;
+ get_property_data->server = server;
+ get_property_data->indicator = indicator;
+ get_property_data->property = g_strdup(property);
+ get_property_data->type = prop_type;
+
+ org_freedesktop_indicator_get_indicator_property_async (server->proxy , INDICATE_LISTENER_INDICATOR_ID(indicator), property, get_property_cb, get_property_data);
+ return;
+}
+
+void
+indicate_listener_get_property_icon (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * property, indicate_listener_get_property_icon_cb callback, gpointer data)
+{
+ return get_property_helper(listener, server, indicator, property, G_CALLBACK(callback), data, PROPERTY_TYPE_ICON);
+}
+
diff --git a/libindicate-gtk/listener.h b/libindicate-gtk/listener.h
new file mode 100644
index 0000000..cedc9a3
--- /dev/null
+++ b/libindicate-gtk/listener.h
@@ -0,0 +1,57 @@
+/*
+A library to allow applictions to provide simple indications of
+information to be displayed to users of the application through the
+interface shell.
+
+Copyright 2009 Canonical Ltd.
+
+Authors:
+ Ted Gould <ted@canonical.com>
+
+This program is free software: you can redistribute it and/or modify it
+under the terms of either or both of the following licenses:
+
+1) the GNU Lesser General Public License version 3, as published by the
+Free Software Foundation; and/or
+2) the GNU Lesser General Public License version 2.1, 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 applicable version of the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of both the GNU Lesser General Public
+License version 3 and version 2.1 along with this program. If not, see
+<http://www.gnu.org/licenses/>
+*/
+
+#ifndef INDICATE_GTK_LISTENER_H_INCLUDED__
+#define INDICATE_GTK_LISTENER_H_INCLUDED__ 1
+
+#include <glib.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libindicate/listener.h"
+
+G_BEGIN_DECLS
+
+typedef void (*indicate_listener_get_property_icon_cb) (IndicateListener * listener,
+ IndicateListenerServer * server,
+ IndicateListenerIndicator * indicator,
+ gchar * property,
+ GdkPixbuf * propertydata,
+ gpointer data);
+
+void indicate_listener_get_property_icon (IndicateListener * listener,
+ IndicateListenerServer * server,
+ IndicateListenerIndicator * indicator,
+ gchar * property,
+ indicate_listener_get_property_icon_cb callback,
+ gpointer data);
+
+G_END_DECLS
+
+#endif /* INDICATE_GTK_LISTENER_H_INCLUDED__ */
+
diff --git a/libindicate/Makefile.am b/libindicate/Makefile.am
index c1900a6..d4746fb 100644
--- a/libindicate/Makefile.am
+++ b/libindicate/Makefile.am
@@ -1,3 +1,6 @@
+MARSHAL_PREFIX = indicate_marshal
+MARSHAL_FILE = indicate-marshal
+ENUM_FILE = indicate-enum-types
INCLUDES= \
-DG_LOG_DOMAIN=\"libindicate\"
@@ -6,6 +9,7 @@ EXTRA_DIST = \
indicate-interface.xml \
indicate-listener.xml \
listener-marshal.list \
+ server-marshal.list \
indicate.pc.in
BUILT_SOURCES = \
@@ -14,7 +18,11 @@ BUILT_SOURCES = \
dbus-listener-server.h \
dbus-listener-client.h \
listener-marshal.c \
- listener-marshal.h
+ listener-marshal.h \
+ server-marshal.c \
+ server-marshal.h \
+ $(ENUM_FILE).h \
+ $(ENUM_FILE).c
lib_LTLIBRARIES = \
libindicate.la
@@ -26,7 +34,8 @@ indicate_headers = \
indicator-message.h \
listener.h \
server.h \
- interests.h
+ interests.h \
+ $(ENUM_FILE).h
libindicateinclude_HEADERS = \
$(indicate_headers)
@@ -37,10 +46,14 @@ libindicate_la_SOURCES = \
dbus-indicate-client.h \
dbus-listener-server.h \
dbus-listener-client.h \
+ indicate-enum-types.c \
server.c \
+ server-marshal.c \
+ server-marshal.h \
listener.c \
listener-marshal.c \
listener-marshal.h \
+ listener-private.h \
indicator.c \
indicator-message.c \
interests-priv.h
@@ -94,9 +107,52 @@ listener-marshal.c: $(srcdir)/listener-marshal.list
--prefix=_indicate_listener_marshal $(srcdir)/listener-marshal.list \
> listener-marshal.c
+server-marshal.h: $(srcdir)/server-marshal.list
+ glib-genmarshal --header \
+ --prefix=_indicate_server_marshal $(srcdir)/server-marshal.list \
+ > server-marshal.h
+
+server-marshal.c: $(srcdir)/server-marshal.list
+ glib-genmarshal --body \
+ --prefix=_indicate_server_marshal $(srcdir)/server-marshal.list \
+ > server-marshal.c
+
pkgconfig_DATA = indicate.pc
pkgconfigdir = $(libdir)/pkgconfig
+$(ENUM_FILE).h: s-enum-types-h
+ @true
+s-enum-types-h: $(indicate_headers) Makefile
+ ( cd $(srcdir) && glib-mkenums \
+ --fhead "#ifndef _INDICATE_ENUM_TYPES_H_\n#define _INDICATE_ENUM_TYPES_H_\n\n#include <glib-object.h>\n\nG_BEGIN_DECLS\n" \
+ --fprod "/* enumerations from \"@filename@\" */\n" \
+ --vhead "GType @enum_name@_get_type(void);\n#define INDICATE_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n" \
+ --ftail "G_END_DECLS\n\n#endif /* _INDICATE_ENUM_TYPES_H_ */" \
+ interests.h ) > tmp-$(ENUM_FILE).h \
+ && (cmp -s tmp-$(ENUM_FILE).h $(ENUM_FILE).h || cp tmp-$(ENUM_FILE).h $(ENUM_FILE).h ) \
+ && rm -f tmp-$(ENUM_FILE).h \
+ && echo timestamp > $(@F)
+
+$(ENUM_FILE).c: s-enum-types-c
+ @true
+s-enum-types-c: $(indicate_headers) Makefile
+ ( cd $(srcdir) && glib-mkenums \
+ --fhead "#include \"interests.h\"\n#include <glib-object.h>" \
+ --fprod "\n/* enumerations from \"@filename@\" */" \
+ --vhead "GType\n@enum_name@_get_type (void)\n{\n static GType etype = 0;\n if (etype == 0) {\n static const G@Type@Value values[] = {" \
+ --vprod " { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
+ --vtail " { 0, NULL, NULL }\n };\n etype = g_@type@_register_static (\"@EnumName@\", values);\n }\n return etype;\n}\n" \
+ interests.h ) > tmp-$(ENUM_FILE).c \
+ && (cmp -s tmp-$(ENUM_FILE).c $(ENUM_FILE).c || cp tmp-$(ENUM_FILE).c $(ENUM_FILE).c ) \
+ && rm -f tmp-$(ENUM_FILE).c \
+ && echo timestamp > $(@F)
+
+CLEANFILES = \
+ $(ENUM_FILE).c \
+ $(ENUM_FILE).h \
+ s-enum-types-c \
+ s-enum-types-h
+
if USE_GIR
gobjectintrospection_gir_DATA = \
diff --git a/libindicate/indicate.pc.in b/libindicate/indicate.pc.in
index cdc79b6..ff17ecb 100644
--- a/libindicate/indicate.pc.in
+++ b/libindicate/indicate.pc.in
@@ -5,7 +5,7 @@ bindir=@bindir@
includedir=@includedir@
Cflags: -I${includedir}/libindicate-0.1
-Requires: gtk+-2.0 dbus-glib-1
+Requires: gobject-2.0 glib-2.0 dbus-glib-1
Libs: -L${libdir} -lindicate
Name: libindicate
diff --git a/libindicate/indicator-message.c b/libindicate/indicator-message.c
index 4e8ef30..9cd735a 100644
--- a/libindicate/indicator-message.c
+++ b/libindicate/indicator-message.c
@@ -85,6 +85,13 @@ indicate_indicator_message_finalize (GObject *object)
G_OBJECT_CLASS (indicate_indicator_message_parent_class)->finalize (object);
}
+/**
+ indicate_indicator_message_new:
+
+ Builds a new indicator message object using #g_object_new.
+
+ Return value: A pointer to a new #IndicateIndicatorMessage object.
+*/
static const gchar *
get_indicator_type (IndicateIndicator * indicator)
{
diff --git a/libindicate/indicator-message.h b/libindicate/indicator-message.h
index 0910477..76273c6 100644
--- a/libindicate/indicator-message.h
+++ b/libindicate/indicator-message.h
@@ -47,19 +47,46 @@ G_BEGIN_DECLS
typedef struct _IndicateIndicatorMessage IndicateIndicatorMessage;
typedef struct _IndicateIndicatorMessageClass IndicateIndicatorMessageClass;
-struct _IndicateIndicatorMessageClass
-{
-IndicateIndicatorClass parent_class;
+/**
+ IndicateIndicatorMessageClass:
+ @parent_class: Parent Class
+
+ Subclass of #IndicateIndicator with no new functions or signals.
+*/
+struct _IndicateIndicatorMessageClass {
+ IndicateIndicatorClass parent_class;
};
-struct _IndicateIndicatorMessage
-{
-IndicateIndicator parent;
+/**
+ IndicateIndicatorMessage:
+
+ A class to represent indicators who's 'type' is "message". These
+ are basically indicators that represent messages from humans to
+ humans via computers. Things like instance messages, micro blogging
+ entries or e-mails. All of these qualify as messages.
+
+ TODO: This should include a list of properties that are supported.
+*/
+struct _IndicateIndicatorMessage {
+ IndicateIndicator parent;
};
GType indicate_indicator_message_get_type (void);
IndicateIndicatorMessage * indicate_indicator_message_new (void);
+/**
+ SECTION:indicator-message
+ @short_description: A representation of human generated messages
+ @stability: Unstable
+ @include: libindicate/indicator-message.h
+
+ The message indicators represent messages that come from humans
+ to humans using computers. They come in all different forms with
+ various different interaction protocols, but they all want the human
+ at the computer to interact back with the human that sent the
+ message.
+*/
+
G_END_DECLS
#endif
diff --git a/libindicate/indicator.c b/libindicate/indicator.c
index dfcba67..cb257eb 100644
--- a/libindicate/indicator.c
+++ b/libindicate/indicator.c
@@ -76,6 +76,14 @@ indicate_indicator_class_init (IndicateIndicatorClass * class)
gobj->finalize = indicate_indicator_finalize;
+ /**
+ IndicateIndicator::display:
+ @arg0: The #IndicateIndicator object
+
+ Emitted when the user has clicked on this indicator. In the
+ messaging indicator this would be when someone clicks on the
+ menu item for the indicator.
+ */
signals[USER_DISPLAY] = g_signal_new(INDICATE_INDICATOR_SIGNAL_DISPLAY,
G_TYPE_FROM_CLASS(class),
G_SIGNAL_RUN_LAST,
@@ -83,6 +91,15 @@ indicate_indicator_class_init (IndicateIndicatorClass * class)
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
+ /**
+ IndicateIndicator::hide:
+ @arg0: The #IndicateIndicator object
+
+ Emitted every time this indicator is hidden. This
+ is mostly used by #IndicateServer.
+
+ Typically this results in an emition of #IndicateServer::indicator-removed.
+ */
signals[HIDE] = g_signal_new(INDICATE_INDICATOR_SIGNAL_HIDE,
G_TYPE_FROM_CLASS(class),
G_SIGNAL_RUN_LAST,
@@ -90,6 +107,15 @@ indicate_indicator_class_init (IndicateIndicatorClass * class)
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
+ /**
+ IndicateIndicator::show:
+ @arg0: The #IndicateIndicator object
+
+ Emitted every time this indicator is shown. This
+ is mostly used by #IndicateServer.
+
+ Typically this results in an emition of #IndicateServer::indicator-added.
+ */
signals[SHOW] = g_signal_new(INDICATE_INDICATOR_SIGNAL_SHOW,
G_TYPE_FROM_CLASS(class),
G_SIGNAL_RUN_LAST,
@@ -97,6 +123,16 @@ indicate_indicator_class_init (IndicateIndicatorClass * class)
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
+ /**
+ IndicateIndicator::modified:
+ @arg0: The #IndicateIndicator object
+ @arg1: The name of the property that changed.
+
+ Emitted every time an indicator property is changed.
+ This is mostly used by #IndicateServer.
+
+ Typically this results in an emition of #IndicateServer::indicator-modified.
+ */
signals[MODIFIED] = g_signal_new(INDICATE_INDICATOR_SIGNAL_MODIFIED,
G_TYPE_FROM_CLASS(class),
G_SIGNAL_RUN_LAST,
@@ -145,6 +181,21 @@ indicate_indicator_finalize (GObject * obj)
return;
}
+/**
+ indicate_indicator_get_type:
+
+ Gets a unique #GType for the #IndicateIndicator objects.
+
+ Return value: A unique #GType value.
+*/
+
+/**
+ indicate_indicator_new:
+
+ Builds a new indicator object using g_object_new().
+
+ Return value: A pointer to a new #IndicateIndicator object.
+*/
IndicateIndicator *
indicate_indicator_new (void)
{
@@ -152,6 +203,44 @@ indicate_indicator_new (void)
return indicator;
}
+/**
+ indicate_indicator_new_with_server:
+ @server: The server that should be associated with this indicator.
+
+ Builds a new indicator object using g_object_new() and sets
+ the server to the specified server. Also, adds a reference
+ to the server.
+
+ Return value: A pointer to a new #IndicateIndicator object.
+*/
+IndicateIndicator *
+indicate_indicator_new_with_server (IndicateServer * server)
+{
+ g_return_val_if_fail(server != NULL, NULL);
+
+ IndicateIndicator * indicator = g_object_new(INDICATE_TYPE_INDICATOR, NULL);
+
+ IndicateIndicatorPrivate * priv = INDICATE_INDICATOR_GET_PRIVATE(indicator);
+ if (priv->server != NULL) {
+ g_object_unref(priv->server);
+ priv->server = NULL;
+ }
+
+ priv->server = server;
+ g_object_ref(priv->server);
+
+ return indicator;
+}
+
+
+/**
+ indicate_indicator_show:
+ @indicator: a #IndicateIndicator to act on
+
+ Shows this indicator on the bus. If the #IndicateServer that it's
+ connected to is not shown itself this function will show the server
+ as well using #indicate_server_show.
+*/
void
indicate_indicator_show (IndicateIndicator * indicator)
{
@@ -171,6 +260,13 @@ indicate_indicator_show (IndicateIndicator * indicator)
return;
}
+/**
+ indicate_indicator_hide:
+ @indicator: a #IndicateIndicator to act on
+
+ Hides the indicator from the bus. Does not effect the
+ indicator's #IndicateServer in any way.
+*/
void
indicate_indicator_hide (IndicateIndicator * indicator)
{
@@ -186,6 +282,14 @@ indicate_indicator_hide (IndicateIndicator * indicator)
return;
}
+/**
+ indicate_indicator_is_visible:
+ @indicator: a #IndicateIndicator to act on
+
+ Checkes the visibility status of @indicator.
+
+ Return value: %TRUE if the indicator is visible else %FALSE.
+*/
gboolean
indicate_indicator_is_visible (IndicateIndicator * indicator)
{
@@ -194,6 +298,15 @@ indicate_indicator_is_visible (IndicateIndicator * indicator)
return priv->is_visible;
}
+/**
+ indicate_indicator_get_id:
+ @indicator: a #IndicateIndicator to act on
+
+ Gets the ID value of the @indicator.
+
+ Return value: The ID of the indicator. Can not be zero.
+ Zero represents an error.
+*/
guint
indicate_indicator_get_id (IndicateIndicator * indicator)
{
@@ -202,6 +315,15 @@ indicate_indicator_get_id (IndicateIndicator * indicator)
return priv->id;
}
+/**
+ indicate_indicator_get_indicator_type:
+ @indicator: a #IndicateIndicator to act on
+
+ Returns the type of @indicator. This is largely set by the subclass
+ that the indicator was built with and should not be free'd.
+
+ Return value: A string defining the type or NULL for no type.
+*/
const gchar *
indicate_indicator_get_indicator_type (IndicateIndicator * indicator)
{
@@ -215,6 +337,14 @@ indicate_indicator_get_indicator_type (IndicateIndicator * indicator)
return NULL;
}
+/**
+ indicate_indicator_user_display:
+ @indicator: a #IndicateIndicator to act on
+
+ Emits the #IndicateIndicator::user-display signal simliar to a user
+ clicking on @indicator over the bus. Signal will not be sent if the
+ @indicator is not visible.
+*/
void
indicate_indicator_user_display (IndicateIndicator * indicator)
{
@@ -227,6 +357,18 @@ indicate_indicator_user_display (IndicateIndicator * indicator)
return;
}
+/**
+ indicate_indicator_set_property:
+ @indicator: a #IndicateIndicator to act on
+ @key: name of the property
+ @data: value of the property
+
+ Sets a simple string property on @indicator. If the property
+ had previously been set it will replace it with the new value,
+ otherwise it will create the property. This will include an
+ emition of #IndicateIndicator::modified if the property value
+ was changed.
+*/
void
indicate_indicator_set_property (IndicateIndicator * indicator, const gchar * key, const gchar * data)
{
@@ -238,39 +380,17 @@ indicate_indicator_set_property (IndicateIndicator * indicator, const gchar * ke
return class->set_property(indicator, key, data);
}
-void
-indicate_indicator_set_property_icon (IndicateIndicator * indicator, const gchar * key, const GdkPixbuf * data)
-{
- if (!GDK_IS_PIXBUF(data)) {
- g_warning("Invalide GdkPixbuf");
- return;
- }
-
- GError * error = NULL;
- gchar * png_data;
- gsize png_data_len;
-
- if (!gdk_pixbuf_save_to_buffer((GdkPixbuf *)data, &png_data, &png_data_len, "png", &error, NULL)) {
- if (error == NULL) {
- g_warning("Unable to create pixbuf data stream: %d", png_data_len);
- } else {
- g_warning("Unable to create pixbuf data stream: %s", error->message);
- g_error_free(error);
- error = NULL;
- }
-
- return;
- }
-
- gchar * prop_str = g_base64_encode((guchar *)png_data, png_data_len);
- indicate_indicator_set_property(indicator, key, prop_str);
-
- g_free(prop_str);
- g_free(png_data);
-
- return;
-}
+/**
+ indicate_indicator_set_property_time:
+ @indicator: a #IndicateIndicator to act on
+ @key: name of the property
+ @time: time to set property with
+ This is a helper function that wraps around #indicate_indicator_set_property
+ but takes an #GTimeVal parameter. It then takes the @data
+ parameter converts it to an ISO 8601 time string and
+ uses that data to call #indicate_indicator_set_property.
+*/
void
indicate_indicator_set_property_time (IndicateIndicator * indicator, const gchar * key, GTimeVal * time)
{
@@ -282,6 +402,16 @@ indicate_indicator_set_property_time (IndicateIndicator * indicator, const gchar
return;
}
+/**
+ indicate_indicator_get_property:
+ @indicator: a #IndicateIndicator to act on
+ @key: name of the property
+
+ Returns the value that is set for a property or %NULL if that
+ property is not set.
+
+ Return value: A constant string or NULL.
+*/
const gchar *
indicate_indicator_get_property (IndicateIndicator * indicator, const gchar * key)
{
@@ -293,6 +423,17 @@ indicate_indicator_get_property (IndicateIndicator * indicator, const gchar * ke
return class->get_property(indicator, key);
}
+/**
+ indicate_indicator_list_properties:
+ @indicator: a #IndicateIndicator to act on
+
+ This function gets a list of all the properties that exist
+ on a @indicator. The array may have zero entries but almost
+ always at least has 'type' in it.
+
+ Return value: An array of strings that is the keys of all
+ the properties on this indicator.
+*/
GPtrArray *
indicate_indicator_list_properties (IndicateIndicator * indicator)
{
diff --git a/libindicate/indicator.h b/libindicate/indicator.h
index 8af5568..20b998d 100644
--- a/libindicate/indicator.h
+++ b/libindicate/indicator.h
@@ -33,8 +33,6 @@ License version 3 and version 2.1 along with this program. If not, see
#include <glib.h>
#include <glib-object.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
-
G_BEGIN_DECLS
/* Boilerplate */
@@ -56,10 +54,45 @@ G_BEGIN_DECLS
typedef struct _IndicateIndicator IndicateIndicator;
typedef struct _IndicateIndicatorClass IndicateIndicatorClass;
+/**
+ IndicateIndicator:
+
+ The indicator object represents a single item that is shared over the
+ indicator bus. This could be something like one IM, one e-mail or
+ a single system update. It should be accessed only through its
+ accessors.
+*/
struct _IndicateIndicator {
GObject parent;
};
+#include "server.h"
+
+/**
+ IndicateIndicatorClass:
+ @parent_class: Parent class #GObjectClass.
+ @hide: Slot for #IndicateIndicator::hide.
+ @show: Slot for #IndicateIndicator::show.
+ @user_display: Slot for #IndicateIndicator::user-display.
+ @modified: Slot for #IndicateIndicator::modified.
+ @get_type: Returns a constant string for the type of this indicator.
+ Typically gets overridden by subclasses and defines the type of
+ the indicator. Is called by indicate_indicator_get_indicator_type().
+ @set_property: Called when indicate_indicator_set_property() is called
+ and should set the value. While typically it is overridden by
+ subclasses they usually handle special properties themselves and
+ then call the superclass for storage.
+ @get_property: Called when indicate_indicator_get_property() is called
+ and should return the value requested. Many times this is left alone.
+ @list_properties: Called when indicate_indicator_list_properties() is called
+ and returns a list of the properties available. Again this can be
+ overridden by subclasses to handle special properties.
+
+ All of the functions that are used to modify or change data that is
+ in the indicator. Typically gets subclassed by other types of
+ indicators, for example #IndicateIndicatorMessages.
+
+*/
struct _IndicateIndicatorClass {
GObjectClass parent_class;
@@ -76,7 +109,9 @@ struct _IndicateIndicatorClass {
GType indicate_indicator_get_type(void) G_GNUC_CONST;
+/* New Indicator Functions */
IndicateIndicator * indicate_indicator_new (void);
+IndicateIndicator * indicate_indicator_new_with_server (IndicateServer * server);
/* Show and hide this indicator */
void indicate_indicator_show (IndicateIndicator * indicator);
@@ -95,12 +130,41 @@ void indicate_indicator_user_display (IndicateIndicator * indicator);
/* Properties handling */
void indicate_indicator_set_property (IndicateIndicator * indicator, const gchar * key, const gchar * data);
-void indicate_indicator_set_property_icon (IndicateIndicator * indicator, const gchar * key, const GdkPixbuf * data);
void indicate_indicator_set_property_time (IndicateIndicator * indicator, const gchar * key, GTimeVal * time);
const gchar * indicate_indicator_get_property (IndicateIndicator * indicator, const gchar * key);
GPtrArray * indicate_indicator_list_properties (IndicateIndicator * indicator);
+/**
+ SECTION:indicator
+ @short_description: A representation of state for applications
+ @stability: Unstable
+ @include: libindicate/indicator.h
+
+ An indicator is designed to represent a single instance of something
+ in your application. So this might be an IM or Email using #IndicateIndicatorMessage
+ or any other thing that is a small unit of information to pass on
+ to the user.
+
+ Indicators make no promises about how they are preceived by the
+ user, it's up to the listener to represent them in an intutive and
+ visually appealling way. But, what we can do is provide information
+ on the indicator to provide enough information for the listener
+ to do that.
+
+ Mostly this is done through properties. The only property that is
+ defined for the base indicator is the 'type' property. And this
+ is only available to set by creating a subclass of the
+ #IndicateIndicator object. It is assumed that you can look at the
+ definitions of the various subtypes to determine which properties
+ they support.
+
+ It may be that some users don't want to create objects for every
+ indicator as it could be a lot of overhead if there are large numbers
+ and there is already a data structure representing them all. In that
+ case it is recommended that you ignore the #IndicateIndicator object
+ tree in general and move to subclassing #IndicateServer directly.
+*/
+
G_END_DECLS
#endif /* INDICATE_INDICATOR_H_INCLUDED__ */
-
diff --git a/libindicate/interests.h b/libindicate/interests.h
index 70c52d9..1c6215a 100644
--- a/libindicate/interests.h
+++ b/libindicate/interests.h
@@ -34,8 +34,7 @@ License version 3 and version 2.1 along with this program. If not, see
G_BEGIN_DECLS
-typedef enum _IndicateInterests IndicateInterests;
-enum _IndicateInterests {
+typedef enum {
INDICATE_INTEREST_NONE, /**< We're of no interest */
INDICATE_INTEREST_SERVER_DISPLAY, /**< Displays the server's existance to the user */
INDICATE_INTEREST_SERVER_SIGNAL, /**< Will send signals to the server to be displayed */
@@ -43,7 +42,7 @@ enum _IndicateInterests {
INDICATE_INTEREST_INDICATOR_SIGNAL, /**< Will return signals based on individual indicators being responded to */
INDICATE_INTEREST_INDICATOR_COUNT, /**< Only displays a count of the indicators */
INDICATE_INTEREST_LAST /**< Makes merges and counting easier */
-};
+} IndicateInterests;
G_END_DECLS
diff --git a/libindicate/listener-private.h b/libindicate/listener-private.h
new file mode 100644
index 0000000..ea1b108
--- /dev/null
+++ b/libindicate/listener-private.h
@@ -0,0 +1,63 @@
+/*
+A library to allow applictions to provide simple indications of
+information to be displayed to users of the application through the
+interface shell.
+
+Copyright 2009 Canonical Ltd.
+
+Authors:
+ Ted Gould <ted@canonical.com>
+
+This program is free software: you can redistribute it and/or modify it
+under the terms of either or both of the following licenses:
+
+1) the GNU Lesser General Public License version 3, as published by the
+Free Software Foundation; and/or
+2) the GNU Lesser General Public License version 2.1, 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 applicable version of the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of both the GNU Lesser General Public
+License version 3 and version 2.1 along with this program. If not, see
+<http://www.gnu.org/licenses/>
+*/
+
+#ifndef INDICATE_LISTENER_PRIVATE_H__
+#define INDICATE_LISTENER_PRIVATE_H__ 1
+
+struct _IndicateListenerServer {
+ gchar * name;
+ DBusGProxy * proxy;
+ DBusGConnection * connection;
+ gboolean interests[INDICATE_INTEREST_LAST];
+};
+
+struct _IndicateListenerIndicator {
+ guint id;
+};
+
+typedef struct _IndicateListenerPrivate IndicateListenerPrivate;
+struct _IndicateListenerPrivate
+{
+ DBusGConnection * session_bus;
+ DBusGConnection * system_bus;
+
+ DBusGProxy * dbus_proxy_session;
+ DBusGProxy * dbus_proxy_system;
+
+ GList * proxies_working;
+ GList * proxies_possible;
+
+ GArray * proxy_todo;
+ guint todo_idle;
+};
+
+#define INDICATE_LISTENER_GET_PRIVATE(o) \
+ (G_TYPE_INSTANCE_GET_PRIVATE ((o), INDICATE_TYPE_LISTENER, IndicateListenerPrivate))
+
+#endif /* INDICATE_LISTENER_PRIVATE_H__ */
diff --git a/libindicate/listener.c b/libindicate/listener.c
index 3cc84b6..48ad616 100644
--- a/libindicate/listener.c
+++ b/libindicate/listener.c
@@ -27,6 +27,9 @@ License version 3 and version 2.1 along with this program. If not, see
<http://www.gnu.org/licenses/>
*/
+#include <libxml/parser.h>
+#include <libxml/tree.h>
+
#include "listener.h"
#include "listener-marshal.h"
#include <dbus/dbus-glib-bindings.h>
@@ -51,35 +54,7 @@ enum {
static guint signals[LAST_SIGNAL] = { 0 };
-struct _IndicateListenerServer {
- gchar * name;
- DBusGProxy * proxy;
- DBusGConnection * connection;
- gboolean interests[INDICATE_INTEREST_LAST];
-};
-
-struct _IndicateListenerIndicator {
- guint id;
-};
-
-typedef struct _IndicateListenerPrivate IndicateListenerPrivate;
-struct _IndicateListenerPrivate
-{
- DBusGConnection * session_bus;
- DBusGConnection * system_bus;
-
- DBusGProxy * dbus_proxy_session;
- DBusGProxy * dbus_proxy_system;
-
- GList * proxies_working;
- GList * proxies_possible;
-
- GArray * proxy_todo;
- guint todo_idle;
-};
-
-#define INDICATE_LISTENER_GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), INDICATE_TYPE_LISTENER, IndicateListenerPrivate))
+#include "listener-private.h"
typedef struct {
DBusGProxy * proxy;
@@ -89,6 +64,7 @@ typedef struct {
gchar * type;
IndicateListener * listener;
GHashTable * indicators;
+ guint introspect_level;
IndicateListenerServer server;
} proxy_t;
@@ -129,6 +105,7 @@ static void proxy_indicator_modified (DBusGProxy * proxy, guint id, const gchar
static void proxy_get_indicator_list (DBusGProxy * proxy, GArray * indicators, GError * error, gpointer data);
static void proxy_get_indicator_type (DBusGProxy * proxy, gchar * type, GError * error, gpointer data);
static void proxy_indicators_free (gpointer data);
+static void introspect_this (DBusGProxy * proxy, char * OUT_data, GError * error, gpointer data);
/* DBus interface */
gboolean _indicate_listener_get_indicator_servers (IndicateListener * listener, GList * servers);
@@ -154,35 +131,35 @@ indicate_listener_class_init (IndicateListenerClass * class)
G_STRUCT_OFFSET (IndicateListenerClass, indicator_added),
NULL, NULL,
_indicate_listener_marshal_VOID__POINTER_POINTER_STRING,
- G_TYPE_NONE, 3, G_TYPE_POINTER, G_TYPE_POINTER, G_TYPE_STRING);
+ G_TYPE_NONE, 3, INDICATE_TYPE_LISTENER_SERVER, INDICATE_TYPE_LISTENER_INDICATOR, G_TYPE_STRING);
signals[INDICATOR_REMOVED] = g_signal_new(INDICATE_LISTENER_SIGNAL_INDICATOR_REMOVED,
G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (IndicateListenerClass, indicator_removed),
NULL, NULL,
_indicate_listener_marshal_VOID__POINTER_POINTER_STRING,
- G_TYPE_NONE, 3, G_TYPE_POINTER, G_TYPE_POINTER, G_TYPE_STRING);
+ G_TYPE_NONE, 3, INDICATE_TYPE_LISTENER_SERVER, INDICATE_TYPE_LISTENER_INDICATOR, G_TYPE_STRING);
signals[INDICATOR_MODIFIED] = g_signal_new(INDICATE_LISTENER_SIGNAL_INDICATOR_MODIFIED,
G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (IndicateListenerClass, indicator_modified),
NULL, NULL,
_indicate_listener_marshal_VOID__POINTER_POINTER_STRING_STRING,
- G_TYPE_NONE, 4, G_TYPE_POINTER, G_TYPE_POINTER, G_TYPE_STRING, G_TYPE_STRING);
+ G_TYPE_NONE, 4, INDICATE_TYPE_LISTENER_SERVER, INDICATE_TYPE_LISTENER_INDICATOR, G_TYPE_STRING, G_TYPE_STRING);
signals[SERVER_ADDED] = g_signal_new(INDICATE_LISTENER_SIGNAL_SERVER_ADDED,
G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (IndicateListenerClass, server_added),
NULL, NULL,
_indicate_listener_marshal_VOID__POINTER_STRING,
- G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_STRING);
+ G_TYPE_NONE, 2, INDICATE_TYPE_LISTENER_SERVER, G_TYPE_STRING);
signals[SERVER_REMOVED] = g_signal_new(INDICATE_LISTENER_SIGNAL_SERVER_REMOVED,
G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (IndicateListenerClass, server_removed),
NULL, NULL,
_indicate_listener_marshal_VOID__POINTER_STRING,
- G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_STRING);
+ G_TYPE_NONE, 2, INDICATE_TYPE_LISTENER_SERVER, G_TYPE_STRING);
dbus_g_object_register_marshaller(_indicate_listener_marshal_VOID__UINT_STRING,
G_TYPE_NONE,
@@ -272,8 +249,19 @@ indicate_listener_init (IndicateListener * listener)
static void
indicate_listener_finalize (GObject * obj)
{
- /* IndicateListener * listener = INDICATE_LISTENER(obj); */
-
+ IndicateListener * listener = INDICATE_LISTENER(obj);
+ IndicateListenerPrivate * priv = INDICATE_LISTENER_GET_PRIVATE(listener);
+
+ if (priv->todo_idle != 0) {
+ g_idle_remove_by_data(obj);
+ }
+ /* Hack: proxy_struct_destroy() lacks a user_data parameter, but since the
+ * caller is responsible for handling params on the stack, it works
+ */
+ g_list_foreach(priv->proxies_possible, (GFunc)proxy_struct_destroy, NULL);
+ g_list_free(priv->proxies_possible);
+ g_list_foreach(priv->proxies_working, (GFunc)proxy_struct_destroy, NULL);
+ g_list_free(priv->proxies_working);
G_OBJECT_CLASS (indicate_listener_parent_class)->finalize (obj);
return;
}
@@ -281,8 +269,6 @@ indicate_listener_finalize (GObject * obj)
IndicateListener *
indicate_listener_new (void)
{
- g_warning("Creating a new listener is generally discouraged, please use indicate_listener_ref_default");
-
IndicateListener * listener;
listener = g_object_new(INDICATE_TYPE_LISTENER, NULL);
return listener;
@@ -499,13 +485,9 @@ todo_idle (gpointer data)
priv->proxies_possible = g_list_prepend(priv->proxies_possible, proxyt);
- /* I think that we need to have this as there is a race
- * condition here. If someone comes on the bus and we get
- * that message, but before we set up the handler for the ServerShow
- * signal it gets sent, we wouldn't get it. So then we would
- * miss an indicator server coming on the bus. I'd like to not
- * generate a warning in every app with DBus though. */
- indicate_listener_server_get_type(listener, &proxyt->server, get_type_cb, proxyt);
+ /* Look through the introspection data to see if this
+ is already a server */
+ introspect_this (NULL, NULL, NULL, proxyt);
return TRUE;
}
@@ -708,8 +690,7 @@ proxy_indicators_free (gpointer data)
typedef enum _get_property_type get_property_type;
enum _get_property_type {
PROPERTY_TYPE_STRING,
- PROPERTY_TYPE_TIME,
- PROPERTY_TYPE_ICON
+ PROPERTY_TYPE_TIME
};
typedef struct _get_property_t get_property_t;
@@ -740,44 +721,6 @@ get_property_cb (DBusGProxy *proxy, char * OUT_value, GError *error, gpointer us
cb(get_property_data->listener, get_property_data->server, get_property_data->indicator, get_property_data->property, OUT_value, get_property_data->data);
break;
}
- case PROPERTY_TYPE_ICON: {
- indicate_listener_get_property_icon_cb cb = (indicate_listener_get_property_icon_cb)get_property_data->cb;
-
- /* There is no icon */
- if (OUT_value == NULL || OUT_value[0] == '\0') {
- break;
- }
-
- gsize length = 0;
- guchar * icondata = g_base64_decode(OUT_value, &length);
-
- GInputStream * input = g_memory_input_stream_new_from_data(icondata, length, NULL);
- if (input == NULL) {
- g_warning("Cound not create input stream from icon property data");
- g_free(icondata);
- break;
- }
-
- GError * error = NULL;
- GdkPixbuf * icon = gdk_pixbuf_new_from_stream(input, NULL, &error);
- if (icon != NULL) {
- cb(get_property_data->listener, get_property_data->server, get_property_data->indicator, get_property_data->property, icon, get_property_data->data);
- }
-
- if (error != NULL) {
- g_warning("Unable to build Pixbuf from icon data: %s", error->message);
- g_error_free(error);
- }
-
- error = NULL;
- g_input_stream_close(input, NULL, &error);
- if (error != NULL) {
- g_warning("Unable to close input stream: %s", error->message);
- g_error_free(error);
- }
- g_free(icondata);
- break;
- }
case PROPERTY_TYPE_TIME: {
indicate_listener_get_property_time_cb cb = (indicate_listener_get_property_time_cb)get_property_data->cb;
GTimeVal time;
@@ -824,12 +767,6 @@ indicate_listener_get_property_time (IndicateListener * listener, IndicateListen
return get_property_helper(listener, server, indicator, property, G_CALLBACK(callback), data, PROPERTY_TYPE_TIME);
}
-void
-indicate_listener_get_property_icon (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * property, indicate_listener_get_property_icon_cb callback, gpointer data)
-{
- return get_property_helper(listener, server, indicator, property, G_CALLBACK(callback), data, PROPERTY_TYPE_ICON);
-}
-
gboolean
_indicate_listener_get_indicator_servers (IndicateListener * listener, GList * servers)
{
@@ -1002,6 +939,10 @@ interest_cb (DBusGProxy *proxy, GError *error, gpointer userdata)
void
indicate_listener_server_show_interest (IndicateListener * listener, IndicateListenerServer * server, IndicateInterests interest)
{
+ if (!(interest > INDICATE_INTEREST_NONE && interest < INDICATE_INTEREST_LAST)) {
+ return;
+ }
+
if (!server->interests[interest]) {
org_freedesktop_indicator_show_interest_async (server->proxy, interest_to_string(interest), interest_cb, server);
server->interests[interest] = TRUE;
@@ -1025,3 +966,119 @@ indicate_listener_server_check_interest (IndicateListener * listener, IndicateLi
return server->interests[interest];
}
+GType
+indicate_listener_server_get_gtype (void)
+{
+ static GType our_type = 0;
+
+ if (our_type == 0)
+ our_type = g_pointer_type_register_static ("IndicateListenerServer");
+
+ return our_type;
+}
+
+GType
+indicate_listener_indicator_get_gtype (void)
+{
+ static GType our_type = 0;
+
+ if (our_type == 0)
+ our_type = g_pointer_type_register_static ("IndicateListenerIndicator");
+
+ return our_type;
+}
+
+static const gchar * _introspector_path[] = {"", "org", "freedesktop", "indicate", NULL};
+static const gchar * _introspector_fullpath[] = {"/", "/org", "/org/freedesktop", "/org/freedesktop/indicate", NULL};
+static const gchar * _introspector_interface = "org.freedesktop.indicator";
+
+static void
+introspect_this (DBusGProxy * proxy, char * OUT_data, GError * error, gpointer data)
+{
+ /* g_debug("Introspect this:\n%s", OUT_data); */
+ proxy_t * server = (proxy_t *)data;
+ if (proxy != NULL) {
+ g_object_unref(proxy);
+ }
+ if (error != NULL) {
+ /* We probably couldn't introspect that far up. That's
+ life, it happens. Or there's a timeout, that happens
+ too, I guess some apps are too busy for us. */
+ /* g_debug("Introspection error on %s object %s: %s", server->name, _introspector_fullpath[server->introspect_level], error->message); */
+ return;
+ }
+
+ if (OUT_data != NULL) {
+ xmlDocPtr xmldoc;
+ /* Parse the XML */
+ xmldoc = xmlReadMemory(OUT_data, g_utf8_strlen(OUT_data, 16*1024), "introspection.xml", NULL, 0);
+
+ /* Check for root being "node" */
+ xmlNodePtr root = xmlDocGetRootElement(xmldoc);
+ if (g_strcmp0(root->name, "node") != 0) {
+ xmlFreeDoc(xmldoc);
+ g_warning("Introspection data from %s is not valid: %s", server->name, OUT_data);
+ return;
+ }
+
+ server->introspect_level += 1;
+ const gchar * nodename = NULL;
+ const gchar * nameval = NULL;
+ if (_introspector_path[server->introspect_level] == NULL) {
+ /* We're looking for our interface */
+ nodename = "interface";
+ nameval = _introspector_interface;
+ } else {
+ /* We're looking for our next node */
+ nodename = "node";
+ nameval = _introspector_path[server->introspect_level];
+ }
+
+ gboolean found = FALSE;
+ xmlNodePtr children;
+ for (children = root->children; children != NULL; children = children->next) {
+ gchar * xmlnameval = NULL;
+ if (g_strcmp0(children->name, nodename) == 0) {
+ xmlAttrPtr attrib;
+ for (attrib = children->properties; attrib != NULL; attrib = attrib->next) {
+ if (g_strcmp0(attrib->name, "name") == 0) {
+ if (attrib->children != NULL) {
+ xmlnameval = attrib->children->content;
+ }
+ break;
+ }
+ }
+
+ if (!g_strcmp0(nameval, xmlnameval)) {
+ found = TRUE;
+ break;
+ }
+ }
+ }
+
+ xmlFreeDoc(xmldoc);
+
+ if (!found) {
+ /* Ah, nothing we're interested in */
+ return;
+ }
+
+ if (_introspector_path[server->introspect_level] == NULL) {
+ /* If we've found the interface at the end of the tree, whoo! hoo! */
+ /* Now we know it's safe to get the type on it */
+ indicate_listener_server_get_type(server->listener, &server->server, get_type_cb, server);
+ return;
+ }
+ } else {
+ server->introspect_level = 0;
+ }
+
+ DBusGProxy * newproxy = dbus_g_proxy_new_for_name(server->connection,
+ server->name,
+ _introspector_fullpath[server->introspect_level],
+ DBUS_INTERFACE_INTROSPECTABLE);
+
+ org_freedesktop_DBus_Introspectable_introspect_async(newproxy, introspect_this, server);
+
+ return;
+}
diff --git a/libindicate/listener.h b/libindicate/listener.h
index 0fdaa9b..37cda03 100644
--- a/libindicate/listener.h
+++ b/libindicate/listener.h
@@ -33,8 +33,6 @@ License version 3 and version 2.1 along with this program. If not, see
#include <glib.h>
#include <glib-object.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
-
#include "indicator.h"
#include "server.h"
#include "interests.h"
@@ -59,7 +57,12 @@ G_BEGIN_DECLS
#define INDICATE_LISTENER_INDICATOR_ID(indicator) (indicate_listener_indicator_get_id(indicator))
typedef struct _IndicateListenerServer IndicateListenerServer;
+#define INDICATE_TYPE_LISTENER_SERVER (indicate_listener_server_get_gtype ())
+GType indicate_listener_server_get_gtype (void) G_GNUC_CONST;
+
typedef struct _IndicateListenerIndicator IndicateListenerIndicator;
+#define INDICATE_TYPE_LISTENER_INDICATOR (indicate_listener_indicator_get_gtype ())
+GType indicate_listener_indicator_get_gtype (void) G_GNUC_CONST;
typedef struct _IndicateListener IndicateListener;
struct _IndicateListener {
@@ -83,7 +86,6 @@ GType indicate_listener_get_type (void) G_GNUC_CONST;
typedef void (*indicate_listener_get_property_cb) (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * property, gchar * propertydata, gpointer data);
typedef void (*indicate_listener_get_property_time_cb) (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * property, GTimeVal * propertydata, gpointer data);
-typedef void (*indicate_listener_get_property_icon_cb) (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * property, GdkPixbuf * propertydata, gpointer data);
typedef void (*indicate_listener_get_server_property_cb) (IndicateListener * listener, IndicateListenerServer * server, gchar * value, gpointer data);
/* Create a new listener */
@@ -101,12 +103,6 @@ void indicate_listener_get_property_time (IndicateListener * l
gchar * property,
indicate_listener_get_property_time_cb callback,
gpointer data);
-void indicate_listener_get_property_icon (IndicateListener * listener,
- IndicateListenerServer * server,
- IndicateListenerIndicator * indicator,
- gchar * property,
- indicate_listener_get_property_icon_cb callback,
- gpointer data);
void indicate_listener_display (IndicateListener * listener,
IndicateListenerServer * server,
IndicateListenerIndicator * indicator);
diff --git a/libindicate/server-marshal.list b/libindicate/server-marshal.list
new file mode 100644
index 0000000..540f0fe
--- /dev/null
+++ b/libindicate/server-marshal.list
@@ -0,0 +1,29 @@
+# A library to allow applictions to provide simple indications of
+# information to be displayed to users of the application through the
+# interface shell.
+#
+# Copyright 2009 Canonical Ltd.
+#
+# Authors:
+# Ted Gould <ted@canonical.com>
+#
+# This program is free software: you can redistribute it and/or modify it
+# under the terms of either or both of the following licenses:
+#
+# 1) the GNU Lesser General Public License version 3, as published by the
+# Free Software Foundation; and/or
+# 2) the GNU Lesser General Public License version 2.1, 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 applicable version of the GNU Lesser General Public
+# License for more details.
+#
+# You should have received a copy of both the GNU Lesser General Public
+# License version 3 and version 2.1 along with this program. If not, see
+# <http://www.gnu.org/licenses/>
+#
+# IndicatorAdded
+VOID:UINT,STRING
diff --git a/libindicate/server.c b/libindicate/server.c
index e3d071c..a3d3be8 100644
--- a/libindicate/server.c
+++ b/libindicate/server.c
@@ -29,6 +29,7 @@ License version 3 and version 2.1 along with this program. If not, see
#include "server.h"
#include "interests-priv.h"
+#include "server-marshal.h"
#include <dbus/dbus-glib.h>
#include <dbus/dbus-glib-lowlevel.h>
@@ -163,41 +164,101 @@ indicate_server_class_init (IndicateServerClass * class)
gobj->set_property = set_property;
gobj->get_property = get_property;
+ /**
+ IndicateServer::indicator-added:
+ @arg0: The #IndicateServer object
+ @arg1: The #IndicateIndicator ID number
+ @arg2: The type of the indicator
+
+ Emitted every time that a new indicator is made visible to
+ the world. This results in a signal on DBus.
+
+ Can be emitted by subclasses using indicate_server_emit_indicator_added()
+ */
signals[INDICATOR_ADDED] = g_signal_new(INDICATE_SERVER_SIGNAL_INDICATOR_ADDED,
G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (IndicateServerClass, indicator_added),
NULL, NULL,
- g_cclosure_marshal_VOID__UINT_POINTER,
+ _indicate_server_marshal_VOID__UINT_STRING,
G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_STRING);
+ /**
+ IndicateServer::indicator-removed:
+ @arg0: The #IndicateServer object
+ @arg1: The #IndicateIndicator ID number
+ @arg2: The type of the indicator
+
+ Emitted every time that a new indicator is made invisible to
+ the world. This results in a signal on DBus.
+
+ Can be emitted by subclasses using indicate_server_emit_indicator_removed()
+ */
signals[INDICATOR_REMOVED] = g_signal_new(INDICATE_SERVER_SIGNAL_INDICATOR_REMOVED,
G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (IndicateServerClass, indicator_removed),
NULL, NULL,
- g_cclosure_marshal_VOID__UINT_POINTER,
+ _indicate_server_marshal_VOID__UINT_STRING,
G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_STRING);
+ /**
+ IndicateServer::indicator-modified:
+ @arg0: The #IndicateServer object
+ @arg1: The #IndicateIndicator ID number
+ @arg2: The name of the property modified
+
+ Emitted every time that a property on an indicator changes
+ and it is visible to the world. This results in a signal on DBus.
+
+ Can be emitted by subclasses using indicate_server_emit_indicator_modified()
+ */
signals[INDICATOR_MODIFIED] = g_signal_new(INDICATE_SERVER_SIGNAL_INDICATOR_MODIFIED,
G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (IndicateServerClass, indicator_modified),
NULL, NULL,
- g_cclosure_marshal_VOID__UINT_POINTER,
+ _indicate_server_marshal_VOID__UINT_STRING,
G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_STRING);
+ /**
+ IndicateServer::server-show:
+ @arg0: The #IndicateServer object
+ @arg1: The type of the server
+
+ Emitted when a server comes onto DBus by being shown. This
+ is typically when listeners start reacting to the application's
+ indicators. This results in a signal on DBus.
+ */
signals[SERVER_SHOW] = g_signal_new(INDICATE_SERVER_SIGNAL_SERVER_SHOW,
G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (IndicateServerClass, server_show),
NULL, NULL,
- g_cclosure_marshal_VOID__POINTER,
+ g_cclosure_marshal_VOID__STRING,
G_TYPE_NONE, 1, G_TYPE_STRING);
+ /**
+ IndicateServer::server-hide:
+ @arg0: The #IndicateServer object
+ @arg1: The type of the server
+
+ Emitted when a server removes itself from DBus. This results
+ in a signal on DBus.
+ */
signals[SERVER_HIDE] = g_signal_new(INDICATE_SERVER_SIGNAL_SERVER_HIDE,
G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (IndicateServerClass, server_hide),
NULL, NULL,
- g_cclosure_marshal_VOID__POINTER,
+ g_cclosure_marshal_VOID__STRING,
G_TYPE_NONE, 1, G_TYPE_STRING);
+ /**
+ IndicateServer::server-display:
+ @arg0: The #IndicateServer object
+
+ Emitted when a listener signals that the server itself should be
+ displayed. This signal is caused by a user clicking on the application
+ item in the Messaging Menu. This signal is emitted by DBus.
+
+ Can be emitted by subclasses using indicate_server_emit_server_display()
+ */
signals[SERVER_DISPLAY] = g_signal_new(INDICATE_SERVER_SIGNAL_SERVER_DISPLAY,
G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST,
@@ -205,6 +266,14 @@ indicate_server_class_init (IndicateServerClass * class)
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
+ /**
+ IndicateServer::interest-added:
+ @arg0: The #IndicateServer object
+ @arg1: The interest that was added from #IndicateInterests
+
+ Emitted when a listener signals that they are interested in
+ this server for a particular reason. This signal is emitted by DBus.
+ */
signals[INTEREST_ADDED] = g_signal_new(INDICATE_SERVER_SIGNAL_INTEREST_ADDED,
G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST,
@@ -212,6 +281,14 @@ indicate_server_class_init (IndicateServerClass * class)
NULL, NULL,
g_cclosure_marshal_VOID__UINT,
G_TYPE_NONE, 1, G_TYPE_UINT);
+ /**
+ IndicateServer::interest-removed:
+ @arg0: The #IndicateServer object
+ @arg1: The interest that was removed from #IndicateInterests
+
+ Emitted when a listener signals that they are no longer interested in
+ this server for a particular reason. This signal is emitted by DBus.
+ */
signals[INTEREST_REMOVED] = g_signal_new(INDICATE_SERVER_SIGNAL_INTEREST_REMOVED,
G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST,
@@ -366,7 +443,17 @@ indicate_server_error_quark (void)
return quark;
}
+/**
+ indicate_server_show:
+ @server: The #IndicateServer to be shown
+ This function exports the object onto DBus and shows it
+ to the world. This will be the start of it receiving external
+ signals from DBus. It is likely that, if there are listeners
+ running, there will several #IndicateServer::interest-added
+ signals coming shortly after this function. This function
+ emits the #IndicateServer::server-added signal across the bus.
+*/
void
indicate_server_show (IndicateServer * server)
{
@@ -403,6 +490,16 @@ indicate_server_show (IndicateServer * server)
return;
}
+/**
+ indicate_server_hide:
+ @server: The #IndicateServer to hide.
+
+ This function hides the server from DBus so that it does
+ not get signals anymore. This causes the signal #IndicateServer::server-hide
+ to be sent across the bus for all listeners. Also internally
+ it will signal #IndicateServer::interest-removed for all the
+ interests that were currently set for this server.
+*/
void
indicate_server_hide (IndicateServer * server)
{
@@ -610,6 +707,16 @@ indicator_modified_cb (IndicateIndicator * indicator, gchar * property, Indicate
g_signal_emit(server, signals[INDICATOR_MODIFIED], 0, indicate_indicator_get_id(indicator), property, TRUE);
}
+/**
+ indicate_server_add_indicator:
+ @server: The #IndicateServer to add the #IndicateIndictor to.
+ @indicator: The #IndicateIndicator to add.
+
+ This function adds an indicator @indicator to the list that are
+ watched by the server @server. This means that signals that are
+ emitted by the indicator will be picked up and passed via DBus onto
+ listeners of the application.
+*/
void
indicate_server_add_indicator (IndicateServer * server, IndicateIndicator * indicator)
{
@@ -633,6 +740,14 @@ indicate_server_add_indicator (IndicateServer * server, IndicateIndicator * indi
return;
}
+/**
+ indicate_server_remove_indicator:
+ @server: The #IndicateServer to remove the #IndicateIndictor from.
+ @indicator: The #IndicateIndicator to remove.
+
+ Removes an indicator @indicator from being watched by the server @server
+ so it's signals are no longer watched and set over DBus.
+*/
void
indicate_server_remove_indicator (IndicateServer * server, IndicateIndicator * indicator)
{
@@ -663,6 +778,15 @@ indicate_server_set_dbus_object (const gchar * obj)
return;
}
+/**
+ indicate_server_set_desktop_file:
+ @server: The #IndicateServer to set the type of
+ @path: The new desktop file representing the server
+
+ This is a convience function to set the #IndicateServer:desktop
+ property of the @server object. The property can also be set
+ via traditional means, but this one is easier to read.
+*/
void
indicate_server_set_desktop_file (IndicateServer * server, const gchar * path)
{
@@ -673,6 +797,15 @@ indicate_server_set_desktop_file (IndicateServer * server, const gchar * path)
return;
}
+/**
+ indicate_server_set_type:
+ @server: The #IndicateServer to set the type of
+ @type: The new type of the server
+
+ This is a convience function to set the #IndicateServer:type
+ property of the @server object. The property can also be set
+ via traditional means, but this one is easier to read.
+*/
void
indicate_server_set_type (IndicateServer * server, const gchar * type)
{
@@ -685,6 +818,17 @@ indicate_server_set_type (IndicateServer * server, const gchar * type)
static IndicateServer * default_indicate_server = NULL;
+/**
+ indicate_server_ref_default:
+
+ This function will return a reference to the default #IndicateServer
+ reference if there is one, or it will create one if one had not
+ previously been created. It is recommended that all applications
+ use this function to create a #IndicateServer as it ensure that there
+ is only one per application.
+
+ Return value: A reference to the default #IndicateServer instance.
+*/
IndicateServer *
indicate_server_ref_default (void)
{
@@ -699,6 +843,16 @@ indicate_server_ref_default (void)
return default_indicate_server;
}
+/**
+ indicate_server_set_default:
+ @server: The #IndicateServer that should be used
+
+ This function is used to set the default #IndicateServer that will
+ be used when creating #IndicateIndicators or for anyone else that
+ calls indicate_server_ref_default(). Typically this is just an
+ instance of #IndicateServer but applications that create a subclass
+ of #IndicateServer should set this as well.
+*/
void
indicate_server_set_default (IndicateServer * server)
{
@@ -1103,6 +1257,15 @@ _indicate_server_show_indicator_to_user (IndicateServer * server, guint id, GErr
return TRUE;
}
+/**
+ indicate_server_get_next_id:
+ @server: The #IndicateServer the ID will be on
+
+ Returns the next available unused ID that an indicator
+ can have.
+
+ Return value: A valid indicator ID.
+*/
guint
indicate_server_get_next_id (IndicateServer * server)
{
@@ -1207,7 +1370,41 @@ _indicate_server_remove_interest (IndicateServer * server, gchar * interest, DBu
return FALSE;
}
+/**
+ indicate_server_check_interest:
+ @server: The #IndicateServer being checked
+ @interest: Which interest type we're checking for
+
+ This function looks at all the interest that various listeners
+ have specified that they have for this server and returns whether
+ there is a listener that has the interest specified in @interest.
+
+ Return value: %TRUE if a listener as the interest otherwise %FALSE
+*/
+gboolean
+indicate_server_check_interest (IndicateServer * server, IndicateInterests interest)
+{
+ IndicateServerClass * class = INDICATE_SERVER_GET_CLASS(server);
+
+ if (class != NULL && class->check_interest != NULL) {
+ return class->check_interest (server, interest);
+ }
+
+ g_warning("check_interest function not implemented in this server class: %s", G_OBJECT_TYPE_NAME(server));
+ return FALSE;
+}
+
/* Signal emission functions for sub-classes of the server */
+
+/**
+ indicate_server_emit_indicator_added:
+ @server: The #IndicateServer being represented
+ @id: The ID of the indicator being added
+ @type: The type of the indicator
+
+ This function emits the #IndicateServer::indicator-added signal and is
+ used by subclasses.
+*/
void
indicate_server_emit_indicator_added (IndicateServer *server, guint id, const gchar *type)
{
@@ -1217,6 +1414,15 @@ indicate_server_emit_indicator_added (IndicateServer *server, guint id, const gc
g_signal_emit(server, signals[INDICATOR_ADDED], 0, id, type);
}
+/**
+ indicate_server_emit_indicator_removed:
+ @server: The #IndicateServer being represented
+ @id: The ID of the indicator being removed
+ @type: The type of the indicator
+
+ This function emits the #IndicateServer::indicator-removed signal and is
+ used by subclasses.
+*/
void
indicate_server_emit_indicator_removed (IndicateServer *server, guint id, const gchar *type)
{
@@ -1226,6 +1432,15 @@ indicate_server_emit_indicator_removed (IndicateServer *server, guint id, const
g_signal_emit(server, signals[INDICATOR_REMOVED], 0, id, type);
}
+/**
+ indicate_server_emit_indicator_modified:
+ @server: The #IndicateServer being represented
+ @id: The ID of the indicator with the modified property
+ @property: The name of the property being modified
+
+ This function emits the #IndicateServer::indicator-modified signal and is
+ used by subclasses.
+*/
void
indicate_server_emit_indicator_modified (IndicateServer *server, guint id, const gchar *property)
{
@@ -1235,6 +1450,13 @@ indicate_server_emit_indicator_modified (IndicateServer *server, guint id, const
g_signal_emit(server, signals[INDICATOR_MODIFIED], 0, id, property);
}
+/**
+ indicate_server_emit_server_display:
+ @server: The #IndicateServer being displayed
+
+ This function emits the #IndicateServer::server-display signal and is
+ used by subclasses.
+*/
void
indicate_server_emit_server_display (IndicateServer *server)
{
diff --git a/libindicate/server.h b/libindicate/server.h
index cfb4334..cff76c4 100644
--- a/libindicate/server.h
+++ b/libindicate/server.h
@@ -33,7 +33,6 @@ License version 3 and version 2.1 along with this program. If not, see
#include <glib.h>
#include <glib-object.h>
-#include "indicator.h"
#include "interests.h"
G_BEGIN_DECLS
@@ -57,11 +56,65 @@ G_BEGIN_DECLS
#define INDICATE_SERVER_SIGNAL_INTEREST_ADDED "interest-added"
#define INDICATE_SERVER_SIGNAL_INTEREST_REMOVED "interest-removed"
+/**
+ IndicateServer:
+
+ This is the object that represents the overall connection
+ between this application and DBus. It acts as the proxy for
+ incomming DBus calls and also sends the appropriate signals
+ on DBus for events happening on other objects locally. It
+ provides some settings that effection how the application as
+ a whole is perceived by listeners of the indicator protocol.
+*/
typedef struct _IndicateServer IndicateServer;
struct _IndicateServer {
GObject parent;
};
+#include "indicator.h"
+
+/**
+ IndicateServerClass:
+ @parent: Parent Class
+ @indicator_added: Slot for #IndicateServer::indicator-added.
+ @indicator_removed: Slot for #IndicateServer::indicator-removed.
+ @indicator_modified: Slot for #IndicateServer::indicator-modified.
+ @server_show: Slot for #IndicateServer::server-show.
+ @server_hide: Slot for #IndicateServer::server-hide.
+ @server_display: Slot for #IndicateServer::server-display.
+ @interest_added: Slot for #IndicateServer::interest-added.
+ @interest_removed: Slot for #IndicateServer::interest-removed.
+ @get_indicator_count: Returns the number of indicators that are visible
+ on the bus. Hidden indicators should not be counted.
+ @get_indicator_count_by_type: Returns the number of indicators that are
+ of a given type and visible on the bus.
+ @get_indicator_list: List all of the indicators that are visible.
+ @get_indicator_list_by_type: List all of the indicators of a given
+ type that are visible.
+ @get_indicator_property: Get a property from a particular indicator.
+ @get_indicator_property_group: Get the values for a set of properties
+ as an array of entries, returning an array as well.
+ @get_indicator_properties: Get a list of all the properties that are
+ on a particular indicator.
+ @show_indicator_to_user: Respond to someone on the bus asking to show
+ a particular indicator to the user.
+ @get_next_id: Get the next unused indicator ID.
+ @show_interest: React to someone signifying that they are interested
+ in this server.
+ @remove_interest: Someone on the bus is no longer interest in this
+ server, remove it's interest.
+ @check_interest: Check to see if anyone on the bus is interested in this
+ server for a particular feature.
+ @indicate_server_reserved1: Reserved for future use
+ @indicate_server_reserved2: Reserved for future use
+ @indicate_server_reserved3: Reserved for future use
+ @indicate_server_reserved4: Reserved for future use
+
+ All of the functions and signals that make up the server class
+ including those that are public API to the application and those
+ that are public API to all of DBus. Subclasses may need to
+ implement a large portion of these.
+*/
typedef struct _IndicateServerClass IndicateServerClass;
struct _IndicateServerClass {
GObjectClass parent;
@@ -99,9 +152,6 @@ struct _IndicateServerClass {
GType indicate_server_get_type (void) G_GNUC_CONST;
-/* Create a new server */
-IndicateServer * indicate_server_new (void);
-
/* Sets the object. By default this is /org/freedesktop/indicators */
void indicate_server_set_dbus_object (const gchar * obj);
@@ -134,6 +184,35 @@ void indicate_server_emit_indicator_removed (IndicateServer *server, guint id, c
void indicate_server_emit_indicator_modified (IndicateServer *server, guint id, const gchar *property);
void indicate_server_emit_server_display (IndicateServer *server);
+/**
+ SECTION:server
+ @short_description: The representation of the application on DBus.
+ @stability: Unstable
+ @include: libindicate/server.h
+
+ The server object is the object that provides the functions on
+ to DBus for other applications to call. It does this by implementing
+ the DBus indicator spec, but it also allows for subclassing so that
+ subclasses don't have to worry about the DBus-isms as much as
+ the functionality that they're trying to express.
+
+ For simple applications there is limited need to set anything
+ more than the desktop file and the type of the server using
+ indicate_server_set_desktop_file() and indicate_server_set_type().
+ Each of these function sets the respective value and expresses
+ it in a way that other applications on the bus can read it.
+
+ More advanced applications might find the need to subclass the
+ #IndicateServer object and make their own. This is likely the
+ case where applications have complex data stores that they don't
+ want to turn into a large set of #GObjects that can take up a
+ significant amount of memory in the program.
+
+ In general, it is recommended that application authors go with
+ the high memory path first, and then optimize by implementing
+ their server on a second pass.
+*/
+
G_END_DECLS
#endif /* INDICATE_SERVER_H_INCLUDED__ */
diff --git a/libindicator/Makefile.am b/libindicator/Makefile.am
new file mode 100644
index 0000000..be68721
--- /dev/null
+++ b/libindicator/Makefile.am
@@ -0,0 +1,14 @@
+EXTRA_DIST = \
+ indicator.pc.in
+
+libindicatorincludedir=$(includedir)/libindicator-0.1/libindicator
+
+indicator_headers = \
+ indicator.h
+
+libindicatorinclude_HEADERS = \
+ $(indicator_headers)
+
+pkgconfig_DATA = indicator.pc
+pkgconfigdir = $(libdir)/pkgconfig
+
diff --git a/libindicator/indicator.h b/libindicator/indicator.h
new file mode 100644
index 0000000..8947f5b
--- /dev/null
+++ b/libindicator/indicator.h
@@ -0,0 +1,34 @@
+
+#ifndef __LIBINDICATOR_INDICATOR_H_SEEN__
+#define __LIBINDICATOR_INDICATOR_H_SEEN__ 1
+
+#include <gtk/gtk.h>
+
+#define INDICATOR_GET_LABEL_S "get_label"
+typedef GtkLabel * (*get_label_t)(void);
+GtkLabel * get_label (void);
+
+#define INDICATOR_GET_ICON_S "get_icon"
+typedef GtkImage * (*get_icon_t) (void);
+GtkImage * get_icon (void);
+
+#define INDICATOR_GET_MENU_S "get_menu"
+typedef GtkMenu * (*get_menu_t) (void);
+GtkMenu * get_menu (void);
+
+#define INDICATOR_GET_VERSION_S "get_version"
+typedef gchar * (*get_version_t) (void);
+gchar * get_version (void);
+
+#define INDICATOR_VERSION "0.2.0"
+#define INDICATOR_SET_VERSION gchar * get_version(void) { return INDICATOR_VERSION; }
+#define INDICATOR_VERSION_CHECK(x) (!g_strcmp0(x, INDICATOR_VERSION))
+
+#define INDICATOR_GET_NAME_S "get_name"
+typedef gchar * (*get_name_t) (void);
+gchar * get_name (void);
+#define INDICATOR_SET_NAME(x) gchar * get_name(void) {return (x); }
+
+
+#endif /* __LIBINDICATOR_INDICATOR_H_SEEN__ */
+
diff --git a/libindicator/indicator.pc.in b/libindicator/indicator.pc.in
new file mode 100644
index 0000000..ba88032
--- /dev/null
+++ b/libindicator/indicator.pc.in
@@ -0,0 +1,16 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+bindir=@bindir@
+includedir=@includedir@
+
+indicatordir=${libdir}/indicators/2/
+
+Cflags: -I${includedir}/libindicator-0.1
+Requires: gtk+-2.0
+Libs:
+
+Name: libindicator
+Description: libindicator.
+Version: @VERSION@
+
diff --git a/src/Makefile.am b/src/Makefile.am
index 818bdd9..97af739 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -5,7 +5,8 @@ libexec_PROGRAMS = \
indicator_applet_CFLAGS = \
-DG_LOG_DOMAIN=\""Indicator-Applet"\" \
-DDATADIR=\""$(datadir)"\" \
- -DINDICATOR_DIR=\""$(libdir)/indicators/1"\" \
+ -DINDICATOR_DIR=\""$(libdir)/indicators/2"\" \
+ -I$(srcdir)/.. \
$(APPLET_CFLAGS)
indicator_applet_SOURCES = \
diff --git a/src/applet-main.c b/src/applet-main.c
index df93b27..5af2763 100644
--- a/src/applet-main.c
+++ b/src/applet-main.c
@@ -24,7 +24,8 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <panel-applet.h>
#include <libgnomeui/gnome-ui-init.h>
-#define SYMBOL_NAME "get_menu_item"
+#include "libindicator/indicator.h"
+
#define ICONS_DIR (DATADIR G_DIR_SEPARATOR_S "indicator-applet" G_DIR_SEPARATOR_S "icons")
static gboolean applet_fill_cb (PanelApplet * applet, const gchar * iid, gpointer data);
@@ -61,16 +62,10 @@ load_module (const gchar * name, GtkWidget * menu)
g_debug("Looking at Module: %s", name);
g_return_val_if_fail(name != NULL, FALSE);
- guint suffix_len = strlen(G_MODULE_SUFFIX);
- guint name_len = strlen(name);
-
- g_return_val_if_fail(name_len > suffix_len, FALSE);
-
- int i;
- for (i = 0; i < suffix_len; i++) {
- if (name[(name_len - suffix_len) + i] != (G_MODULE_SUFFIX)[i])
- return FALSE;
+ if (!g_str_has_suffix(name, G_MODULE_SUFFIX)) {
+ return FALSE;
}
+
g_debug("Loading Module: %s", name);
gchar * fullpath = g_build_filename(INDICATOR_DIR, name, NULL);
@@ -79,14 +74,52 @@ load_module (const gchar * name, GtkWidget * menu)
g_free(fullpath);
g_return_val_if_fail(module != NULL, FALSE);
- GtkWidget * (*make_item)(void);
- g_return_val_if_fail(g_module_symbol(module, SYMBOL_NAME, (gpointer *)(&make_item)), FALSE);
- g_return_val_if_fail(make_item != NULL, FALSE);
+ get_version_t lget_version = NULL;
+ g_return_val_if_fail(g_module_symbol(module, INDICATOR_GET_VERSION_S, (gpointer *)(&lget_version)), FALSE);
+ if (!INDICATOR_VERSION_CHECK(lget_version())) {
+ g_warning("Indicator using API version '%s' we're expecting '%s'", lget_version(), INDICATOR_VERSION);
+ return FALSE;
+ }
- GtkWidget * menuitem = make_item();
- g_return_val_if_fail(GTK_MENU_ITEM(menuitem), FALSE);
+ get_label_t lget_label = NULL;
+ g_return_val_if_fail(g_module_symbol(module, INDICATOR_GET_LABEL_S, (gpointer *)(&lget_label)), FALSE);
+ g_return_val_if_fail(lget_label != NULL, FALSE);
+ GtkLabel * label = lget_label();
+
+ get_icon_t lget_icon = NULL;
+ g_return_val_if_fail(g_module_symbol(module, INDICATOR_GET_ICON_S, (gpointer *)(&lget_icon)), FALSE);
+ g_return_val_if_fail(lget_icon != NULL, FALSE);
+ GtkImage * icon = lget_icon();
+
+ get_menu_t lget_menu = NULL;
+ g_return_val_if_fail(g_module_symbol(module, INDICATOR_GET_MENU_S, (gpointer *)(&lget_menu)), FALSE);
+ g_return_val_if_fail(lget_menu != NULL, FALSE);
+ GtkMenu * lmenu = lget_menu();
+
+ if (label == NULL && icon == NULL) {
+ /* This is the case where there is nothing to display,
+ kinda odd that we'd have a module with nothing. */
+ g_warning("No label or icon. Odd.");
+ return FALSE;
+ }
+
+ GtkWidget * menuitem = gtk_menu_item_new();
+ GtkWidget * hbox = gtk_hbox_new(FALSE, 3);
+ if (icon != NULL) {
+ gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(icon), FALSE, FALSE, 0);
+ }
+ if (label != NULL) {
+ gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(label), FALSE, FALSE, 0);
+ }
+ gtk_container_add(GTK_CONTAINER(menuitem), hbox);
+ gtk_widget_show(hbox);
+
+ if (lmenu != NULL) {
+ gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), GTK_WIDGET(lmenu));
+ }
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
+ gtk_widget_show(menuitem);
return TRUE;
}
@@ -258,6 +291,7 @@ applet_fill_cb (PanelApplet * applet, const gchar * iid, gpointer data)
if (load_module(name, menubar))
indicators_loaded++;
}
+ g_dir_close (dir);
}
if (indicators_loaded == 0) {
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 862046e..03bd980 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,72 +1,141 @@
+TESTS = \
+ test_simple \
+ test_interests \
+ test_interests_multi \
+ test_thousand_indicators
+
libexec_PROGRAMS = \
- indicate-and-crash \
- indicate-alot \
- listen-and-print \
- im-client \
- show-hide-server
+ test-interests-client \
+ test-interests-server \
+ test-interests-server1 \
+ test-interests-server2 \
+ test-interests-server3 \
+ test-interests-server4 \
+ test-interests-server5 \
+ test-thousand-indicators-client \
+ test-thousand-indicators-server \
+ test-simple-client \
+ test-simple-server
+
+EXTRA_DIST = \
+ $(TESTS)
+
+test_simple: test-simple-client test-simple-server
+
+test_simple_client_SOURCES = \
+ test-simple-client.c
+
+test_simple_client_CFLAGS = \
+ $(LIBINDICATE_CFLAGS) -I$(srcdir)/..
+
+test_simple_client_LDADD = \
+ ../libindicate/libindicate.la \
+ $(LIBINDICATE_LIBS)
-indicate_and_crash_SOURCES = \
- indicate-and-crash.c
+test_simple_server_SOURCES = \
+ test-simple-server.c
-indicate_and_crash_CFLAGS = \
- -I $(srcdir)/.. \
- $(LIBINDICATE_CFLAGS)
+test_simple_server_CFLAGS = \
+ $(LIBINDICATE_CFLAGS) -I$(srcdir)/..
-indicate_and_crash_LDADD = \
+test_simple_server_LDADD = \
../libindicate/libindicate.la \
$(LIBINDICATE_LIBS)
-indicate_alot_SOURCES = \
- indicate-alot.c
+test_interests: test-interests-client test-interests-server
+
+test_interests_client_SOURCES = \
+ test-interests-client.c
+
+test_interests_client_CFLAGS = \
+ $(LIBINDICATE_CFLAGS) -I$(srcdir)/..
+
+test_interests_client_LDADD = \
+ ../libindicate/libindicate.la \
+ $(LIBINDICATE_LIBS)
+
+test_interests_server_SOURCES = \
+ test-interests-server.c
+
+test_interests_server_CFLAGS = \
+ $(LIBINDICATE_CFLAGS) -I$(srcdir)/..
+
+test_interests_server_LDADD = \
+ ../libindicate/libindicate.la \
+ $(LIBINDICATE_LIBS)
+
+test_interests_multi: test-interests-client test-interests-server1 test-interests-server2 test-interests-server3 test-interests-server4 test-interests-server5
+
+test_interests_server1_SOURCES = \
+ test-interests-server1.c
-indicate_alot_CFLAGS = \
- -I $(srcdir)/.. \
- $(LIBINDICATE_CFLAGS)
+test_interests_server1_CFLAGS = \
+ $(LIBINDICATE_CFLAGS) -I$(srcdir)/..
-indicate_alot_LDADD = \
+test_interests_server1_LDADD = \
../libindicate/libindicate.la \
$(LIBINDICATE_LIBS)
-listen_and_print_SOURCES = \
- listen-and-print.c
+test_interests_server2_SOURCES = \
+ test-interests-server2.c
-listen_and_print_CFLAGS = \
- -I $(srcdir)/.. \
- $(LIBINDICATE_CFLAGS)
+test_interests_server2_CFLAGS = \
+ $(LIBINDICATE_CFLAGS) -I$(srcdir)/..
-listen_and_print_LDADD = \
+test_interests_server2_LDADD = \
../libindicate/libindicate.la \
$(LIBINDICATE_LIBS)
-im_client_SOURCES = \
- im-client.c
+test_interests_server3_SOURCES = \
+ test-interests-server3.c
-im_client_CFLAGS = \
- -I $(srcdir)/.. \
- $(LIBINDICATE_CFLAGS)
+test_interests_server3_CFLAGS = \
+ $(LIBINDICATE_CFLAGS) -I$(srcdir)/..
-im_client_LDADD = \
+test_interests_server3_LDADD = \
../libindicate/libindicate.la \
$(LIBINDICATE_LIBS)
-show_hide_server_SOURCES = \
- show-hide-server.c
+test_interests_server4_SOURCES = \
+ test-interests-server4.c
-show_hide_server_CFLAGS = \
- -I $(srcdir)/.. \
- $(LIBINDICATE_CFLAGS)
+test_interests_server4_CFLAGS = \
+ $(LIBINDICATE_CFLAGS) -I$(srcdir)/..
-show_hide_server_LDADD = \
+test_interests_server4_LDADD = \
../libindicate/libindicate.la \
$(LIBINDICATE_LIBS)
-examplesdir = $(docdir)/examples/
+test_interests_server5_SOURCES = \
+ test-interests-server5.c
-examples_DATA = \
- $(indicate_and_crash_SOURCES) \
- $(indicate_alot_SOURCES) \
- $(listen_and_print_SOURCES) \
- $(im_client_SOURCES)
+test_interests_server5_CFLAGS = \
+ $(LIBINDICATE_CFLAGS) -I$(srcdir)/..
+
+test_interests_server5_LDADD = \
+ ../libindicate/libindicate.la \
+ $(LIBINDICATE_LIBS)
+
+test_thousand_indicators: test-thousand-indicators-client test-thousand-indicators-server
+
+test_thousand_indicators_client_SOURCES = \
+ test-thousand-indicators-client.c
+
+test_thousand_indicators_client_CFLAGS = \
+ $(LIBINDICATE_CFLAGS) -I$(srcdir)/..
+
+test_thousand_indicators_client_LDADD = \
+ ../libindicate/libindicate.la \
+ $(LIBINDICATE_LIBS)
+
+test_thousand_indicators_server_SOURCES = \
+ test-thousand-indicators-server.c
+
+test_thousand_indicators_server_CFLAGS = \
+ $(LIBINDICATE_CFLAGS) -I$(srcdir)/..
+
+test_thousand_indicators_server_LDADD = \
+ ../libindicate/libindicate.la \
+ $(LIBINDICATE_LIBS)
-EXTRA_DIST = $(examples_DATA)
diff --git a/tests/test-interests-client.c b/tests/test-interests-client.c
new file mode 100644
index 0000000..bde3b26
--- /dev/null
+++ b/tests/test-interests-client.c
@@ -0,0 +1,63 @@
+
+#include <glib.h>
+#include "libindicate/indicator.h"
+#include "libindicate/server.h"
+#include "libindicate/interests.h"
+
+static gboolean passed = TRUE;
+static GMainLoop * mainloop = NULL;
+static gboolean interests[INDICATE_INTEREST_LAST] = {0};
+
+static gboolean
+check_interests (void)
+{
+ guint i;
+ for (i = INDICATE_INTEREST_NONE + 1; i < INDICATE_INTEREST_LAST; i++) {
+ if (!interests[i]) {
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+}
+
+static void
+interest_added (IndicateServer * server, IndicateInterests interest)
+{
+ g_debug("Oh, someone is interested in my for: %d", interest);
+ interests[interest] = TRUE;
+
+ if (check_interests()) {
+ g_main_loop_quit(mainloop);
+ }
+
+ return;
+}
+
+static gboolean
+done_timeout_cb (gpointer data)
+{
+ g_debug("All interests not set");
+ passed = FALSE;
+ g_main_loop_quit(mainloop);
+ return FALSE;
+}
+
+int
+main (int argc, char * argv)
+{
+ g_type_init();
+
+ IndicateIndicator * indicator = indicate_indicator_new();
+ indicate_indicator_show(indicator);
+
+ IndicateServer * server = indicate_server_ref_default();
+ g_signal_connect(G_OBJECT(server), INDICATE_SERVER_SIGNAL_INTEREST_ADDED, G_CALLBACK(interest_added), NULL);
+
+ g_timeout_add_seconds(2, done_timeout_cb, indicator);
+
+ mainloop = g_main_loop_new(NULL, FALSE);
+ g_main_loop_run(mainloop);
+
+ return !passed;
+}
diff --git a/tests/test-interests-server.c b/tests/test-interests-server.c
new file mode 100644
index 0000000..e1433d8
--- /dev/null
+++ b/tests/test-interests-server.c
@@ -0,0 +1,45 @@
+
+#include <glib.h>
+#include "libindicate/listener.h"
+
+static gboolean passed = TRUE;
+static GMainLoop * mainloop = NULL;
+
+static void
+server_added (IndicateListener * listener, IndicateListenerServer * server, gchar * type, gpointer data)
+{
+ g_debug("Indicator Server Added: %s %s", INDICATE_LISTENER_SERVER_DBUS_NAME(server), type);
+
+ gint i;
+ for (i = INDICATE_INTEREST_NONE - 2; i < INDICATE_INTEREST_LAST + 2; i++) {
+ g_debug("Indicating Interests: %d", i);
+ indicate_listener_server_show_interest(listener, server, i);
+ }
+
+ return;
+}
+
+static gboolean
+failed_cb (gpointer data)
+{
+ g_debug("Done indicatating interest");
+ g_main_loop_quit(mainloop);
+ return FALSE;
+}
+
+int
+main (int argc, char * argv)
+{
+ g_type_init();
+
+ IndicateListener * listener = indicate_listener_ref_default();
+
+ g_signal_connect(listener, INDICATE_LISTENER_SIGNAL_SERVER_ADDED, G_CALLBACK(server_added), NULL);
+
+ g_timeout_add_seconds(2, failed_cb, NULL);
+
+ mainloop = g_main_loop_new(NULL, FALSE);
+ g_main_loop_run(mainloop);
+
+ return !passed;
+}
diff --git a/tests/test-interests-server1.c b/tests/test-interests-server1.c
new file mode 100644
index 0000000..e0d77f3
--- /dev/null
+++ b/tests/test-interests-server1.c
@@ -0,0 +1,41 @@
+
+#include <glib.h>
+#include "libindicate/listener.h"
+
+static gboolean passed = TRUE;
+static GMainLoop * mainloop = NULL;
+
+static void
+server_added (IndicateListener * listener, IndicateListenerServer * server, gchar * type, gpointer data)
+{
+ g_debug("Indicator Server Added: %s %s", INDICATE_LISTENER_SERVER_DBUS_NAME(server), type);
+ #define INTEREST 1
+ g_debug("Setting Interest: %d", INTEREST);
+ indicate_listener_server_show_interest(listener, server, INTEREST);
+ return;
+}
+
+static gboolean
+failed_cb (gpointer data)
+{
+ g_debug("Done indicatating interest");
+ g_main_loop_quit(mainloop);
+ return FALSE;
+}
+
+int
+main (int argc, char * argv)
+{
+ g_type_init();
+
+ IndicateListener * listener = indicate_listener_ref_default();
+
+ g_signal_connect(listener, INDICATE_LISTENER_SIGNAL_SERVER_ADDED, G_CALLBACK(server_added), NULL);
+
+ g_timeout_add_seconds(2, failed_cb, NULL);
+
+ mainloop = g_main_loop_new(NULL, FALSE);
+ g_main_loop_run(mainloop);
+
+ return !passed;
+}
diff --git a/tests/test-interests-server2.c b/tests/test-interests-server2.c
new file mode 100644
index 0000000..0416c21
--- /dev/null
+++ b/tests/test-interests-server2.c
@@ -0,0 +1,41 @@
+
+#include <glib.h>
+#include "libindicate/listener.h"
+
+static gboolean passed = TRUE;
+static GMainLoop * mainloop = NULL;
+
+static void
+server_added (IndicateListener * listener, IndicateListenerServer * server, gchar * type, gpointer data)
+{
+ g_debug("Indicator Server Added: %s %s", INDICATE_LISTENER_SERVER_DBUS_NAME(server), type);
+ #define INTEREST 2
+ g_debug("Setting Interest: %d", INTEREST);
+ indicate_listener_server_show_interest(listener, server, INTEREST);
+ return;
+}
+
+static gboolean
+failed_cb (gpointer data)
+{
+ g_debug("Done indicatating interest");
+ g_main_loop_quit(mainloop);
+ return FALSE;
+}
+
+int
+main (int argc, char * argv)
+{
+ g_type_init();
+
+ IndicateListener * listener = indicate_listener_ref_default();
+
+ g_signal_connect(listener, INDICATE_LISTENER_SIGNAL_SERVER_ADDED, G_CALLBACK(server_added), NULL);
+
+ g_timeout_add_seconds(2, failed_cb, NULL);
+
+ mainloop = g_main_loop_new(NULL, FALSE);
+ g_main_loop_run(mainloop);
+
+ return !passed;
+}
diff --git a/tests/test-interests-server3.c b/tests/test-interests-server3.c
new file mode 100644
index 0000000..7d889b1
--- /dev/null
+++ b/tests/test-interests-server3.c
@@ -0,0 +1,41 @@
+
+#include <glib.h>
+#include "libindicate/listener.h"
+
+static gboolean passed = TRUE;
+static GMainLoop * mainloop = NULL;
+
+static void
+server_added (IndicateListener * listener, IndicateListenerServer * server, gchar * type, gpointer data)
+{
+ g_debug("Indicator Server Added: %s %s", INDICATE_LISTENER_SERVER_DBUS_NAME(server), type);
+ #define INTEREST 3
+ g_debug("Setting Interest: %d", INTEREST);
+ indicate_listener_server_show_interest(listener, server, INTEREST);
+ return;
+}
+
+static gboolean
+failed_cb (gpointer data)
+{
+ g_debug("Done indicatating interest");
+ g_main_loop_quit(mainloop);
+ return FALSE;
+}
+
+int
+main (int argc, char * argv)
+{
+ g_type_init();
+
+ IndicateListener * listener = indicate_listener_ref_default();
+
+ g_signal_connect(listener, INDICATE_LISTENER_SIGNAL_SERVER_ADDED, G_CALLBACK(server_added), NULL);
+
+ g_timeout_add_seconds(2, failed_cb, NULL);
+
+ mainloop = g_main_loop_new(NULL, FALSE);
+ g_main_loop_run(mainloop);
+
+ return !passed;
+}
diff --git a/tests/test-interests-server4.c b/tests/test-interests-server4.c
new file mode 100644
index 0000000..50e6db1
--- /dev/null
+++ b/tests/test-interests-server4.c
@@ -0,0 +1,41 @@
+
+#include <glib.h>
+#include "libindicate/listener.h"
+
+static gboolean passed = TRUE;
+static GMainLoop * mainloop = NULL;
+
+static void
+server_added (IndicateListener * listener, IndicateListenerServer * server, gchar * type, gpointer data)
+{
+ g_debug("Indicator Server Added: %s %s", INDICATE_LISTENER_SERVER_DBUS_NAME(server), type);
+ #define INTEREST 4
+ g_debug("Setting Interest: %d", INTEREST);
+ indicate_listener_server_show_interest(listener, server, INTEREST);
+ return;
+}
+
+static gboolean
+failed_cb (gpointer data)
+{
+ g_debug("Done indicatating interest");
+ g_main_loop_quit(mainloop);
+ return FALSE;
+}
+
+int
+main (int argc, char * argv)
+{
+ g_type_init();
+
+ IndicateListener * listener = indicate_listener_ref_default();
+
+ g_signal_connect(listener, INDICATE_LISTENER_SIGNAL_SERVER_ADDED, G_CALLBACK(server_added), NULL);
+
+ g_timeout_add_seconds(2, failed_cb, NULL);
+
+ mainloop = g_main_loop_new(NULL, FALSE);
+ g_main_loop_run(mainloop);
+
+ return !passed;
+}
diff --git a/tests/test-interests-server5.c b/tests/test-interests-server5.c
new file mode 100644
index 0000000..d415716
--- /dev/null
+++ b/tests/test-interests-server5.c
@@ -0,0 +1,41 @@
+
+#include <glib.h>
+#include "libindicate/listener.h"
+
+static gboolean passed = TRUE;
+static GMainLoop * mainloop = NULL;
+
+static void
+server_added (IndicateListener * listener, IndicateListenerServer * server, gchar * type, gpointer data)
+{
+ g_debug("Indicator Server Added: %s %s", INDICATE_LISTENER_SERVER_DBUS_NAME(server), type);
+ #define INTEREST 5
+ g_debug("Setting Interest: %d", INTEREST);
+ indicate_listener_server_show_interest(listener, server, INTEREST);
+ return;
+}
+
+static gboolean
+failed_cb (gpointer data)
+{
+ g_debug("Done indicatating interest");
+ g_main_loop_quit(mainloop);
+ return FALSE;
+}
+
+int
+main (int argc, char * argv)
+{
+ g_type_init();
+
+ IndicateListener * listener = indicate_listener_ref_default();
+
+ g_signal_connect(listener, INDICATE_LISTENER_SIGNAL_SERVER_ADDED, G_CALLBACK(server_added), NULL);
+
+ g_timeout_add_seconds(2, failed_cb, NULL);
+
+ mainloop = g_main_loop_new(NULL, FALSE);
+ g_main_loop_run(mainloop);
+
+ return !passed;
+}
diff --git a/tests/test-simple-client.c b/tests/test-simple-client.c
new file mode 100644
index 0000000..f8db55a
--- /dev/null
+++ b/tests/test-simple-client.c
@@ -0,0 +1,30 @@
+
+#include <glib.h>
+#include "libindicate/indicator.h"
+
+static gboolean passed = TRUE;
+static GMainLoop * mainloop = NULL;
+
+static gboolean
+done_timeout_cb (gpointer data)
+{
+ g_debug("All done.");
+ g_main_loop_quit(mainloop);
+ return FALSE;
+}
+
+int
+main (int argc, char * argv)
+{
+ g_type_init();
+
+ IndicateIndicator * indicator = indicate_indicator_new();
+ indicate_indicator_show(indicator);
+
+ g_timeout_add_seconds(2, done_timeout_cb, indicator);
+
+ mainloop = g_main_loop_new(NULL, FALSE);
+ g_main_loop_run(mainloop);
+
+ return !passed;
+}
diff --git a/tests/test-simple-server.c b/tests/test-simple-server.c
new file mode 100644
index 0000000..0a04e85
--- /dev/null
+++ b/tests/test-simple-server.c
@@ -0,0 +1,39 @@
+
+#include <glib.h>
+#include "libindicate/listener.h"
+
+static gboolean passed = TRUE;
+static GMainLoop * mainloop = NULL;
+
+static void
+server_added (IndicateListener * listener, IndicateListenerServer * server, gchar * type, gpointer data)
+{
+ g_debug("Indicator Server Added: %s %s", INDICATE_LISTENER_SERVER_DBUS_NAME(server), type);
+ g_main_loop_quit(mainloop);
+}
+
+static gboolean
+failed_cb (gpointer data)
+{
+ g_debug("Failed to get a server in 5 seconds.");
+ passed = FALSE;
+ g_main_loop_quit(mainloop);
+ return FALSE;
+}
+
+int
+main (int argc, char * argv)
+{
+ g_type_init();
+
+ IndicateListener * listener = indicate_listener_ref_default();
+
+ g_signal_connect(listener, INDICATE_LISTENER_SIGNAL_SERVER_ADDED, G_CALLBACK(server_added), NULL);
+
+ g_timeout_add_seconds(5, failed_cb, NULL);
+
+ mainloop = g_main_loop_new(NULL, FALSE);
+ g_main_loop_run(mainloop);
+
+ return !passed;
+}
diff --git a/tests/test-thousand-indicators-client.c b/tests/test-thousand-indicators-client.c
new file mode 100644
index 0000000..0ac7305
--- /dev/null
+++ b/tests/test-thousand-indicators-client.c
@@ -0,0 +1,34 @@
+
+#include <glib.h>
+#include "libindicate/indicator.h"
+
+static gboolean passed = TRUE;
+static GMainLoop * mainloop = NULL;
+
+static gboolean
+done_timeout_cb (gpointer data)
+{
+ g_debug("All done.");
+ g_main_loop_quit(mainloop);
+ return FALSE;
+}
+
+int
+main (int argc, char * argv)
+{
+ g_type_init();
+
+ int i;
+ for (i = 0; i < 1000; i++) {
+ /* Memory leak :) */
+ IndicateIndicator * indicator = indicate_indicator_new();
+ indicate_indicator_show(indicator);
+ }
+
+ g_timeout_add_seconds(2, done_timeout_cb, NULL);
+
+ mainloop = g_main_loop_new(NULL, FALSE);
+ g_main_loop_run(mainloop);
+
+ return !passed;
+}
diff --git a/tests/test-thousand-indicators-server.c b/tests/test-thousand-indicators-server.c
new file mode 100644
index 0000000..285e56b
--- /dev/null
+++ b/tests/test-thousand-indicators-server.c
@@ -0,0 +1,43 @@
+
+#include <glib.h>
+#include "libindicate/listener.h"
+
+static gboolean passed = TRUE;
+static GMainLoop * mainloop = NULL;
+static guint indicator_count = 0;
+
+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);
+ indicator_count++;
+ if (indicator_count == 1000) {
+ g_main_loop_quit(mainloop);
+ }
+}
+
+static gboolean
+failed_cb (gpointer data)
+{
+ g_debug("Failed to get a server in 5 seconds.");
+ passed = FALSE;
+ g_main_loop_quit(mainloop);
+ return FALSE;
+}
+
+int
+main (int argc, char * argv)
+{
+ g_type_init();
+
+ IndicateListener * listener = indicate_listener_ref_default();
+
+ g_signal_connect(listener, INDICATE_LISTENER_SIGNAL_INDICATOR_ADDED, G_CALLBACK(indicator_added), NULL);
+
+ g_timeout_add_seconds(5, failed_cb, NULL);
+
+ mainloop = g_main_loop_new(NULL, FALSE);
+ g_main_loop_run(mainloop);
+
+ return !passed;
+}
diff --git a/tests/test_interests b/tests/test_interests
new file mode 100755
index 0000000..750a789
--- /dev/null
+++ b/tests/test_interests
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+DBUS_RUNNER="dbus-test-runner --dbus-config /usr/share/dbus-test-runner/session.conf"
+
+${DBUS_RUNNER} --task ./test-interests-client --task-name Client --task ./test-interests-server --task-name Server
diff --git a/tests/test_interests_multi b/tests/test_interests_multi
new file mode 100755
index 0000000..4dbdee8
--- /dev/null
+++ b/tests/test_interests_multi
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+DBUS_RUNNER="dbus-test-runner --dbus-config /usr/share/dbus-test-runner/session.conf"
+
+${DBUS_RUNNER} --task ./test-interests-client --task-name Client --task ./test-interests-server1 --task-name Server1 --task ./test-interests-server2 --task-name Server2 --task ./test-interests-server3 --task-name Server3 --task ./test-interests-server4 --task-name Server4 --task ./test-interests-server5 --task-name Server5
diff --git a/tests/test_simple b/tests/test_simple
new file mode 100755
index 0000000..1b0dc4c
--- /dev/null
+++ b/tests/test_simple
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+DBUS_RUNNER="dbus-test-runner --dbus-config /usr/share/dbus-test-runner/session.conf"
+
+${DBUS_RUNNER} --task ./test-simple-client --task-name Client --task ./test-simple-server --task-name Server
diff --git a/tests/test_thousand_indicators b/tests/test_thousand_indicators
new file mode 100755
index 0000000..fb1079d
--- /dev/null
+++ b/tests/test_thousand_indicators
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+DBUS_RUNNER="dbus-test-runner --dbus-config /usr/share/dbus-test-runner/session.conf"
+
+${DBUS_RUNNER} --task ./test-thousand-indicators-client --task-name Client --task ./test-thousand-indicators-server --task-name Server