Bug 17112 - [0.11] Use GSEAL (or similar) on TpConnectionManager's public struct fields
Summary: [0.11] Use GSEAL (or similar) on TpConnectionManager's public struct fields
Status: RESOLVED FIXED
Alias: None
Product: Telepathy
Classification: Unclassified
Component: tp-glib (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Simon McVittie
QA Contact: Telepathy bugs list
URL: http://cgit.freedesktop.org/~smcv/tel...
Whiteboard:
Keywords:
Depends on: 24116 49384
Blocks: tp-glib-1.0
  Show dependency treegraph
 
Reported: 2008-08-13 03:05 UTC by Murray Cumming
Modified: 2012-06-04 06:19 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Murray Cumming 2008-08-13 03:05:23 UTC
The TpConnectionManager struct seems to have several public fields. That's ugly. There should really be nice get/set functions, and the struct's implementation should be hidden. That would make the API clearer and safer.

http://telepathy.freedesktop.org/doc/telepathy-glib/telepathy-glib-connection-manager.html#TpConnectionManager-struct
Comment 1 Simon McVittie 2008-08-13 04:05:12 UTC
> There should really be nice get/set functions

Getters would be sufficient, all the public fields are (documented to be) read-only.

> and the struct's implementation should be hidden

We can't hide it in terms of API (that would be an API break), but we can hide it from the docs and deprecate access to it.
Comment 2 Xavier Claessens 2008-08-13 04:28:50 UTC
Maybe GSEAL can be used here?
Comment 3 Murray Cumming 2008-08-13 06:39:11 UTC
G_SEAL() is a way to deprecate use of API that you can't break. But as far as I know telepathy-glib is not really API-stable anyway, so we can just hide the struct implementation.
Comment 4 Simon McVittie 2008-08-13 08:03:11 UTC
telepathy-glib is API- and ABI-stable in the sense that we do not break existing functionality.

It's unstable in the sense that new functionality is frequently *added*.
Comment 5 Murray Cumming 2008-10-13 03:03:45 UTC
Is there no plan to do a parallel-install version eventually? Has that been ruled out?
Comment 6 Simon McVittie 2009-07-22 07:09:12 UTC
(In reply to comment #5)
> Is there no plan to do a parallel-install version eventually?

The operative word is "eventually". We do not plan to break ABI soon.

Since this bug was filed, function-based accessors have been added for various struct members (although possibly not all of them). My wip-seal branch contains some unfinished work: adding a TP_SEAL macro, and starting to use it for structs.
Comment 7 Jonny Lamb 2011-01-10 08:08:50 UTC
(Simon removed his branch.)
Comment 8 Xavier Claessens 2012-05-02 15:34:00 UTC
Setting a blocking tp-glib 1.0 meta bug, should we consider removing all fields from public structs like gtk3 did?
Comment 9 Simon McVittie 2012-05-04 08:33:26 UTC
(In reply to comment #8)
> Setting a blocking tp-glib 1.0 meta bug, should we consider removing all fields
> from public structs like gtk3 did?

Yeah, let's.

Of the GObject structs, I think this just means TpProxy and TpConnectionManager.

Among non-GObjects, TpConnectionManagerProtocol can be deprecated entirely, TpConnectionManagerParam should be sealed (and get a shorter typedef!), and I think the rest are deliberately public (but I'll check through them).
Comment 10 Simon McVittie 2012-05-04 09:43:22 UTC
Branch: http://cgit.freedesktop.org/~smcv/telepathy-glib/log/?h=seal
Comment 11 Simon McVittie 2012-05-04 09:45:12 UTC
The branch depends on my branch from Bug #49384, for _TP_COMPILATION.
Comment 12 Xavier Claessens 2012-05-07 01:50:09 UTC
I don't think we want to seal parent and priv fields of GObject struct, since sealed fields are to be removed in 'next'.

TpBaseConnection has also fields to seal.
Comment 13 Xavier Claessens 2012-06-04 04:58:25 UTC
Merged Simon's seal-more branch into master. With few changes:

 - Skipped unrelated "Deprecate tp_list_connection_managers" and "TpConnectionManagerProtocol: deprecate in favour of TpProtocol" for now because tp-glib itself is still using those APIs.

 - Squashed "Don't _TP_SEAL parent or priv" into relevant commits.

 - Added "Since: 0.UNRELEASED" to new functions and added them into the doc.
Comment 14 Xavier Claessens 2012-06-04 06:19:25 UTC
(In reply to comment #13)
>  - Skipped unrelated "Deprecate tp_list_connection_managers" and
> "TpConnectionManagerProtocol: deprecate in favour of TpProtocol" for now
> because tp-glib itself is still using those APIs.

I've made the fix to stop using them internally and pushed them as well now.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.