|
|
Log in / Subscribe / Register

What's new in GTK+ 3 dialogs

By Nathan Willis
July 30, 2014

GUADEC 2014

The GTK+ toolkit is in a constant state of development, although the pace of the changes has slowed quite a bit since the release of GNOME 3.0, when big changes were introduced. Today, each new GTK+ and GNOME release cycle tends to bring smaller, more incremental updates—some of which are subtle enough that they might go unnoticed by users and application developers alike. At GUADEC 2014 in Strasbourg, France, Matthias Clasen presented an update on the most recent improvements to GTK+, most of which can be found in the appearance and behavior of dialog boxes.

GNOME includes a suite of "built-in" dialogs that provide application developers with pre-made dialog boxes for several common tasks. Clasen showed off the improvements to four of them: the color selection dialog, the font chooser, the file chooser, and the "about" dialog. In general, these dialogs now put more content directly in front of the user as active, selectable elements, rather than requiring widgets and controls. For example, the color picker is no longer dominated by a set of slider controls for red, green, and blue channel values; instead the main element is a grid of selectable color swatches. Similarly, the font chooser presents a scrollable list of sample text, rather than a triptych of separate list boxes for font-family names, sizes, and styles.

[Matthias Clasen]

The "about" dialog was perhaps the worst offender of usability principles in the old incarnation; it included stock buttons that popped up "sub-dialogs." These have been replaced with simple tabs, so application authors can include (for example) a list of contributor names as credits. The print dialog is the only built-in dialog that was not part of Clasen's presentation; he said that mock-ups were available on the GNOME wiki showing the changes, but that they were not yet implemented.

For developers, the more important dialog changes to learn about are the updates to how custom dialog boxes are constructed. The GNOME Human Interface Guidelines (HIG) book breaks dialogs down into three categories based on their function, Clasen said. There are message dialogs, which present information (such as an error report) or ask a question, there are action dialogs, which ask the user to make a choice, and there are presentation dialogs, which are more free-form and are generally used to present information that does not fit into the application's static context. Action dialogs are recognizable because they have two or more buttons on them, one of which is highlighted as the default choice. Presentation dialogs are recognizable for having the same controls (close, minimize, etc.) as a "normal" window.

The most consistent change in the custom dialogs, he said, is that they have been migrated to use GTK+ headerbars: window title bars that include not just the window name, but also buttons. Headerbars are intended to save vertical space and make buttons easier to find, but they are only supported in GNOME Shell at the moment. The standard GNOME applications have migrated to headerbars already; when the dialog boxes started migrating during the last release cycle, Clasen said he heard a lot of "rumbling" from developers who use GTK+ in other desktop environments. The trouble is that in those other environments, the desktop's window manager might also draw its own title bar, thus making the dialog doubly decorated.

The good news is that GTK+ now automatically detects which window manager it is running under, and adapts appropriately. In GNOME Shell, he said, the headerbars are used, but in other environments, no title bar is not drawn by GTK+ and all included buttons are automatically moved to their correct locations. He demonstrated this by switching to Xfce and back to GNOME Shell with a demo application running. The work is not entirely finished, he reported; the elementary desktop has special requirements of its own, wanting the rounded shape's on GNOME Shell's headerbars, but with the buttons moved to the bottom of the dialog box.

Other changes to the custom dialogs include the removal of stock images for "error," "message," "question," and similar generic categories. These images did not really serve any function except to tell you that there was a stock dialog on screen, he said. Additionally, he said, the action dialog is a new category introduced with GTK+3. In GTK+2, developers just put buttons on a dialog if they wanted to. The action dialog allows a simple way to present choices and verification dialogs in a consistent manner.

Migration

With his discussion of the basic changes to dialogs completed, Clasen then looked at some case studies for how an application developer might port their code from GTK+2 to GTK+3. For example, there is a way to restore the stock icons that were removed from message dialogs—for the benefit of developers who are concerned about introducing UI changes to their applications. The gtk-message-dialog-set-image() function can be used to put the stock image back in its old location, although eventually the function will be removed.

A more complex problem is how to create a dialog that presents a lot of text to the user—where "a lot" roughly means enough that multiple lines are required, even in a full-width window. In GTK+2, fitting such multi-line text into a dialog without causing it to stretch out over the entire screen was handled automatically because there was a hardcoded 640-by-480 default dialog size in the toolkit. GTK+3 does away with that default, to be more flexible. But developers can recreate it by defining a default dialog size in their own application code, Clasen said. They must take care to also set the dialog's minimum line length, though, using gtk-label-set-width-chars. Ultimately the easiest solution is to use a GTK+3 message dialog, he added, but this upgrade path was available, too.

Finally, Clasen looked at how to try out GTK+ headerbars. There is, of course, a flag to set (GTK_DIALOG_USE_HEADERBAR), but that alone is not quite the entire story. At the moment, the Glade UI builder for GNOME does not support headerbars, so some manual editing is required on the .ui file that is Glade's output. Developers need to add an element that sets the use-header-var property to one in their GtkDialog objects. Fortunately, this manual editing of the .ui file works in Glade templates, so not too much additional work should be required.

One audience member asked why there was a lag between a feature landing in GTK+ and support for it landing in Glade. Clasen responded that it is difficult to implement support for the new feature in Glade while the feature is still undergoing development. Emanuelle Bassi also commented that Glade, unfortunately, has just two part-time contributors at the moment. Clasen agreed, and told the audience that if anyone wanted to make a big impact on GTK+, volunteering to help out with Glade development would be an excellent choice—perhaps even more effective than contributing to GTK+ itself.

Last but not least, even though it was not the subject of his talk, Clasen's presentation made heavy use of another recent GTK+ addition: GTKInspector. Adapted from an earlier standalone tool, GTKInspector is a built-in GTK+ application explorer; users can open it with a keystroke or by passing an environment variable on the command line. It mimics the "web console" feature in Firefox, Clasen said: any GTK+ element can be investigated along with all of its properties, and the entire application's GTK+ widget tree can be seen. If the usage of the tool in Clasen's talk was not evidence of its power on its own, eagle-eyed GUADEC attendees probably noticed it on display in a number of other sessions, most notably Benjamin Otte's presentation on CSS support in GTK+. As with many of the other incremental updates to GTK+, the inspector tool is arguably a small change, but one that will have a positive impact for quite some time.

[The author would like to thank the GNOME Foundation for travel assistance to attend GUADEC 2014.]

Index entries for this article
ConferenceGUADEC/2014


to post comments

What's new in GTK+ 3 dialogs

Posted Jul 31, 2014 2:16 UTC (Thu) by mathstuf (subscriber, #69389) [Link] (7 responses)

And here, after that first paragraph, I was hoping they'd be switching the button order to be sane^Wconformist :( . One thing I'd like to see is removal of OK and Cancel buttons from all dialogs (though OK might make sense on things, but those are probably better in a notification tray anyways). Use *verbs* on your dialog buttons so that the action is clear.

I do wonder how the headerbars will work on my XMonad setup with no decorations and where CSD would still be unwanted.

What's new in GTK+ 3 dialogs

Posted Jul 31, 2014 3:56 UTC (Thu) by rahulsundaram (subscriber, #21946) [Link]

What's new in GTK+ 3 dialogs

Posted Jul 31, 2014 12:07 UTC (Thu) by tao (subscriber, #17563) [Link] (5 responses)

Last time I checked, "cancel" was a verb...

'OK' could be argued to be a verb too ("Can you OK this new specification?"), but it's of course less commonly used as such.
That said, I think most people have a pretty clear understanding what "OK" does when you press it... ("Hmmm, this dialogue gives me two options, OK and Cancel. Cancel reasonably aborts the operation, so I suspect pressing OK will approve performing it").

What's new in GTK+ 3 dialogs

Posted Jul 31, 2014 12:22 UTC (Thu) by BlueLightning (subscriber, #38978) [Link] (2 responses)

This has been discussed at length in various places - you really want to give some idea of the actual action that will be performed on the button, rather than expecting the user to read the full message (mostly because they won't):

http://ux.stackexchange.com/questions/9946/should-i-use-y...

What's new in GTK+ 3 dialogs

Posted Jul 31, 2014 19:39 UTC (Thu) by Cyberax (✭ supporter ✭, #52523) [Link] (1 responses)

That is a matter of opinion. I really dislike "verbose" dialogs.

For example, I'm editing a document and want to close it without saving. I expect a usual dialog "Do you want to proceed? YES/NO", as it's usual.

However, some extra-smart software (like TextEdit on OS X) decides that I simply _must_ be saving the document and shows me a dialog with a name selector. And pressing "Cancel" returns me to the editor.

Not good.

What's new in GTK+ 3 dialogs

Posted Aug 1, 2014 9:04 UTC (Fri) by BlueLightning (subscriber, #38978) [Link]

The example you give doesn't really have anything to do with the design ideal in question. The program could still have displayed a dialog saying "You have unsaved changes, what do you want to do? [Save] [Discard] [Cancel]" (and indeed many current editors do exactly this).

The problem with "Do you want to proceed? YES/NO" is that some applications used to ask "do you want to proceed?" [with quitting, i.e. don't save] and others asked "do you want to save?" with the same set of yes/no answers. If as a user I'm not paying attention or don't bother to read the message and blindly click, I might make a mistake and lose work. Why leave that hole open for users to fall into, when the solution is simple and need not be intrusive?

What's new in GTK+ 3 dialogs

Posted Jul 31, 2014 13:12 UTC (Thu) by mathstuf (subscriber, #69389) [Link]

Oops, yeah. Unfortunately, it is a very non-desript one here and I think should be removed for a clean break. I coukd argue about it on user-triggered actions, but it definitely doesn't belong on dialogs about security warnings or such. I especially hate it on dialogs with a "don't show again" box since that box is ignored in most implementations when that is the choice I want remembered. I'm fine with not having cancel buttons at all and closing the dialog being an acceptable action.

What's new in GTK+ 3 dialogs

Posted Jul 31, 2014 19:33 UTC (Thu) by jwarnica (subscriber, #27492) [Link]

This might be dangerous.

Do you wish to cancel the
operation ?

[OK] [CANCEL]

Um, yeah. What to do, what to do?

Post-maturity

Posted Jul 31, 2014 6:48 UTC (Thu) by ncm (guest, #165) [Link] (9 responses)

Evidently there is very little room left for improvement in this area, so we are now at the stage of rearranging deck chairs. That is probably good news, but maybe users (remember them?) and application developers (remember them?) would benefit more from stability improvements, and avoidance of, you know, icebergs.

Eliminating the category icon and announcing plans to actively break programs that dare to restore it was a bit jarring. It was progress, once, to have one, and now it's progress not to? What has changed in our understanding of human perceptual psychology to make this attempt at offering a clue harmful? I do not mean this as a rhetorical question -- I really am curious to understand what must be something profound.

Post-maturity

Posted Jul 31, 2014 7:01 UTC (Thu) by kugel (subscriber, #70540) [Link] (8 responses)

Right, I will never understand why GTK+ upstream is so opposed to stock images, beginning with 3.0. They have already banned icons from the menus (file, etc.) and buttons. Now they also intend to ban category images from dialogs.

I mean, what are they thinking? That images don't help users to find their way through (perhaps unkown) applications? Are they striving for text-only GUIs?

I do know many gtk application developers and users that do not like this path. I'm one of them

Post-maturity

Posted Jul 31, 2014 19:18 UTC (Thu) by jospoortvliet (guest, #33164) [Link] (7 responses)

Wait until GNOME 4 :-)

I bet it will all go in reverse and text will be banned because the human brain is far better with images than text (duh).

Yeah, i'm also not a big fan of this 'typography is everything' craze from the Windows Phone world. A little of it can be nice but i see it coming up in the new KDE Plasma 5 style too and ... scary.

Post-maturity

Posted Aug 1, 2014 0:15 UTC (Fri) by ovitters (guest, #27950) [Link] (6 responses)

Take your negativity elsewhere please. It is inappropriate and not appreciated.

Post-maturity

Posted Aug 1, 2014 4:55 UTC (Fri) by jospoortvliet (guest, #33164) [Link] (4 responses)

What, we can't like the use of typography over icons now? Wow.

Or is it the reference to GTK 4 that ticks you off? Yell at Emmanuele Bassi, who I got it from: http://www.bassi.io/articles/2014/07/29/guadec-2014-gsk/

Or just buy new cookies and - really, I didn't steal yours.

Post-maturity

Posted Aug 1, 2014 8:34 UTC (Fri) by ovitters (guest, #27950) [Link] (3 responses)

You said in the reply that things are going to change on more a less a whim. Further you mentioned "text will be banned", as if GNOME is a forcing things.

Read your reply again. There are many ways you could've said more or less the same thing without being a dick, this was a being a dick. And it does matter you've been around for a long time and should know better.

Post-maturity

Posted Aug 1, 2014 9:18 UTC (Fri) by jospoortvliet (guest, #33164) [Link]

Sorry that you take it so personal. I'm talking about the current typography craze in design and, like all design styles, I am sure it'll go back and forth. Whim isn't my choice of words, I think it is rather typical of design that things come and go in waves. Clothing business is probably best known for it...

Taking that observation as a huge insult to you personally or GNOME in general (while I actually mention I am unhappy about seeing it also in Plasma, not a GNOME project last time I checked) is a bit far-fetched to put it mildly. There is more in the world than just, you know, YOU and GNOME. And more you. Typography in design is going everywhere (heck, ownCloud uses it a lot, too).

Now sure, there was a mention to GNOME 4 with a ;-) and some hyperbole, if you can't stand that I'm sorry but I write plenty of serious articles for my job. Here I'm commenting on the internet reading something interesting/fun, not writing a press release, so if you don't mind, I'd like to keep things light.

Heck, why do you even assume I mean something so evil when you can probably imagine quite well that I'm very happy about the developments described in this article - considering I've been rather loudly complaining about the CSD and other things that make interoperability (of the GTK applications I use) harder. I'm delighted by the work of Clasen and Emanuale and whoever worked on this as I don't see GIMP ported to Qt anytime soon, so this makes it and other GTK apps I use (Inkscape being another one) integrate reasonably well into my desktop.

But I'm sure you can find lots of hate in that, too. I suggest, again, to breathe. And I'll stop responding here and your complaints on G+ before I become too sarcastic about this nonsense discussion for my own good.

Post-maturity

Posted Aug 1, 2014 10:36 UTC (Fri) by kugel (subscriber, #70540) [Link]

> You said in the reply that things are going to change on more a less a whim. Further you mentioned "text will be banned", as if GNOME is a forcing things.

Well, it will force no-menu/button/dialog-sock-icons with the upcoming GTK+ version instead of allowing users to have icons and allowing developers to let their users decide, so yes it is a forcing things.

Post-maturity

Posted Aug 7, 2014 10:26 UTC (Thu) by HelloWorld (guest, #56129) [Link]

Well, “don't be a dick” is one of the rules of guys. Here's the other one:
https://www.youtube.com/watch?v=T5YZ9CttznE&t=1m23s

Post-maturity

Posted Aug 1, 2014 22:28 UTC (Fri) by jschrod (subscriber, #1646) [Link]

http://lmgtfy.com/?q=take+it+with+a+grain+of+salt

Or -- European style -- more direct: get a life. This was obviously not written as an insult. Go out, and meet some friends. There is life beyond the screen.

What's new in GTK+ 3 dialogs

Posted Jul 31, 2014 13:46 UTC (Thu) by tshow (subscriber, #6411) [Link] (2 responses)

I do hope they finally do something about GtkColorChooser; I'm still having to use the deprecated GtkColorSelection because by default Chooser is a dumbed-down "here's a box of crayons, none of which are the color you want" dialog, and as far as I can tell there's no way to make it as functional as Selection was out of the box. Some of the functionality is there in Chooser, but it's hidden[1], and there appears to be no way to configure it to show up upon display rather than requiring the user to take explicit actions to get at it.

We use the color selection dialog (and the file and font selection dialogs) in our game engine and tools, which means we generally want to be able to set the color dialog to a state where there's a fully capable HLS/RGB selector with visible values and (usually) an alpha slider. Requiring the user to find that behind the box of crayons is suboptimal.

[1] Long press is a bad idea even on touch platforms; it's completely undiscoverable unless you put some sort of animated "you're working your way towards something!" graphic like a pie chart filling or somesuch, and there's never any good visual hints as to what might be long-pressable -- long-pressability has no affordance metaphor.

What's new in GTK+ 3 dialogs

Posted Jul 31, 2014 15:37 UTC (Thu) by raven667 (guest, #5198) [Link]

> Long press is a bad idea even on touch platforms; it's completely undiscoverable

That reminds me that I had my iPhone for over a year before I learned that you could re-arrange icons by long-press and I only learned because I was complaining that there was no way to do so to a co-worker who then educated me about the long-press feature. I'd like to think I'm not a complete moron and I _never_ would have stumbled across how to do that on my own.

What's new in GTK+ 3 dialogs

Posted Aug 1, 2014 0:24 UTC (Fri) by ovitters (guest, #27950) [Link]

Please complain loudly on gtk-devel-list when things happen that's not workable. Various times there might be a statement which seems like final, but it's not, just discussion style is a bit different than what some are used to.

e.g.
A: Should be like this
B: No, you're wrong because X, Y, Z

If A is some gtk+ developer, it's totally expected someone else goes back and says they're "idiots" (joking, but please be friendly). Gtk+ devs don't always know exactly how other projects use it (logically, some stuff might be closed source), so feedback is always needed.

What's new in GTK+ 3 dialogs

Posted Jul 31, 2014 19:58 UTC (Thu) by dashesy (guest, #74652) [Link] (3 responses)

I wish I could change all checkboxes to plain old check boxes. The current on/off paradigm (or blue/grey) is very confusing, now after years on my desktop I still click it twice to see if Airplane mode (yes name is that in my desktop!!) in network settings is enabled or disabled.

What's new in GTK+ 3 dialogs

Posted Aug 1, 2014 10:39 UTC (Fri) by kugel (subscriber, #70540) [Link] (2 responses)

Right, these iphone-style check boxes annoy me too, on the desktop as well as on android (though on android both seem to exist simultaneously).

What's new in GTK+ 3 dialogs

Posted Aug 1, 2014 10:47 UTC (Fri) by halla (subscriber, #14185) [Link] (1 responses)

It's funny, these switches, because in real life, the position of the switch is irrelevant. It's dark, so I slide the switch in the only way it'll go and lo, and behold: there be light. It works in real life, but it's a pretty bad idea in virtual life.

What's new in GTK+ 3 dialogs

Posted Aug 3, 2014 17:17 UTC (Sun) by mpr22 (subscriber, #60784) [Link]

This kind of futile skeuomorphism needs to be indented six feet down and covered with dirt.

What's new in GTK+ 3 dialogs

Posted Aug 1, 2014 1:40 UTC (Fri) by dlang (guest, #313) [Link] (2 responses)

a scrolling list of sample text instead of being able to pick font size and type????

so how in the world does the system tell if I am just wanting to tweak the size with the same font, or switch fonts with the same size, or do something wierd?

never mind the people who really get fanatical about fonts and aren't satisfied with "well, the sample text looks close" and want a specific font for the way some letter or character looks at a particular scale

this sort of change is great for the newbe who don't understand these sorts of things, but will make the system unusable for serious work.

so they want to get a bunch of newbes using their code, but don't want any of them to progress to advanced use.

Now, as an optional mode of the dialog, this would be just fine, but not as the default, let alone the only mode.

What's new in GTK+ 3 dialogs

Posted Aug 12, 2014 22:55 UTC (Tue) by SEMW (guest, #52697) [Link] (1 responses)

> how in the world does the system tell if I am just wanting to tweak the size with the same font, or switch fonts with the same size, or do something wierd? ... never mind the people who really get fanatical about fonts and aren't satisfied with "well, the sample text looks close" and want a specific font for the way some letter or character looks at a particular scale

To change the size without changing the font, I would suggest moving the size slider without changing what font you've selected.

To change the font without changing the size, I would suggest selecting a new font without moving the size slider.

To choose specific font, choose that font. The font name is displayed above the sample text.

Your rhetorical questions make no sense as criticism. Did you not even have a look at the new gtk3 font picker before critiquing it? Hint: it's the first Google Images result for "new gtk3 font picker".

What's new in GTK+ 3 dialogs

Posted Aug 12, 2014 23:30 UTC (Tue) by Cyberax (✭ supporter ✭, #52523) [Link]

Tried it. It's ugly like a result of putting a baby kitten through a shredder.

There's no way to look through font families, no easy way to first select a font and then its italic/bold/light variant (a Helvetica font on my computer has 26 such variants).

And even visually it sucks.


Copyright © 2014, Eklektix, Inc.
This article may be redistributed under the terms of the Creative Commons CC BY-SA 4.0 license
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds