Taschenorakel.de

Postings in September 2009

Application Theming Tricks

From time to time applications need custom theming rules. Especially when the project has professional UI designers involved. So how to achieve this with GTK+?

Trivial Theming

Most easy and very wrong:

if (gdk_color_parse ("pink", &color))
    gtk_widget_modify_bg (widget, GTK_STATE_NORMAL, &color);

This will break and look childish as soon as your users use a custom color scheme.

Better:

static void
style_set_cb (GtkWidget *widget,
              GtkStyle *old_style)
{
    GtkStyle *style = gtk_widget_get_style (widget);

    if (gtk_style_lookup_color (style, "SecondaryTextColor", &color))

...

Rant: Trade Imbalance Penalties

Barack Obama on CNN: "We can't go back to the era where the Chinese or the Germans or other countries just are selling everything to us, we're taking out a bunch of credit card debt or home equity loans, but we're not selling anything to them".

Found this quote when searching for stories supporting Financial Times Deutschland's story about US and UK officials ...

Why Squeak is not the answer, part 2

Error handling (or god forbid, exception handling) is one of the weak parts in Squeak. A great deal of course comes from its dynamically typed nature. However, the greater impact probably comes from the utter lack of guard clauses in most core librares I've seen so far: Objects will happily accept any kind of parameter and continue to wrack havoc on them until the debugger, at some later point (IF we are lucky), stops the travesty.

Let's move on to BitBlits, where the lack of parameter checking and the absence of proper initialization quickly crashes your VM. Why use BitBlits at all? Because Morphics are crap. More precisely, they feature:

  1. poor performance (I guess all the redrawing with overlapping Morphic instances doesn't come for free),
  2. a hideously complex class hierarchy
  3. undocumented models (say, the model ...