Bug 29358 - Introspect TpError
Summary: Introspect TpError
Status: RESOLVED FIXED
Alias: None
Product: Telepathy
Classification: Unclassified
Component: tp-glib (show other bugs)
Version: git master
Hardware: Other All
: medium normal
Assignee: Philip Withnall
QA Contact: Telepathy bugs list
URL:
Whiteboard: review+
Keywords: patch
Depends on:
Blocks:
 
Reported: 2010-08-02 06:00 UTC by Philip Withnall
Modified: 2010-08-10 10:14 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Introspect TpError (23 bytes, application/octet-stream)
2010-08-02 06:00 UTC, Philip Withnall
Details
Introspect TpError (3.14 KB, patch)
2010-08-02 06:01 UTC, Philip Withnall
Details | Splinter Review
Introspect TpError (updated) (4.33 KB, patch)
2010-08-05 03:39 UTC, Philip Withnall
Details | Splinter Review
Introspect TpError (updated again) (4.31 KB, patch)
2010-08-05 06:52 UTC, Philip Withnall
Details | Splinter Review

Description Philip Withnall 2010-08-02 06:00:22 UTC
Created attachment 37520 [details]
Introspect TpError

Patch attached to expose TpError in the GIR file and Vala bindings. This is needed for some work to reduce warning splurge in libfolks.
Comment 1 Philip Withnall 2010-08-02 06:01:43 UTC
Created attachment 37521 [details] [review]
Introspect TpError

Might help if I didn't just attach random files from my source directory.
Comment 2 Simon McVittie 2010-08-02 06:15:07 UTC
> + * tp_error_get_dbus_name: (skip)

This should probably be visible to g-i: it's quite useful. Annotate its return as (transfer none) and it should work fine.

> + * Since: 0.11.12

When adding API, please always say "Since: 0.11.UNRELEASED" (with capitalization), to avoid having false documentation if a release happens before a branch is merged. Replacing "UNRELEASED" is part of the release process.

I'd prefer it if tp_error_quark() was literally just "return tp_errors_quark()", to avoid the possibility that they don't match.

As implemented, I suspect that calling tp_error_quark();tp_errors_quark() will also cause warnings/criticals in dbus-glib, as we try to register the same error domain twice (the two functions currently use different variables for their "once" guard). Implementing one in terms of the other would also fix this.

Not putting tp_error_quark in telepathy-glib-sections.txt will break the build. You don't need to actually document it - just put it under <SUBSECTION Standard> next to tp_errors_quark.
Comment 3 Philip Withnall 2010-08-02 08:04:32 UTC
I opened a bug against GLib to expand the GError documentation to hopefully prevent misnamings like this in the future: https://bugzilla.gnome.org/show_bug.cgi?id=625827

Apparently the introspection scanner is broken if adding a "Rename to:" annotation doesn't work for renaming tp_errors_quark() to tp_error_quark() (which it didn't). I don't know if you want to hold on this patch until the scanner is fixed, to save introducing new API unnecessarily. I've filed https://bugzilla.gnome.org/show_bug.cgi?id=625839 about the scanner problem.

For this work to be most useful for libfolks, the generated VAPI file needs to interpret the error enum correctly as an error domain. That requires this bug to be fixed: https://bugzilla.gnome.org/show_bug.cgi?id=625837. That shouldn't block this bug though.

Should I cook up an updated patch, or do you want to wait on the introspection scanner being fixed?
Comment 4 Simon McVittie 2010-08-03 09:02:42 UTC
(In reply to comment #3)
> Apparently the introspection scanner is broken if adding a "Rename to:"
> annotation doesn't work for renaming tp_errors_quark() to tp_error_quark()
> (which it didn't). I don't know if you want to hold on this patch until the
> scanner is fixed, to save introducing new API unnecessarily.

Every time we add a D-Bus method we gain 2 extern symbols, so I think adding tp_error_quark() would be the least of our worries :-)

> For this work to be most useful for libfolks, the generated VAPI file needs to
> interpret the error enum correctly as an error domain. That requires this bug
> to be fixed: https://bugzilla.gnome.org/show_bug.cgi?id=625837. That shouldn't
> block this bug though.

You say "most useful". Does it still improve libfolks (a bit) if we add tp_error_quark(), even before 625837 is fixed?

If it does, tp_error_quark is probably worthwhile to merge; if it doesn't, wait and see whether 625839 gets fixed before 625837.
Comment 5 Philip Withnall 2010-08-05 03:39:13 UTC
Created attachment 37584 [details] [review]
Introspect TpError (updated)

Updated patch.
Comment 6 Philip Withnall 2010-08-05 03:40:10 UTC
bgo#625827 has been fixed.
Comment 7 Philip Withnall 2010-08-05 03:51:23 UTC
Turns out that g-ir-scanner hides the error quark function (tp_error_quark()) from the GIR file once it works out that it's an error quark function. This means that bgo#625837 needs to be fixed for this to be useful to libfolks.
Comment 8 Simon McVittie 2010-08-05 05:48:46 UTC
Review of attachment 37584 [details] [review]:

> Closes: bfo#29358

We conventionally call this bugzilla "fd.o", and usually use this form:

    fd.o #29358: introspect TpError

    We need to [etc.]

::: telepathy-glib/errors.c
@@ +50,3 @@
+ * 0.10.x, use %TP_ERRORS.
+ *
+ * Since: 0.11.UNRELEASED

TP_ERROR existed in a release already, I think, it just wasn't documented there?
Comment 9 Philip Withnall 2010-08-05 06:52:58 UTC
Created attachment 37586 [details] [review]
Introspect TpError (updated again)

TP_ERROR has been there since 0.11.7, apparently.
Comment 10 Simon McVittie 2010-08-05 07:10:23 UTC
Ship it.
Comment 11 Simon McVittie 2010-08-10 10:14:04 UTC
Sorry, missed merging this for 0.11.12 (I keep forgetting that you don't have commit access). Fixed in git for 0.11.13.


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.