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 746092 - Use GParamFlag user flags for constraints
Use GParamFlag user flags for constraints
Status: RESOLVED OBSOLETE
Product: gom
Classification: Other
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Gom Maintainers
Gom Maintainers
Depends on:
Blocks: 753379
 
 
Reported: 2015-03-12 12:58 UTC by Alexander Larsson
Modified: 2019-03-20 10:38 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
[WIP] gom: Use GParamFlags for constraints and primary key (32.79 KB, patch)
2015-03-13 18:47 UTC, Bastien Nocera
none Details | Review
[WIP] gom: Use GParamFlags for constraints and primary key (32.73 KB, patch)
2015-03-16 10:46 UTC, Bastien Nocera
none Details | Review
gom: Use GParamFlags for constraints and primary key (36.47 KB, patch)
2017-03-07 18:50 UTC, Bastien Nocera
none Details | Review
[WIP] tests: Add sub-subclass test (14.25 KB, patch)
2017-03-07 18:50 UTC, Bastien Nocera
none Details | Review

Description Alexander Larsson 2015-03-12 12:58:15 UTC
GParamFlag has space reserved for user flags:

#define	G_PARAM_USER_SHIFT	(8)

(Up to 1<<30 which is used by G_PARAM_EXPLICIT_NOTIFY)

It would be cool if i could define a resource with GOM_RESOURCE_PARAM_PRIMARY_KEY instead of having to call
gom_resource_class_set_primary_key().
Comment 1 Alexander Larsson 2015-03-13 14:13:57 UTC
Also, would be nice if there was a flag that made gom ignore some property.
Comment 2 Bastien Nocera 2015-03-13 16:05:47 UTC
(In reply to Alexander Larsson from comment #1)
> Also, would be nice if there was a flag that made gom ignore some property.

gom_resource_class_set_property_set_mapped(.., FALSE); does that right now.
Comment 3 Bastien Nocera 2015-03-13 18:47:05 UTC
Created attachment 299349 [details] [review]
[WIP] gom: Use GParamFlags for constraints and primary key

- Not sure subclass of the GomResource subclass works (did it before?)
- Need to prefer resource->priv->primary_key in some cases,
  or short-cut through the pspec
Comment 4 Alexander Larsson 2015-03-16 09:02:54 UTC
Review of attachment 299349 [details] [review]:

::: gom/gom-resource.c
@@ +1039,3 @@
+   pkey_signal = g_strdup_printf("notify::%s", resource->priv->primary_key);
+   g_signal_connect (G_OBJECT (resource), pkey_signal,
+                     G_CALLBACK (pkey_changed_cb), NULL);

I don't think you really want to use g_signal_connect() here for every resource instance. That is gonna create a lot of work for the gsignal machinery. A better approach is to override the notify vfunc on ObjectClass and check if pspec == resource_class.primary_key_pspec.
Comment 5 Bastien Nocera 2015-03-16 10:46:14 UTC
Created attachment 299498 [details] [review]
[WIP] gom: Use GParamFlags for constraints and primary key

- Not sure subclass of the GomResource subclass works (did it before?)
- Need to prefer resource->priv->primary_key in some cases,
  or short-cut through the pspec
Comment 6 Bastien Nocera 2017-03-07 18:50:52 UTC
Created attachment 347412 [details] [review]
gom: Use GParamFlags for constraints and primary key

- Need to prefer resource->priv->primary_key in some cases,
  or short-cut through the pspec
Comment 7 Bastien Nocera 2017-03-07 18:50:58 UTC
Created attachment 347413 [details] [review]
[WIP] tests: Add sub-subclass test

See https://bugzilla.gnome.org/show_bug.cgi?id=779716
Comment 8 Bastien Nocera 2017-03-07 18:56:06 UTC
(In reply to Bastien Nocera from comment #5)
> Created attachment 299498 [details] [review] [review]
> [WIP] gom: Use GParamFlags for constraints and primary key
> 
> - Not sure subclass of the GomResource subclass works (did it before?)

The patch in comment 7 is supposed to be about that, but actually uncovered bug 779716. Having separate subclasses of the original GomResource subclass isn't going to work unless those subclasses each specify their own separate tables. gom isn't going to know to concatenate the properties of all the sub-subclasses. This will trigger runtime warnings.
Comment 9 GNOME Infrastructure Team 2019-03-20 10:38:17 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gom/issues/5.