2013-10-22

[GNOME] GXml: This Halloween, redundant code dies

XPath, Attr, and a tale most foul

 

I'm working on merging Adam Ples' patch for XPath support (branch: xpath), and I notice that a test failed because they were expecting the GXmlDocument to be able to translate from an xmlAttrPtr to a GXmlAttr.  (GXmlDocument remembers a mapping between xmlNodePtrs to GXmlNodes already to avoid duplicating its proxy nodes.)  The patch's expectation is reasonable, but for a variety of reasons, most of all that xmlAttr != xmlNode (except that they sort of do), GXmlAttrs are not considered "backed nodes" (unlike the other GXmlNode types (like GXmlElement) that have an xmlNodePtr behind them) so we don't map between them (and attrs are handled more just like strings (which we need to do, because there isn't really a xmlSetPropNode in libxml2, for instance).  Also, because at one point wanted to use a more familiar GLibHashTable to store an element's mapping of attribute names to attribute values, rather than the NamedNodeMap that the W3C DOM specifies.  However, perhaps it's worth changing how things are done to support the xpath's code's reasonable assumption.



So I looked over the GXmlAttr, GXmlElement, and GXmlDocument code and realised that if I do treat xmlAttrs as xmlNodes where it's safe to do so, I could greatly simplify a lot of code.  And, also, if I do implement the NamedNodeMap for accessing an element's attributes, I could also remove a complicated kludge in GXml which currently requires synchronising elements' attributes between the GLibHashTable they've been stored in and the libxml2 structures they need to be in when doing tasks like saving to disk or stringifying a node or document.



Consequently, there's a new branch in GXml called newattr where this is happening.  Attr.vala loses 85 lines of code, Element.vala loses 127, and Document loses 38.  NamedNodeMap.vala adds 130, with a big chunk of that being a copyright notice and comments, though. :)  Overall, there's a net difference of 119 lines removed (so it's not that massive, but!), including the complexity of syncing Elements at all (needing to remember to call a method to sync each time you might want to was error prone and a delayed performance penalty), and the reduction in parallel code between GXmlAttr and other nodes.  YAY!



I'm considering offering some GLibHashTable-style convenience methods to GXmlNamedNodeMap (like lookup and size) so anyone who has to port will have an easier time (they'd just wrap get_named_item and get_length, for example).  Let me know if you have an opinion on that!



GXml going forward



The next stable release is waiting for this to happen (since it will include API breaks from the summer anyway).  Also, Owen Taylor provided useful advice to me at the conclusion of the Summer of Code that has led to much more useful documentation regarding memory handling of GXml objects, which is already in git master.  The devhelp gtkdocs that valadoc generates have some oddities that I still need to investigate, but I don't think I'll let that be a blocker.  So, if you use the latest documentation and something's unclear, let me know (by filing a bug!)

2013-10-12

[Technology] Numix in GNOME







If you're a Linux user and not a fan of faux 3D beveling and flashy gradients, then I strongly recommend the Numix Project: http://numixproject.org/



In particular, I'm using their Gtk+ theme, their icons, a Firefox theme, and one of their wallpapers.



I kept Firefox open for the screenshot because I notice a striking similarity between Numix's aesthetic and Google's style new to last year, which both have squarical flat shapes and colours everywhere.  I like it.


Gtk+ Theme


Download it from the Deviant Art page linked above, and unpack it into ~/.local/share/themes/ (you can find that directory by opening the file browser, and typing in the path directly or choosing to see hidden files and folders and navigating there).  You should have a directory ~/.local/share/themes/Numix (and for ~/.local/share/themes/Numix - Gtk3.4)  now.  Then open GNOME Tweak Tool (gnome-tweak-tool, you may need to install it), go to the Themes section (you might need User Themes extension installed but I doubt it), and set GTK+ theme and Current Theme to Numix.


Icon Theme


Go to the github page linked above.  In the bottom right, there should be a "download zip" button.  Download it, and unzip it.  This should give you a folder "numix-icon-theme".  Go in there and copy the Numix folder into ~/.local/share/icons/.   Then go to GNOME Tweak Tool again and set the Icon them. Next, be delighted when opening Activities view of GNOME Shell.


Firefox


Sadly, Firefox does have great support for this yet.  If set the Gtk theme to Numix, many of Firefox's widgets won't theme at all and will look like GNOME 2.0.  However, that's not so bad. You can at least spice up the tab bar by downloading the Numixy theme by visiting the above link.  Google Chrome apparently has an official Numix theme provided by the Numix Project.


Things wanted


I don't usually put too much effort into theming my environment because a lot of themes grate on me after a while, and because they're often incomplete.  They're not actively maintained.  Someone creates two hundred icons, but then stops creating new ones for new applications.  That's why the Tango project was special, good guidelines and motivated people.



It would be nice to have GNOME Shell itself be themed (I think the Numix developers are Ubuntu users though) and to have better support for Firefox.  Anyway, I'll enjoy it while I can. :)

Dieses Blog durchsuchen

Labels

#Technology #GNOME gnome gxml fedora bugs linux vala google #General firefox security gsoc GUADEC android bug xml fedora 18 javascript libxml2 programming web blogger encryption fedora 17 gdom git emacs libgdata memory mozilla open source serialisation upgrade web development API Spain containers design evolution fedora 16 fedora 20 fedora 22 fedup file systems friends future glib gnome shell internet luks music performance phone photos php podman preupgrade tablet testing typescript yum #Microblog Network Manager adb apache art automation bash brno catastrophe css data loss debian debugging deja-dup disaster docker emusic errors ext4 facebook fedora 19 gee gir gitlab gitorious gmail gobject google talk google+ html libxml mail microsoft mtp mysql namespaces nautilus nextcloud owncloud picasaweb pitivi ptp python raspberry pi resizing rpm school selinux signal sms speech dispatcher systemd technology texting time management uoguelph usability video web design youtube #Tech Air Canada C Electron Element Empathy Europe GError GNOME 3 GNOME Files Go Google Play Music Grimes IRC Mac OS X Mario Kart Memento Nintendo Nintendo Switch PEAP Selenium Splatoon UI VPN Xiki accessibility advertising ai albums anaconda anonymity apple ask asus eee top automake autonomous automobiles b43 backup battery berlin bit rot broadcom browsers browsing canada canadian english cars chrome clarity comments communication compiler complaints computer computers configuration console constructive criticism cron cropping customisation dataloss dconf debug symbols design patterns desktop summit development discoverability distribution diy dnf documentation drm duplicity e-mail efficiency email english environment estate experimenting ext3 fedora 11 festival file formats firejail flac flatpak forgottotagit freedom friendship fuse galaxy nexus galton gay rights gdb german germany gimp gio gjs gnome software gnome-control-center google assistant google calendar google chrome google hangouts google reader gqe graphviz growth gtest gtg gtk gvfs gvfs metadata hard drive hard drives hardware help hp humour ide identity instagram installation instant messaging integration intel interactivity introspection jabber java java 13 jobs kernel keyboard language language servers languages law learning lenovo letsencrypt libreoffice librpm life livecd liveusb login lsp macbook maintainership mariadb mario matrix memory leaks messaging mounting mouse netflix new zealand node nodelist numix obama oci ogg oggenc oh the humanity open open standards openoffice optimisation org-mode organisation package management packagekit paint shedding parallelism pdo perl pipelight privacy productivity progress progressive web apps pumpkin pwa pyright quality recursion redhat refactoring repairs report rhythmbox sandboxes scheduling screenshots self-navigating car shell sleep smartphones software software engineering speed sql ssd synergy tabs test tests themes thesis tracker travel triumf turtles tv tweak twist typing university update usb user experience valadoc video editing volunteering vpnc waf warm wayland weather web apps website wifi wiki wireless wishes work xinput xmpp xorg xpath
Powered by Blogger.