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 728491 - [patch] Add get_type() functions for Gom*Error enums
[patch] Add get_type() functions for Gom*Error enums
Status: RESOLVED FIXED
Product: gom
Classification: Other
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: Gom Maintainers
Gom Maintainers
Depends on:
Blocks:
 
 
Reported: 2014-04-18 10:10 UTC by Tristan Brindle
Modified: 2014-04-18 17:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gom: Add get_type() functions for Gom*Error enums (9.94 KB, patch)
2014-04-18 10:10 UTC, Tristan Brindle
needs-work Details | Review
gom: Add get_type() functions for Gom*Error enums (9.94 KB, patch)
2014-04-18 10:35 UTC, Tristan Brindle
none Details | Review
gom: Add get_type() functions for Gom*Error enums (9.94 KB, patch)
2014-04-18 14:11 UTC, Tristan Brindle
none Details | Review
Add GomError enum as a single unified error domain (5.39 KB, patch)
2014-04-18 17:21 UTC, Tristan Brindle
committed Details | Review
Use GomError rather than seperate errordomains (5.31 KB, patch)
2014-04-18 17:21 UTC, Tristan Brindle
committed Details | Review
Remove separate error enums and quarks functions (8.33 KB, patch)
2014-04-18 17:22 UTC, Tristan Brindle
committed Details | Review

Description Tristan Brindle 2014-04-18 10:10:25 UTC
These are required for the introspection parser to pick up the enum members
and to correctly annotate them as error domains.

Of course, using glib-mkenums might be a better approach than doing this
manually and keeping them in sync.
Comment 1 Tristan Brindle 2014-04-18 10:10:40 UTC
Created attachment 274660 [details] [review]
gom: Add get_type() functions for Gom*Error enums

These are required for the introspection parser to pick up the
enum members, and to annotate them correctly as error domains.
Comment 2 Bastien Nocera 2014-04-18 10:22:19 UTC
Review of attachment 274660 [details] [review]:

I'd rather all the error were moved to a single prefix first, so that we had only one error domain, and one place to define them all (call it gom/gom-error.h)
Then we can do some mkenums Makefile hackery.

::: gom/gom-repository.c
@@ +918,3 @@
+   static gsize initialized = FALSE;
+   static const GEnumValue values[] = {
+      { GOM_REPOSITORY_ERROR_EMPTY_RESULT, "GOM_RESPOSITORY_ERROR_EMPTY_RESULT", "EMPTY_RESULT" },

Typo.
Comment 3 Tristan Brindle 2014-04-18 10:35:38 UTC
Created attachment 274661 [details] [review]
gom: Add get_type() functions for Gom*Error enums

These are required for the introspection parser to pick up the
enum members, and to annotate them correctly as error domains.
Comment 4 Tristan Brindle 2014-04-18 10:43:38 UTC
(Same patch again but with typo fixed, I'll have a look at moving all the error domains to one place.)
Comment 5 Tristan Brindle 2014-04-18 14:11:17 UTC
Created attachment 274673 [details] [review]
gom: Add get_type() functions for Gom*Error enums

These are required for the introspection parser to pick up the
enum members, and to annotate them correctly as error domains.
Comment 6 Bastien Nocera 2014-04-18 14:31:31 UTC
This is the same patch again?
Comment 7 Tristan Brindle 2014-04-18 15:54:21 UTC
I screwed up and attached the same patch (with the typo) the second time. The one in comment 5 should be correct, I think! (Still getting to grips with git-bz...)
Comment 8 Bastien Nocera 2014-04-18 15:58:28 UTC
(In reply to comment #7)
> I screwed up and attached the same patch (with the typo) the second time. The
> one in comment 5 should be correct, I think! (Still getting to grips with
> git-bz...)

Right, I was asking you to merge all the different type of errors under one single enum, so that we have GOM_ERROR, with GOM_ERROR_ADAPTER_OPEN, GOM_ERROR_COMMAND_NO_SQL, etc. and move it to gom-error.c and gom-error.h.

I can do that later if you don't feel like updating your patch, but it'll have to wait a little bit...
Comment 9 Tristan Brindle 2014-04-18 17:12:57 UTC
Okay, done, patches coming up...
Comment 10 Tristan Brindle 2014-04-18 17:21:25 UTC
Created attachment 274694 [details] [review]
Add GomError enum as a single unified error domain

Adds GomError as a single error domain replacing GomCommandError,
GomResourceError etc. The enumerators are taken from the existing
four error domains used in Gom.

This also adds a gom_error_get_type() function to define a GType
for GomError, which is necessary for introspection purposes. It
might be better to use glib-mkenums for this purpose.
Comment 11 Tristan Brindle 2014-04-18 17:21:55 UTC
Created attachment 274695 [details] [review]
Use GomError rather than seperate errordomains

Convert all functions to use the GomError domain for errors
Comment 12 Tristan Brindle 2014-04-18 17:22:27 UTC
Created attachment 274696 [details] [review]
Remove separate error enums and quarks functions

Replaced by GomError domain
Comment 13 Bastien Nocera 2014-04-18 17:47:06 UTC
All pushed, thanks for the patches!