On Mon, Mar 19, 2012 at 5:59 AM, Michael Meeks <michael.meeks@suse.com> wrote:
Sounds very sensible. Just one minor complaint: - I loathe the implementation of gtk_check_version - its impl. is as clear as mud, it returns an non-translated string not a boolean etc. etc. ;-) Any chance of a tweak to use: GParamSpec* gtk_widget_class_find_style_property (GtkWidgetClass *klass, const gchar *property_name)
Well, I know next to nothing about GTK so can't speak to implementation. Using a version check was just the first thing I thought of, and I saw other instances n the same module. Even if the implementation stinks using it was easy enough :-) But sure, here's two alternative patches (both avoiding gtk_check_version): (a) Direct use of gtk_widget_class_find_style_property in lieu of the version check. (b) Installation of the property if missing during initialization , so the original code can remain unchanged. (a) is a more conservative change, but (b) feels a little nicer in terms of less overhead and redundant queries in actual operation. But I suppose adding a property could have more side-effects than I've imagined. Both patches work for me, tested under GTK 2.12.9 and 2.24.4. it actually feels like more of this code should be able to be hoisted to a less frequent spot (initialization or something), since I can't imagine how often the properties change value during run-time? But I doubt it's a performance bottleneck. One other curiosity - GTK 2.24.4 actually uses a value of 0.80 for arrow-scaling, but I can absolutely say that the arrows are nowhere near 0.80 of the menu font, and using 0.80 under GTK 2.12 looks ridiculously large. I've actually dropped my default of 0.5 to 0.4 as it more accurately matches 2.24 (plus the prior LO 3.4 on my 2.12 system). I think I actually liked 0.5 a little better myself, but figure trying to match existing behavior should win. I'm guessing being 1/2 of the 0.8 property value isn't a coincidence, so there must be some other scaling going on under the covers somewhere under 2.24 since obviously this code uses the scaling factor the same way in both cases. -- David
Attachment:
gtk-submenu-a.patch
Description: Binary data
Attachment:
gtk-submenu-b.patch
Description: Binary data