diff options
author | Ted Gould <ted@canonical.com> | 2009-02-15 22:04:29 -0600 |
---|---|---|
committer | Ted Gould <ted@canonical.com> | 2009-02-15 22:04:29 -0600 |
commit | 55b934300c52e7ff3f59b7a7004f4eb6df647f95 (patch) | |
tree | 7370892c654fb01d181373497c20933efe96e000 | |
parent | 50a37ef395eb670c44582b9fcdeac650ef8d11fe (diff) | |
parent | 975000d7ab53c8f58468f0f648f991892e092833 (diff) | |
download | libayatana-indicator-55b934300c52e7ff3f59b7a7004f4eb6df647f95.tar.gz libayatana-indicator-55b934300c52e7ff3f59b7a7004f4eb6df647f95.tar.bz2 libayatana-indicator-55b934300c52e7ff3f59b7a7004f4eb6df647f95.zip |
Merging in from the 'upstream' branch. Changes include the addition
of a server signal for the NULL indicator. And a warning fix for
icons.
-rw-r--r-- | docs/reference/libindicate-decl.txt | 34 | ||||
-rw-r--r-- | libindicate/listener.c | 5 | ||||
-rw-r--r-- | libindicate/server.c | 31 | ||||
-rw-r--r-- | libindicate/server.h | 12 | ||||
-rw-r--r-- | tests/im-client.c | 9 |
5 files changed, 85 insertions, 6 deletions
diff --git a/docs/reference/libindicate-decl.txt b/docs/reference/libindicate-decl.txt index e3280bd..e7890c0 100644 --- a/docs/reference/libindicate-decl.txt +++ b/docs/reference/libindicate-decl.txt @@ -315,6 +315,34 @@ IndicateListener * listener,IndicateListenerServer * server,indicate_listener_ge <NAME>INDICATE_SERVER_GET_CLASS</NAME> #define INDICATE_SERVER_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS((object), INDICATE_TYPE_SERVER, IndicateServerClass)) </MACRO> +<MACRO> +<NAME>INDICATE_SERVER_INDICATOR_NULL</NAME> +#define INDICATE_SERVER_INDICATOR_NULL (0) +</MACRO> +<MACRO> +<NAME>INDICATE_SERVER_SIGNAL_INDICATOR_ADDED</NAME> +#define INDICATE_SERVER_SIGNAL_INDICATOR_ADDED "indicator-added" +</MACRO> +<MACRO> +<NAME>INDICATE_SERVER_SIGNAL_INDICATOR_REMOVED</NAME> +#define INDICATE_SERVER_SIGNAL_INDICATOR_REMOVED "indicator-removed" +</MACRO> +<MACRO> +<NAME>INDICATE_SERVER_SIGNAL_INDICATOR_MODIFIED</NAME> +#define INDICATE_SERVER_SIGNAL_INDICATOR_MODIFIED "indicator-modified" +</MACRO> +<MACRO> +<NAME>INDICATE_SERVER_SIGNAL_SERVER_SHOW</NAME> +#define INDICATE_SERVER_SIGNAL_SERVER_SHOW "server-show" +</MACRO> +<MACRO> +<NAME>INDICATE_SERVER_SIGNAL_SERVER_HIDE</NAME> +#define INDICATE_SERVER_SIGNAL_SERVER_HIDE "server-hide" +</MACRO> +<MACRO> +<NAME>INDICATE_SERVER_SIGNAL_SERVER_DISPLAY</NAME> +#define INDICATE_SERVER_SIGNAL_SERVER_DISPLAY "server-display" +</MACRO> <STRUCT> <NAME>IndicateServer</NAME> </STRUCT> @@ -339,6 +367,7 @@ struct _IndicateServerClass { void (* indicator_modified) (IndicateServer * server, guint id, gchar * property); void (* server_show) (IndicateServer * server, gchar * type); void (* server_hide) (IndicateServer * server, gchar * type); + void (* server_display) (IndicateServer * server); /* Virtual Functions */ gboolean (*get_indicator_count) (IndicateServer * server, guint * count, GError **error); @@ -468,6 +497,11 @@ IndicateServer *server, guint id, const gchar *type <RETURNS>void </RETURNS> IndicateServer *server, guint id, const gchar *property </FUNCTION> +<FUNCTION> +<NAME>indicate_server_emit_server_display</NAME> +<RETURNS>void </RETURNS> +IndicateServer *server +</FUNCTION> <MACRO> <NAME>INDICATE_TYPE_INDICATOR_MESSAGE</NAME> #define INDICATE_TYPE_INDICATOR_MESSAGE (indicate_indicator_message_get_type ()) diff --git a/libindicate/listener.c b/libindicate/listener.c index 3cc9111..d8926f1 100644 --- a/libindicate/listener.c +++ b/libindicate/listener.c @@ -688,6 +688,11 @@ get_property_cb (DBusGProxy *proxy, char * OUT_value, GError *error, gpointer us 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); diff --git a/libindicate/server.c b/libindicate/server.c index ee20321..8a35906 100644 --- a/libindicate/server.c +++ b/libindicate/server.c @@ -52,6 +52,7 @@ enum { INDICATOR_MODIFIED, SERVER_SHOW, SERVER_HIDE, + SERVER_DISPLAY, LAST_SIGNAL }; @@ -116,41 +117,48 @@ indicate_server_class_init (IndicateServerClass * class) gobj->set_property = set_property; gobj->get_property = get_property; - signals[INDICATOR_ADDED] = g_signal_new("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, G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_STRING); - signals[INDICATOR_REMOVED] = g_signal_new("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, G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_STRING); - signals[INDICATOR_MODIFIED] = g_signal_new("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, G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_STRING); - signals[SERVER_SHOW] = g_signal_new("server-show", + 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_TYPE_NONE, 1, G_TYPE_STRING); - signals[SERVER_HIDE] = g_signal_new("server-hide", + 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_TYPE_NONE, 1, G_TYPE_STRING); + signals[SERVER_DISPLAY] = g_signal_new(INDICATE_SERVER_SIGNAL_SERVER_DISPLAY, + G_TYPE_FROM_CLASS (class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (IndicateServerClass, server_display), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); g_object_class_install_property (gobj, PROP_DESKTOP, g_param_spec_string("desktop", "Desktop File", @@ -661,6 +669,11 @@ get_indicator_properties (IndicateServer * server, guint id, gchar *** propertie static gboolean show_indicator_to_user (IndicateServer * server, guint id, GError ** error) { + if (id == INDICATE_SERVER_INDICATOR_NULL) { + g_signal_emit(server, signals[SERVER_DISPLAY], 0, TRUE); + return TRUE; + } + IndicateIndicator * indicator = get_indicator(server, id, error); if (indicator == NULL) { return FALSE; @@ -879,3 +892,11 @@ indicate_server_emit_indicator_modified (IndicateServer *server, guint id, const g_signal_emit(server, signals[INDICATOR_MODIFIED], 0, id, property); } + +void +indicate_server_emit_server_display (IndicateServer *server) +{ + g_return_if_fail (INDICATE_IS_SERVER (server)); + + g_signal_emit(server, signals[SERVER_DISPLAY], 0, TRUE); +} diff --git a/libindicate/server.h b/libindicate/server.h index 4e3c931..8aa0cf1 100644 --- a/libindicate/server.h +++ b/libindicate/server.h @@ -45,6 +45,16 @@ G_BEGIN_DECLS #define INDICATE_IS_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), INDICATE_TYPE_SERVER)) #define INDICATE_SERVER_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS((object), INDICATE_TYPE_SERVER, IndicateServerClass)) +#define INDICATE_SERVER_INDICATOR_NULL (0) + +#define INDICATE_SERVER_SIGNAL_INDICATOR_ADDED "indicator-added" +#define INDICATE_SERVER_SIGNAL_INDICATOR_REMOVED "indicator-removed" +#define INDICATE_SERVER_SIGNAL_INDICATOR_MODIFIED "indicator-modified" +#define INDICATE_SERVER_SIGNAL_SERVER_SHOW "server-show" +#define INDICATE_SERVER_SIGNAL_SERVER_HIDE "server-hide" +#define INDICATE_SERVER_SIGNAL_SERVER_DISPLAY "server-display" + + typedef struct _IndicateServer IndicateServer; struct _IndicateServer { GObject parent; @@ -60,6 +70,7 @@ struct _IndicateServerClass { void (* indicator_modified) (IndicateServer * server, guint id, gchar * property); void (* server_show) (IndicateServer * server, gchar * type); void (* server_hide) (IndicateServer * server, gchar * type); + void (* server_display) (IndicateServer * server); /* Virtual Functions */ gboolean (*get_indicator_count) (IndicateServer * server, guint * count, GError **error); @@ -115,6 +126,7 @@ gboolean indicate_server_show_indicator_to_user (IndicateServer * server, guint void indicate_server_emit_indicator_added (IndicateServer *server, guint id, const gchar *type); void indicate_server_emit_indicator_removed (IndicateServer *server, guint id, const gchar *type); void indicate_server_emit_indicator_modified (IndicateServer *server, guint id, const gchar *property); +void indicate_server_emit_server_display (IndicateServer *server); G_END_DECLS diff --git a/tests/im-client.c b/tests/im-client.c index 3419a9d..1b5a86b 100644 --- a/tests/im-client.c +++ b/tests/im-client.c @@ -56,7 +56,13 @@ timeout_cb (gpointer data) static void display (IndicateIndicator * indicator, gpointer data) { - g_debug("Ah, I've been displayed"); + g_debug("Ah, my indicator has been displayed"); +} + +static void +server_display (IndicateServer * server, gpointer data) +{ + g_debug("Ah, my server has been displayed"); } int @@ -67,6 +73,7 @@ main (int argc, char ** argv) IndicateServer * server = indicate_server_ref_default(); indicate_server_set_type(server, "message.im"); indicate_server_set_desktop_file(server, "/usr/share/applications/empathy.desktop"); + g_signal_connect(G_OBJECT(server), INDICATE_SERVER_SIGNAL_SERVER_DISPLAY, G_CALLBACK(server_display), NULL); IndicateIndicatorMessage * indicator; |