[maemo-developers] GtkAction vs. AppMenu

From: Cornelius Hald hald at icandy.de
Date: Sat May 23 15:33:05 EEST 2009
On Fri, 2009-05-22 at 19:00 +0200, Alberto Garcia wrote:
> Well, that's what looks better in the Fremantle UI style. So even
> if you use gtk radio buttons directly (i.e, without gtk actions) I
> suggest you to do something like this:
> 
> gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (radio_button), FALSE);

To be honest, I also like the _look_ of the toggle button more then the
look of the radio button. But I think we really should use radio buttons
where it is semantically correct/needed.
If the user can only select one single option he should see a radio
button group and not something else. Imaging an app menu with two radio
button groups with three options each. Now if we would use toggle
buttons there the user wouldn't get any clue which combinations he can
select. It would be pure try & error.

So why not just change the visual representation of a GtkRadioButton to
something more pleasing?

> Of course you can still use the traditional radio button look if you
> want, see the attached example (it might help you with the keyboard
> accelerators too).

Thanks a lot for the code example. I didn't look at the accelerators
code yet, but I checked the radio button / action stuff.

I attached a slightly extended version of your example, which uses
gtk_radio_action_set_current_value() the way I'm using it in my code.
Sadly it's not working. So maybe I'm just doing it all wrong. Please
check my small modifications.

Here is a small diff to give you a quick glance of what I changed:

> GtkRadioAction *radioaction = NULL;
> 
13c15,28
<     g_debug ("Button clicked: %s", gtk_action_get_name (action));
---
>     const gchar *name = gtk_action_get_name (action);
>     g_debug ("Button clicked: %s", name);
> 
>     if (strcmp(name, "Action one") == 0) {
>     	g_debug("Activating Radio One");
>     	gtk_radio_action_set_current_value(radioaction, 0);
>     } else if (strcmp(name, "Action two") == 0) {
>     	g_debug("Activating Radio Two");
>     	gtk_radio_action_set_current_value(radioaction, 1);
>     } else if (strcmp(name, "Action three") == 0) {
>     	g_debug("Activating Radio Three");
>     	gtk_radio_action_set_current_value(radioaction, 2);
>     }
> 
68d82
<     GtkRadioAction *radioaction;


So long!
Conny


-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.c
Type: text/x-csrc
Size: 5213 bytes
Desc: not available
Url : http://lists.maemo.org/pipermail/maemo-developers/attachments/20090523/7d3de915/attachment.c 
More information about the maemo-developers mailing list