GNOME Bugzilla – Bug 410398
Empty status string should be changed to default status string
Last modified: 2007-03-04 11:17:51 UTC
A few weeks ago, I wrote a small rhythmbox plugin in python to update my current Gossip status to show the song being played (with dbus). It's all nice, except that when I quit rhythmbox, I want to reset the status string to "Available" (when Available, and more generally the default string for all status). Since I can't send a NULL pointer through dbus, I have to send "" as a status string. But this doesn't work since most of gossip code use this: if (!status) { status = gossip_presence_state_get_default_status (state); } instead of if (!status || !status[0]) { status = gossip_presence_state_get_default_status (state); } An easy workaround for this specific is to check if the status string is empty in gossip_dbus_set_presence() and pass NULL to gossip_app_set_presence() if that's the case. But I don't think having an empty status string makes sense anyway, so fixing this everywhere might be better.
We already handle that everywhere when set through the normal GUI (status strings are always set to something or NULL which means we don't set it at all so that the other side can show the default string which then becomes nicely translated to the receiver's language instead of the sender). The right fix here would be to just to the dbus code as you suggest.
Created attachment 83459 [details] [review] Fix in the dbus part
Looks good to me, please commit.
Actually, I would rather we used the G_STR_EMPTY() macro here instead, but other than that it is good to commit. Also, perhaps we should rename that macro at some point to GOSSIP_STR_EMPTY(), Vincent, the macro is in libgossip/gossip-utils.h if you are interested.
Committed (with the G_STR_EMPTY() macro).