GNOME Bugzilla – Bug 689263
Make MetaButtonLayout usable from introspection
Last modified: 2013-01-09 23:23:11 UTC
The annotations are not pretty, but given that we have a single consumer outside of mutter, I'd rather not waste time on refactoring this.
Created attachment 230168 [details] [review] prefs: Do not leave junk values in unused button_layout fields MetaButtonLayout is extremely unfriendly for introspection: its fields are arrays of a fixed length, but the actual length is determined by a custom stop value (e.g. not NULL / 0). Without API changes this will never work nicely in introspection, but we can at least make it work; start by filling up unused fields with the stop value rather than leaving it at random values.
Created attachment 230169 [details] [review] common: Annotate MetaButtonLayout
Created attachment 230170 [details] [review] prefs: Annotate meta_prefs_get_button_layout()
Created attachment 230171 [details] [review] workspace: Use MetaButtonLayout to get side of close button The current code parses the button-layout setting because MetaButtonLayout was not usable from introspection. With that fixed, we can switch to using meta_prefs_get_button_layout().
Created attachment 230275 [details] [review] workspace: Use MetaButtonLayout to get side of close button Remove special-casing for RTL - the layout has already been adjusted according to the text direction.
Review of attachment 230168 [details] [review]: Well, it's not like it doesn't work without this - you just would have to look for the stop value in a loop in Javascript rather than using indexOf. But sure.
Review of attachment 230169 [details] [review]: Sure
Review of attachment 230170 [details] [review]: Sure
Review of attachment 230275 [details] [review]: Looks fine to me
(In reply to comment #6) > Well, it's not like it doesn't work without this - you just would have to look > for the stop value in a loop in Javascript rather than using indexOf. If I remember correctly, gjs fails to wrap the return value when any element is outside the range of the array type, so the problem was actually meta_prefs_get_button_layout() itself.
Attachment 230168 [details] pushed as 5a8473e - prefs: Do not leave junk values in unused button_layout fields Attachment 230169 [details] pushed as 54a3847 - common: Annotate MetaButtonLayout Attachment 230170 [details] pushed as a6c51ad - prefs: Annotate meta_prefs_get_button_layout()
Attachment 230275 [details] pushed as 3f29680 - workspace: Use MetaButtonLayout to get side of close button