diff options
Diffstat (limited to 'libindicate')
-rw-r--r-- | libindicate/Makefile.am | 71 | ||||
-rw-r--r-- | libindicate/indicate-listener.xml | 41 | ||||
-rw-r--r-- | libindicate/indicator.h | 3 | ||||
-rw-r--r-- | libindicate/listener.c | 25 | ||||
-rw-r--r-- | libindicate/listener.h | 1 |
5 files changed, 110 insertions, 31 deletions
diff --git a/libindicate/Makefile.am b/libindicate/Makefile.am index 707d297..b851919 100644 --- a/libindicate/Makefile.am +++ b/libindicate/Makefile.am @@ -4,12 +4,15 @@ INCLUDES= \ EXTRA_DIST = \ indicate-interface.xml \ + indicate-listener.xml \ listener-marshal.list \ indicate.pc.in BUILT_SOURCES = \ dbus-indicate-server.h \ dbus-indicate-client.h \ + dbus-listener-server.h \ + dbus-listener-client.h \ listener-marshal.c \ listener-marshal.h @@ -31,6 +34,8 @@ libindicate_la_SOURCES = \ $(indicate_headers) \ dbus-indicate-server.h \ dbus-indicate-client.h \ + dbus-listener-server.h \ + dbus-listener-client.h \ server.c \ listener.c \ listener-marshal.c \ @@ -63,6 +68,20 @@ dbus-indicate-client.h: indicate-interface.xml --output=dbus-indicate-client.h \ $(srcdir)/indicate-interface.xml +dbus-listener-server.h: indicate-listener.xml + dbus-binding-tool \ + --prefix=indicate_listener \ + --mode=glib-server \ + --output=dbus-listener-server.h \ + $(srcdir)/indicate-listener.xml + +dbus-listener-client.h: indicate-listener.xml + dbus-binding-tool \ + --prefix=indicate_listener \ + --mode=glib-client \ + --output=dbus-listener-client.h \ + $(srcdir)/indicate-listener.xml + listener-marshal.h: $(srcdir)/listener-marshal.list glib-genmarshal --header \ --prefix=indicate_listener_marshal $(srcdir)/listener-marshal.list \ @@ -76,28 +95,32 @@ listener-marshal.c: $(srcdir)/listener-marshal.list pkgconfig_DATA = indicate.pc pkgconfigdir = $(libdir)/pkgconfig -#gobjectintrospection_gir_DATA = \ -# Indicate-0.1.gir -#gobjectintrospection_girdir = $(datadir)/gir -# -#gobjectintrospection_type_DATA = \ -# Indicate-0.1.typelib -#gobjectintrospection_typedir = $(libdir)/girepository -# -#irscanner_headers = $(patsubst %,$(srcdir)/%,$(indicate_headers)) -#Indicate-0.1.gir: $(irscanner_headers) -# $(G_IR_SCANNER) \ -# -v --namespace Indicate \ -# --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-0.1.gir $(irscanner_headers) -# -#Indicate-0.1.typelib: Indicate-0.1.gir -# $(G_IR_COMPILER) \ -# --includedir=$(srcdir) Indicate-0.1.gir \ -# -o Indicate-0.1.typelib +gobjectintrospection_gir_DATA = \ + Indicate-0.1.gir +gobjectintrospection_girdir = $(datadir)/gir + +gobjectintrospection_type_DATA = \ + Indicate-0.1.typelib +gobjectintrospection_typedir = $(libdir)/girepository + +irscanner_headers = $(patsubst %,$(srcdir)/%,$(indicate_headers)) +Indicate-0.1.gir: $(irscanner_headers) + $(G_IR_SCANNER) \ + -v --namespace Indicate \ + --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-0.1.gir $(irscanner_headers) + +Indicate-0.1.typelib: Indicate-0.1.gir + $(G_IR_COMPILER) \ + --includedir=$(srcdir) Indicate-0.1.gir \ + -o Indicate-0.1.typelib + +DISTCLEANFILES = \ + Indicate-0.1.gir \ + Indicate-0.1.typelib diff --git a/libindicate/indicate-listener.xml b/libindicate/indicate-listener.xml new file mode 100644 index 0000000..c834489 --- /dev/null +++ b/libindicate/indicate-listener.xml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +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/> +--> +<node name="/"> + <interface name="org.freedesktop.indicator.listener"> + +<!-- Functions --> + <method name="GetIndicatorServers"> + <arg type="as" name="server_ids" direction="out" /> + </method> + +<!-- End of interesting stuff --> + + </interface> +</node> diff --git a/libindicate/indicator.h b/libindicate/indicator.h index 5faea3c..8af5568 100644 --- a/libindicate/indicator.h +++ b/libindicate/indicator.h @@ -78,9 +78,6 @@ GType indicate_indicator_get_type(void) G_GNUC_CONST; IndicateIndicator * indicate_indicator_new (void); -/* Should these just be GObject properties? */ -void indicate_indicator_set_property (IndicateIndicator * indicator, const gchar * property_name, const gchar * property_value); - /* Show and hide this indicator */ void indicate_indicator_show (IndicateIndicator * indicator); void indicate_indicator_hide (IndicateIndicator * indicator); diff --git a/libindicate/listener.c b/libindicate/listener.c index d8926f1..b786552 100644 --- a/libindicate/listener.c +++ b/libindicate/listener.c @@ -31,6 +31,8 @@ License version 3 and version 2.1 along with this program. If not, see #include "listener-marshal.h" #include <dbus/dbus-glib-bindings.h> #include "dbus-indicate-client.h" +#include "dbus-listener-client.h" +#include "dbus-listener-server.h" /* Errors */ enum { @@ -81,6 +83,7 @@ typedef struct { typedef struct { DBusGConnection * bus; gchar * name; + gboolean startup; } proxy_todo_t; G_DEFINE_TYPE (IndicateListener, indicate_listener, G_TYPE_OBJECT); @@ -90,7 +93,7 @@ static void indicate_listener_finalize (GObject * obj); static void dbus_owner_change (DBusGProxy * proxy, const gchar * name, const gchar * prev, const gchar * new, IndicateListener * listener); static void proxy_struct_destroy (gpointer data); static void build_todo_list_cb (DBusGProxy * proxy, char ** names, GError * error, void * data); -static void todo_list_add (const gchar * name, DBusGProxy * proxy, IndicateListener * listener); +static void todo_list_add (const gchar * name, DBusGProxy * proxy, IndicateListener * listener, gboolean startup); static gboolean todo_idle (gpointer data); void get_type_cb (IndicateListener * listener, IndicateListenerServer * server, gchar * type, gpointer data); static void proxy_server_added (DBusGProxy * proxy, const gchar * type, proxy_t * proxyt); @@ -286,7 +289,7 @@ dbus_owner_change (DBusGProxy * proxy, const gchar * name, const gchar * prev, c /* g_debug("Name change on %s bus: '%s' from '%s' to '%s'", bus_name, name, prev, new); */ if (prev != NULL && prev[0] == '\0') { - todo_list_add(name, proxy, listener); + todo_list_add(name, proxy, listener, FALSE); } if (new != NULL && new[0] == '\0') { proxy_t * proxyt; @@ -369,14 +372,14 @@ build_todo_list_cb (DBusGProxy * proxy, char ** names, GError * error, void * da guint i = 0; for (i = 0; names[i] != NULL; i++) { - todo_list_add(names[i], proxy, listener); + todo_list_add(names[i], proxy, listener, TRUE); } return; } static void -todo_list_add (const gchar * name, DBusGProxy * proxy, IndicateListener * listener) +todo_list_add (const gchar * name, DBusGProxy * proxy, IndicateListener * listener, gboolean startup) { if (name == NULL || name[0] != ':') { return; @@ -398,6 +401,7 @@ todo_list_add (const gchar * name, DBusGProxy * proxy, IndicateListener * listen proxy_todo_t todo; todo.name = g_strdup(name); todo.bus = bus; + todo.startup = startup; g_array_append_val(priv->proxy_todo, todo); @@ -455,6 +459,12 @@ todo_idle (gpointer data) g_hash_table_insert(priv->proxies_possible, proxyt->name, 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, (IndicateListenerServer *)proxyt->name, get_type_cb, proxyt); return TRUE; @@ -783,6 +793,13 @@ indicate_listener_get_property_icon (IndicateListener * listener, IndicateListen 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) +{ + + +} + static void listener_display_cb (DBusGProxy *proxy, GError *error, gpointer userdata) { diff --git a/libindicate/listener.h b/libindicate/listener.h index ed40630..f931b04 100644 --- a/libindicate/listener.h +++ b/libindicate/listener.h @@ -109,6 +109,7 @@ void indicate_listener_get_property_icon (IndicateListener * l void indicate_listener_display (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator); +gboolean indicate_listener_get_indicator_servers (IndicateListener * listener, GList * servers); void indicate_listener_server_get_type (IndicateListener * listener, IndicateListenerServer * server, indicate_listener_get_server_property_cb callback, |