Avoiding Use of Deprecated API

Most Deprecated GTK+ 2 API is not in GTK+ 3

GTK+ 3 has API changes compared to GTK+ 2, but some of the new API has been added to GTK+ 2.22 and 2.24, and older API has been deprecated. gtkmm has done this too. This is intended to ease porting to GTK+ 3 (or gtkmm 3). If your application builds with GTK+ 2.24 with deprecated API disabled then it will be much easier to port to GTK+ 3 afterwards.

This requires defining C macros such as GTK_DISABLE_DEPRECATED, though you’ll want to use GDK_DISABLE_DEPRECATED, GDK_PIXBUF_DISABLE_DEPRECATED, G_DISABLE_DEPRECATED and maybe PANGO_DISABLE_DEPRECATED too. You can specify these as -D options in your Makefile.am.

However, you should not disable deprecated API in your build at all times. That just makes life unnecessarily difficult for people building from tarballs.

So over the last few years, Daniel Elstner has perfected an MM_ARG_ENABLE_WARNINGS m4 macro for use with autotools. It adds an –enable-warnings=min/max/fatal/no configure option. We use it mostly to turn on compiler-warnings-as-errors, but I think that it would be very useful to many people now during the transition to GTK+ 3.

MM_ARG_ENABLE_WARNINGS

This macro is in mm-common, which you could depend on, though it contains other stuff that is only interesting to gtkmm projects. For instance, I use it in Glom’s configure.ac file, like so:

MM_ARG_ENABLE_WARNINGS([MYPROJECT_WFLAGS],
  [-Wall],
  [-Wall -Wextra -Wno-missing-field-initializers -DGSEAL_ENABLE],
  [G GDK GDK_PIXBUF PANGO GTK])

I then use the resulting variable in my Makefile.am file, like so:

AM_CFLAGS = $(MYPROJECT_WFLAGS)

If you use non-recursive autotools (and you should) then you won’t need to repeat that much.
I also added the option to DISTCHECK_CONFIGURE_FLAGS so I am forced to fix any warnings during make distcheck, when doing a tarball release. You don’t need to do that.

Whenever I build one of these projects from git I specify –enable-warnings=fatal to autogen.sh and fix any problems that it finds. That’s why there are zero compiler warnings or use of deprecated API in Glom.

DK_ARG_ENABLE_WARNINGS

You might prefer to copy the standalone version into your project instead. There are copies of the standalone macro in various projects already. Here is an example commit that adds it to a project.

The macro call looks like this in your configure.ac, for instance:

DK_ARG_ENABLE_WARNINGS([MYPROJECT_WFLAGS],
  [-Wall -w1],
  [-pedantic -Wall -Wextra -w1],
  [G GDK GDK_PIXBUF PANGO GTK])

Meyah Kathi

Our daughter, Meyah Kathi Cumming, was born healthy and perfect just a few days ago, on the 25th December 2010 at 12:25, 51cm and 2695 grams. She is our second child. Liam was born three years ago. We know how lucky we are.

Meyah

Meyah is named after my mother, Maya Cumming, though we’ve changed the spelling. My mother was named Margaret Maya Lawrence, but there was apparently an argument about which Margaret she was named after. So her father soon decided to use her second name, though her official documents always showed Margaret. It was always pronounced May rather than the Mei that you’d expect in Europe or Russia, though nobody in that family ever spoke enough about anything for us to be sure that it was on purpose. There was vague talk of her father’s time in the pacific during the war, but that’s just vagueness upon vagueness. Anyway, it was her name for whatever reason. But now that we live in Germany, where there are many Mayas whose names are pronounced “correctly”, we thought we’d make the distinction clearer.

Her second name is from Sigi’s great grandmother Kathi Oma – Katherina Kiefer, wife of Hans Kiefer. Her maiden name was Thor and she was born in a German-speaking village in the Romanian Banat.

Both Meyah and Sigi are fine now, but it was scary for a little while. Sigi had signs of pre-eclampsia for a few months, which turned into definite HELLP syndrome on the 25th. She needed a full anesthetic so I had to wait outside the operating room for thirty minutes. Then I held Meyah in my arms shortly after hearing her first cries. It wasn’t our plan but it all worked out safely.

Liam’s third birthday was just four days later on the 29th. Unfortunately he couldn’t share it with his friends, or Meyah in the hospital, because we noticed the signs of chickenpox just a day later. Luckily he is not suffering much at all.

I am very grateful to our friends and Liam’s Oma for looking after Liam at home while I visited the hospital, first in the nighttime for the birth and later because he wasn’t allowed to visit.

Liam has looked forward to Meyah and Mama arriving home. He understands how little a baby can do at first and knows that she will grow bigger and learn to do everything that he can do. He’s very gentle and sweet with her. They will always have each other.

Translated gtkmm.org Web Site

Since May 2010, gtkmm.org has been available in Chinese as well as English, thanks to a patch from Tao Wang. It uses DocBook XML and xml2po, like any other GNOME documentation, along with some custom DocBook XSL stylesheet parameters and our web site’s CSS.

It works. Translations can be kept up to date easily when the original English changes (though they haven’t so far in this case, admittedly) because the translations are not in copies of the documents, but in regular gettext .po files. It’s not a CMS, and editing is not particularly user-friendly, but it’s no worse than the untranslated HTML that we had previously.

I recently cleaned up the web site’s directory structure so it’s more like an application or documentation manual so you can see what I mean. And the gtkmm.org translation status is available on l10n.gnome.org thanks to Claude Paroz. The gtkmm book is also translated in the same way, so now everything other than our (Doxygen) API reference is translatable.

The build could be improved by someone who knew how. You currently need to add an HTML_generation block in the Makefile.am when you add a new locale.

Liam at the Kindergarten

Liam is at the end of his first two weeks at the kindergarten, during which we spent time with him there while he got used to it. People may have noticed that my daily routine changed.

We were incredibly lucky to get a place at the Kindergarten on the corner near us, after being incredibly lucky to get a place at the crèche over the road from us. This is not a normal experience. I had given up hope of finding a place in the next few years but then the phone rang with the news.

He has far more freedom there than he is used to, and suddenly he’s not the oldest, but he is adjusting. I’m proud of him.

Non-Automatic Layout is Useless / Qt Designer has bad defaults

The widgets in a UI should adapt to different window sizes, font sizes, translated text, left-to-right/right-to-left locales, etc. This is obvious to the programmers that I work with.

I recently remembered that qt-designer didn’t do this when I last tried, which shocked me. So I looked again at a newer version to see if it would make me happier. I took some side-by-side screenshots of Glade and qt-designer on my wide monitor, to make the point.

For instance, see the slideshow to experience the first-impression that a half-competent developer is likely to get. Buttons that were in the corner will be left stranded in a sea of blank space. Widgets will appear half out of the window.

All of this is unnecessary. qt-designer/qt-creator can actually do proper automatic layout if you right-click on the layout, and choose the “Lay out” -> “Lay Out in a Grid” menu item. The default is called “Lay Out in a Form Layout”. Presumably someone decided to make Visual Basic users feel at home by duplicating their stupid environment, but that just keeps them doing stupid things and makes regular developers go elsewhere.

By the way, I do like one thing in qt-designer more than Glade. It correctly assumes that a treeview is more likely than a text label to need to expand.

Note that qt-creator, which uses the same system, apparently via the same code, does the same thing. I checked the latest qt-creator snapshot.

gtkmm book on Kindle

I recently got a Kindle 3 which I’m really enjoying.

As an experiment, I published a Kindle version of the “Programming with gtkmm” book. I don’t actually expect to sell many, though it could be a convenience for some people. I wish I could just “Print to Kindle” from my computer.

I set the “list price” at $2.00, but it appears as $4.60 to me here in Germany. It might be $2.00 to people in the US. I get 70 cents each time for both.

The GNOME Events Box is missing

The European GNOME Events Box is currently missing because UPS delivered it to a random address in Odivelas, Portugal instead of the correct address in Sevilla, Spain, and they can’t get it back.

We are usually happy with UPS but they’ve just thrown up their hands and given us a claim form, asking us for the receipts for all the items in the box, some of which were gifts from GNOME-friendly companies.

I don’t have much confidence that UPS have really looked for the box. So if you are near Odivelas, it would be great if you could politely ask there. Please ask me for the full address via email – it doesn’t seem fair to publish it.

Trainee mini gtkmm projects

In August I mentioned the mini GTK+ C projects that our trainees completed: massifg, gmemory and GHangTux.

They recently finished some mini gtkmm C++ projects too, because I think gtkmm is a comfortable way to learn good C++ habits after GTK+. Here they are:

  • Chris Kühl’s Merkmal, a port of gmemory to gtkmm and cluttermm. It’s a card memory game.
  • Patricia Santana Cruz’s GHangtuxmm: A port of GHangTux to gtkmm. It’s a hangman game.
  • Jon Nordby’s glom-postgresql-setup, which does the awkward server configuration that typical Glom users don’t want to worry about.

They are now moving on to Qt and they’ll get some exercise on deeper OO and C++ concepts. In fact, Jon Nordy has already created a QImage plugin to support the OpenRaster image format.

Openismus contributions to GTK+

Openismus has made several contributions to GTK+ recently, getting changes into the upstream releases, doing things properly via bugzilla and the mailing lists, working with other developers even when it’s complicated, so it’s done right. This has helped my application, Glom, which uses GTK+ via gtkmm. It shows that we could do the same for you.

For some of our employees this is also a slight reward for being so busy coding with Qt right now. We love GTK+ as much as ever, regardless of one big company’s arbitrary choice to stop using it. Some of us like it even more now.

A short list of recent Openismus work on GTK+:

Tristan also created a couple of useful container widgets that were not needed in GTK+ itself so they are now in libegg. They were made possible by the extended layout support in GTK+ 3.

  • EggWrapBox
    By Tristan. This positions child widgets in sequence according to its orientation. For instance, with the horizontal orientation, the widgets will be arranged from left to right, starting a new row under the previous row when necessary, as in a toolbar or tool palette.
  • EggSpreadTable (screenshots)
    By Tristan and ported back to libegg by our David King. This positions its children by distributing them as evenly as possible across a fixed number of rows or columns, like newspaper columns.

gtkmm 2.91.2

Just a day after the GTK+ 2.91.2 release, I managed to release gtkmm 2.91.2, with (hopefully) all the new API. I have Glom and the gtkmm-documentation examples building with the latest gtkmm as a test.

I also did a release of glibmm 2.27.1, matching the glib 2.27.1 release. José Alburquerque has been working very hard on this, while also working on gstreamermm. But we really need some feedback on all the new API, particularly the Gio::DBus* stuff. Someone needs to sit down and write example code to see if it even works. We skipped the stable glibmm 2.26.x releases because this had not happened so we were not ready to call the API/ABI stable.