After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 410398 - Empty status string should be changed to default status string
Empty status string should be changed to default status string
Status: RESOLVED FIXED
Product: gossip
Classification: Deprecated
Component: General
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Gossip Maintainers
Gossip Maintainers
Depends on:
Blocks:
 
 
Reported: 2007-02-21 14:45 UTC by Vincent Untz
Modified: 2007-03-04 11:17 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fix in the dbus part (452 bytes, patch)
2007-02-27 13:41 UTC, Vincent Untz
committed Details | Review

Description Vincent Untz 2007-02-21 14:45:40 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.
Comment 1 Richard Hult 2007-02-22 08:43:34 UTC
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.
Comment 2 Vincent Untz 2007-02-27 13:41:36 UTC
Created attachment 83459 [details] [review]
Fix in the dbus part
Comment 3 Richard Hult 2007-02-27 18:24:33 UTC
Looks good to me, please commit.
Comment 4 Martyn Russell 2007-02-28 08:58:35 UTC
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.
Comment 5 Vincent Untz 2007-03-04 11:17:51 UTC
Committed (with the G_STR_EMPTY() macro).