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 355797 - Rework GossipAccount to support variable parameters per protocol
Rework GossipAccount to support variable parameters per protocol
Status: RESOLVED FIXED
Product: gossip
Classification: Deprecated
Component: General
0.15
Other Linux
: Normal normal
: ---
Assigned To: Gossip Maintainers
Gossip Maintainers
: 355642 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2006-09-13 15:11 UTC by Xavier Claessens
Modified: 2006-09-23 12:49 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
proposed patch (45.81 KB, patch)
2006-09-13 16:39 UTC, Xavier Claessens
none Details | Review
new proposal (45.28 KB, patch)
2006-09-13 20:24 UTC, Xavier Claessens
none Details | Review
a little polish (45.02 KB, patch)
2006-09-14 07:30 UTC, Xavier Claessens
none Details | Review
better like that (41.99 KB, patch)
2006-09-14 15:28 UTC, Xavier Claessens
none Details | Review
don't use telepathy's parameters names (41.97 KB, patch)
2006-09-14 18:58 UTC, Xavier Claessens
committed Details | Review

Description Xavier Claessens 2006-09-13 15:11:41 UTC
As seen in the telepathy development GossipAccount should use a g_datalist to store parameters. Like that we can have different parameters for each protocol.

This rework is needed for the telepathy branch but isn't telepathy specific. It's a big change in GossipAccount and GossipAccountManager that will be difficult to maintain in a different branch so I suggest to commit the telepathy-independent part in HEAD.
Comment 1 Xavier Claessens 2006-09-13 15:12:42 UTC
*** Bug 355642 has been marked as a duplicate of this bug. ***
Comment 2 Xavier Claessens 2006-09-13 16:39:38 UTC
Created attachment 72708 [details] [review]
proposed patch

This patch comes from a big patch proposed for telepathy branch and can be applied to HEAD. I already fixed most comments from Richard.

Comments are welcome !
Comment 3 Martyn Russell 2006-09-13 18:27:13 UTC
Most comments? What is left to do that Richard said then?
Comment 4 Xavier Claessens 2006-09-13 18:52:38 UTC
datalist vs hashtable is still in debate... Otherwise it's ok I think.
Comment 5 Xavier Claessens 2006-09-13 20:24:35 UTC
Created attachment 72721 [details] [review]
new proposal

Remove gossip_account_param_get_all and replace it with a nicer gossip_account_param_foreach
Comment 6 Xavier Claessens 2006-09-14 07:30:35 UTC
Created attachment 72754 [details] [review]
a little polish

 - Useless to pass the flags to gossip_account_param_foreach(), just run the callback for every param, the user can easily check the flag himself.

 - Prevent from emitting CHANGED signal and g_object_notify 2 times if we use gossip_account_set_*().
Comment 7 Xavier Claessens 2006-09-14 15:28:28 UTC
Created attachment 72787 [details] [review]
better like that

I think it's better with a GHashTable in the end. Both provide exactly the same features and I think it's easier to not worry about GQuark and g_datalist API which is far less used and known and thus more complicate to maintain. I also moved g_object_notify() and emit the CHANGED signal in gossip_account_param_set_full() instead of in each gossip_account_set_*() functions. Like that most gossip_account_set_* are only kept for API compatibility and can be replaced by gossip_account_param_set_[string, g_value, full](account, "param_name", value);
Comment 8 Richard Hult 2006-09-14 16:41:55 UTC
I might be missing something but isn't it a bit weird that the param names don't match the properties? (account/id, use-ssl/old-ssl)?

I agree that the hashtable approach is better.
Comment 9 Xavier Claessens 2006-09-14 16:50:22 UTC
Because that's the name used by telepathy...
Comment 10 Richard Hult 2006-09-14 16:58:43 UTC
Right, but since we are adding this thing in libgossip and not as some kind of telepathy specific layer somewhere, we shouldn't do that kind of translation, in my opinion. Is there some other way to do it?
Comment 11 Xavier Claessens 2006-09-14 17:36:56 UTC
Maybe the easiest way is having those names hidden in some

#define GOSSIP_ACCOUNT_PARAM_ID "id"

which can be easily changed in the telepathy's branch by

#ifdef USE_TELEPATHY
#define GOSSIP_ACCOUNT_PARAM_ID "account"
#else
#define GOSSIP_ACCOUNT_PARAM_ID "id"
#endif

What do you think about that ?
Comment 12 Richard Hult 2006-09-14 17:43:11 UTC
Shouldn't the telepathy specific code handle mapping between its property names and the gossip ones? Nothing in the libgossip API exposed should have any telehpathy specific stuff, imo.
Comment 13 Xavier Claessens 2006-09-14 18:07:37 UTC
ok so what about using normal names and add in gossip_account_param_set_full() only in the telepathy branch:

#ifdef USE_TELEPATHY
param_name = gossip_telepathy_account_param_name_convert (param_name);
#endif

this function can looks like:
if (strcmp (name, "id") == ) {return "account";}

Ok for that ?
Comment 14 Xavier Claessens 2006-09-14 18:58:03 UTC
Created attachment 72810 [details] [review]
don't use telepathy's parameters names
Comment 15 Richard Hult 2006-09-15 07:29:39 UTC
It doesn't really change anything, but at least it's better in the meantime. Are we really going to have hardcoded telepathy code in libgossip? What I mean is that any telepathy specific stuff needs to be put in the telepathy protocol code, that is in protocols/telepathy/, not in libgossip.

However, if the telepathy names are good, we can also change libgossip to use them instead, but then we should change it completely, not just half-way (i.e. still no special telepathy code in libgossip that translates between property names). And update the ui code of course.

 
Comment 16 Xavier Claessens 2006-09-15 08:36:19 UTC
gossip_telepathy_account_param_name_convert() goes to telepathy-utils.c so not in libgossip. I think we have not the choice to have some #ifdef USE_TELEPATHY in libgossip, there is one in gossip-protocol.c and some in gossip-account(-manager).c for special parameters. I can post the diff between libgossip HEAD and TELEPATHY if you want to see how it looks like.
Comment 17 Xavier Claessens 2006-09-15 08:37:29 UTC
Forget to say:
gossip_account_set_*() are kept for API compatibility, if we want to rename them why not simple remove them and use gossip_account_param_set_*() ?
Comment 18 Richard Hult 2006-09-15 19:19:38 UTC
Yes, that's better (at least in my opinion).
Comment 19 Xavier Claessens 2006-09-20 08:43:30 UTC
Ok so what's missing now before committing this patch ? I think it's ready.
Comment 20 Martyn Russell 2006-09-21 07:54:27 UTC
Just my appendix, that's all :)
I will commit it when I next get the chance (maybe this weekend).
Comment 21 Martyn Russell 2006-09-23 12:49:23 UTC
Committed thanks ;)