GNOME Bugzilla – Bug 746092
Use GParamFlag user flags for constraints
Last modified: 2019-03-20 10:38:17 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().
Also, would be nice if there was a flag that made gom ignore some property.
(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.
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
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.
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
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
Created attachment 347413 [details] [review] [WIP] tests: Add sub-subclass test See https://bugzilla.gnome.org/show_bug.cgi?id=779716
(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.
-- 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.