From 5c2ee1f5f3604fa095f2e8c401fd71d02650067a Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 4 Sep 2009 16:12:17 -0500 Subject: Making the sender support the name attribute and clean up the code a bit. --- src/im-menu-item.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/im-menu-item.c b/src/im-menu-item.c index 75da527..5d397a5 100644 --- a/src/im-menu-item.c +++ b/src/im-menu-item.c @@ -258,13 +258,18 @@ sender_cb (IndicateListener * listener, IndicateListenerServer * server, Indicat { g_debug("Got Sender Information"); ImMenuItem * self = IM_MENU_ITEM(data); - if (self == NULL) { - g_error("Menu Item callback called without a menu item"); - return; - } - if (property == NULL || g_strcmp0(property, "sender")) { - g_warning("Sender callback called without being sent the sender. We got '%s' with value '%s'.", property, propertydata); + /* Our data should be right */ + g_return_if_fail(self != NULL); + /* We should have a property name */ + g_return_if_fail(property != NULL); + /* The Property should be sender or name */ + g_return_if_fail(!g_strcmp0(property, "sender") || !g_strcmp0(property, INDICATE_INDICATOR_MESSAGES_PROP_NAME)); + + /* We might get the sender variable returning a + null string as it doesn't exist on newer clients + but we don't want to listen to that. */ + if (!g_strcmp0(property, "sender") && property[0] == '\0') { return; } -- cgit v1.2.3