Re: GtkAction vs. AppMenu

2009-05-28 Thread Cornelius Hald
Murray Cumming wrote:
 On Sun, 2009-05-24 at 15:55 +0200, Alberto Garcia wrote:
   
 On Sun, May 24, 2009 at 01:48:11PM +0200, Murray Cumming wrote:

 
 However, I'm was asking about the API and implementation, because
 the Fremantle UI guidelines are really out of our control at this
 point.
   
 The implementation can be changed, we're in beta and that means that
 things can still be fixed.
 

 No, Beta generally means that API and UI changes are no longer possible.
 And I think that's the case with Maemo 5.
   

Could someone please clarify that?
We all know that Maemo 5 is currently in Beta state, but does this mean 
that API and/or UI changes are still allowed or not? It would be really 
good to know whether or not it makes sense to press for some changes. I 
mean if it doesn't matter what we're saying, then I'll just accept the 
current state and try to work around as best as I can. But if there's a 
chance for a change I think some things should be discussed further.

Conny

___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: GtkAction vs. AppMenu

2009-05-28 Thread Alberto Garcia
On Thu, May 28, 2009 at 04:30:10PM +0200, Cornelius Hald wrote:

   The implementation can be changed, we're in beta and that means
   that things can still be fixed.
  No, Beta generally means that API and UI changes are no longer
  possible.  And I think that's the case with Maemo 5.
 Could someone please clarify that?
 We all know that Maemo 5 is currently in Beta state, but does this
 mean that API and/or UI changes are still allowed or not?

Well, I'm one of the Hildon developers and I can tell you that we _do_
accept suggestions :-)

Of course we have some constraints and we can't change everything
that we want, but if the change that you propose is feasible it'll be
considered. We also accept patches ;-)

Feel free to open bugs in https://bugs.maemo.org/ with your
suggestions.

Thanks!

Berto
___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: GtkAction vs. AppMenu

2009-05-28 Thread Cornelius Hald
Alberto Garcia wrote:
 Well, I'm one of the Hildon developers and I can tell you that we _do_
 accept suggestions :-)
   
That's really good to hear! Thanks for making that clear :)
 Of course we have some constraints and we can't change everything
 that we want, but if the change that you propose is feasible it'll be
 considered. We also accept patches ;-)
   
I´m not sure I´m up to it - but who knows...
 Feel free to open bugs in https://bugs.maemo.org/ with your
 suggestions.
   
I´ll do! Thanks again!

Conny

___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: GtkAction vs. AppMenu

2009-05-25 Thread Murray Cumming
On Fri, 2009-05-22 at 22:09 +0200, Murray Cumming wrote:
 On Fri, 2009-05-22 at 19:00 +0200, Alberto Garcia wrote:
  On Fri, May 22, 2009 at 05:08:08PM +0200, Cornelius Hald wrote:
  
   The result now is:
   - gtk_toggle_button_new() is working but it displays the buttons as
   toggle buttons not as radio buttons.
  
  Well, that's what looks better in the Fremantle UI style.
 
 Yes, the Hildon HIG seems to suggest this, though it's very vague due to
 the non-native-speaker English and the lack of screenshots (I filed bugs
 about that already):
 http://maemo.org/api_refs/5.0/beta/hig/html/ch06s08.html

Sorry, that was the wrong section. It's actually not mentioned in the
public Maemo HIG. I filed a bug:
https://bugs.maemo.org/show_bug.cgi?id=4577

 
 However, if radio buttons are meant to look a certain way in Maemo, why
 isn't that just a matter of theming or even of making a change in the
 GTK+ code instead of asking people to use the GTK+ API in an abnormal
 way?

-- 
murr...@murrayc.com
www.murrayc.com
www.openismus.com

___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: GtkAction vs. AppMenu

2009-05-25 Thread Murray Cumming
On Sun, 2009-05-24 at 15:55 +0200, Alberto Garcia wrote:
 On Sun, May 24, 2009 at 01:48:11PM +0200, Murray Cumming wrote:
 
  However, I'm was asking about the API and implementation, because
  the Fremantle UI guidelines are really out of our control at this
  point.
 
 The implementation can be changed, we're in beta and that means that
 things can still be fixed.

No, Beta generally means that API and UI changes are no longer possible.
And I think that's the case with Maemo 5.

It's unfortunate that we only saw a well-enough documented API reference
and HIG at the beta stage. I think that the quality improvements from
being more open would have been worth more than whatever short-term
market positioning Nokia gained by working in isolation. Yes, I'm
whining aimlessly. Sorry.  

 I think that the proper place to discuss this is the Maemo bugzilla,
 so can you please file a bug against Gtk?
 
 https://bugs.maemo.org/enter_bug.cgi?product=Desktop%20platform

Done:
https://bugs.maemo.org/show_bug.cgi?id=4578

-- 
murr...@murrayc.com
www.murrayc.com
www.openismus.com

___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: GtkAction vs. AppMenu

2009-05-25 Thread Murray Cumming
On Sun, 2009-05-24 at 19:58 +0200, Cornelius Hald wrote:
 Another thing is, that if you compare those two menus, you can easily
 see that the Diablo menu has more structure due to the use of
 separators. I'm not yet sure how to get back this structure, but I'll
 make some experiments. HIG suggestions are welcome as well :)

The Hildon HIG 
http://maemo.org/api_refs/5.0/beta/hig/html/ch06s09.html
says

Only use toggle buttons as filters in a menu. Use them in groups, so
they are not mistaken for regular buttons. Make the group behave like
either a group of check buttons or a group of GTK radio buttons, as
required.


I wonder how we should use them in a group. Maybe putting them in a
filter has that effect.

-- 
murr...@murrayc.com
www.murrayc.com
www.openismus.com

___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: GtkAction vs. AppMenu

2009-05-25 Thread Cornelius Hald
On Fri, 2009-05-22 at 19:00 +0200, Alberto Garcia wrote:
 On Fri, May 22, 2009 at 05:08:08PM +0200, Cornelius Hald wrote:
 (it might help you with the keyboard accelerators too).

It did :) I adapted my code to look like the example which you provided
and now the accelerators work for Diablo and Fremantle. I'm not really
sure why - but who cares as long as it's working ;)

Cheers!
Conny


___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: GtkAction vs. AppMenu

2009-05-25 Thread Cornelius Hald
On Mon, 2009-05-25 at 12:24 +0200, Murray Cumming wrote:
 On Sun, 2009-05-24 at 19:58 +0200, Cornelius Hald wrote:
  Another thing is, that if you compare those two menus, you can easily
  see that the Diablo menu has more structure due to the use of
  separators. I'm not yet sure how to get back this structure, but I'll
  make some experiments. HIG suggestions are welcome as well :)
 
 The Hildon HIG 
 http://maemo.org/api_refs/5.0/beta/hig/html/ch06s09.html
 says
 
 Only use toggle buttons as filters in a menu. Use them in groups, so
 they are not mistaken for regular buttons. Make the group behave like
 either a group of check buttons or a group of GTK radio buttons, as
 required.
 
 
 I wonder how we should use them in a group. Maybe putting them in a
 filter has that effect.

I just tried that, and indeed using hildon_app_menu_add_filter() groups
the toggle buttons together into one row.

I made to screenshots to illustrate the point. The radio group
consists of the four buttons with the labels Small, Normal, Large
and Huge.

1) Using hildon_app_menu_append() you get the normal 2 column layout:
http://zwong.de/wp-content/uploads/2009/05/app_menu_with_buttons.png

2) Using hildon_app_menu_add_filter() puts all of them into the first
row of the menu:
http://zwong.de/wp-content/uploads/2009/05/app_menu_with_filter.png

I hope this helps! The drawback is, you can have only one Filter per
menu :/



___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: GtkAction vs. AppMenu

2009-05-25 Thread Alberto Garcia
On Mon, May 25, 2009 at 06:19:35PM +0200, Cornelius Hald wrote:

 I just tried that, and indeed using hildon_app_menu_add_filter()
 groups the toggle buttons together into one row.

Yes, that's the purpose of that function. As you say, only one filter
group is supported, but that's by design.

Berto
___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: GtkAction vs. AppMenu

2009-05-25 Thread Alberto Garcia
On Sun, May 24, 2009 at 07:58:26PM +0200, Cornelius Hald wrote:

 Thanks Berto for all the good input and for explaining the decisions
 that have been made.

Thank you for your feedback :)

 Another thing is, that if you compare those two menus, you can
 easily see that the Diablo menu has more structure due to the use
 of separators. I'm not yet sure how to get back this structure, but
 I'll make some experiments. HIG suggestions are welcome as well :)

I'd like to write a longer e-mail about this, but the basic
thing is that the Fremantle menu is purposely different from
GtkMenu. HildonAppMenu has a limited number of options and there are
no separators or submenus. It is designed to be like that.

This means that in many cases you won't be able to simply convert it:
it has to be redesigned.

Show the user a few options and use e.g. dialogs for further
details/configuration. Buttons and dialogs in Fremantle are designed
to be big and finger-friendly so the user should be able to use them
easily.

Berto
___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: GtkAction vs. AppMenu

2009-05-24 Thread Murray Cumming
On Sun, 2009-05-24 at 05:08 +0200, Alberto Garcia wrote:
   Toggle-like radio buttons are quite common too in many user
   interfaces.
  Not that I can think of.
 
 Well, I haven't made a list :) but out of the blue I can think at
 least of the GIMP, Audacity, OpenOffice/MS Word/Abiword/Gnumeric,
 the iPhone...

Where I can find examples of these, it seems to be where space
constraints make a real radio button difficult to use. Such as the
alignment buttons in the OpenOffice toolbar.

But Maemo Fremantle suggests their use _always_, for some other
unexplained reason. This suggests that it's just about the cosmetic
appearance, suggesting that it's an issue for the theme. Otherwise it's
just another tedious #ifdef to add to code when porting to Maemo.

  and I'd swear I saw them in the Moblin 2 UI too. But I
 wasn't only thinking about computer interfaces, they're used in some
 home appliances too.

Home appliances generally have awful UI and have very little UI
consistency. You'll find plenty of prior art for design mistakes in the
home. That lack of consistency means that there can be no meaningful
convention to differentiate between toggle buttons and radio buttons
there anyway.

However, I'm was asking about the API and implementation, because the
Fremantle UI guidelines are really out of our control at this point.


-- 
murr...@murrayc.com
www.murrayc.com
www.openismus.com

___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: GtkAction vs. AppMenu

2009-05-24 Thread Alberto Garcia
On Sun, May 24, 2009 at 01:48:11PM +0200, Murray Cumming wrote:

 However, I'm was asking about the API and implementation, because
 the Fremantle UI guidelines are really out of our control at this
 point.

The implementation can be changed, we're in beta and that means that
things can still be fixed.

I think that the proper place to discuss this is the Maemo bugzilla,
so can you please file a bug against Gtk?

https://bugs.maemo.org/enter_bug.cgi?product=Desktop%20platform

Berto
___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: GtkAction vs. AppMenu

2009-05-24 Thread Cornelius Hald
Thanks Berto for all the good input and for explaining the decisions
that have been made. I wasn't really aware that radio buttons are
discouraged and that toggle buttons should be favored. Now that I know
that, I changed the code again to use toggle buttons and everything
works as expected. So there is no immediate need for you to check my
example - I still would be interested though ;)

Here are two screenshots. The first is the menu in Diablo, the second is
the same menu in Fremantle.
http://zwong.de/wp-content/uploads/2009/05/diablo_style_menu.png
http://zwong.de/wp-content/uploads/2009/05/fremantle_style_menu.png

Now the only thing to do is to remove the Increase Indent and
Decrease Indent buttons from the Fremantle menu, because only 10 items
are allowed and currently there are 12.

Another thing is, that if you compare those two menus, you can easily
see that the Diablo menu has more structure due to the use of
separators. I'm not yet sure how to get back this structure, but I'll
make some experiments. HIG suggestions are welcome as well :)

I think that we really need updates to the Fremantle style guide
especially we need lots of screenshots that show us developers how our
applications should look and behave. Also we need more advice on how to
convert common functionality from Diablo to Fremantle. The problem with
the text box inside a scrollable area comes again to my mind. Or how to
use filters properly (which will be an extra thread soon).

Many people (like me) are just developing in their free time, which is
mainly in the evenings or on the weekends. The experiments with the
Fremantle UI were taking my complete development time during the last
two weeks. The application I'm developing is really small and has not
much of an UI so it should be straight forward to adopt the program to
the new look and feel and shouldn't take longer then one evening.

Hmm, maybe this mail was a bit chaotic, but I think we really need to
document this process better to help people getting there apps ready for
the next tablet. Otherwise people will not adopt the new API and the
programs will still have small menus, big scrollbars, small scrollbars
and generally will just look inconsistent. I mean I'm really happy that
my job is not to port maemo-mapper which has around 90(!) menu items

Don't get me wrong, I'm happy that there is now a way for creating
completely finger friendly UIs and I'm happy that alpha and beta code is
available. I'm just saying we need to make it easier for developers to
use this API. Whether this is by changing the API or by creating better
documentation or by doing something else doesn't really matter. It just
should be easier :) Then again - maybe I'm the only one having this kind
of problems?!

Cheers!
Conny


___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: GtkAction vs. AppMenu

2009-05-23 Thread Cornelius Hald
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


#includehildon/hildon.h

GtkRadioAction *radioaction = NULL;

static void
radio_action_changed(GtkAction *action,
 GtkAction *current)
{
g_debug (Radio action changed: %s, gtk_action_get_name (current));
}

static void
action_activated(GtkAction *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);
}

}

static GtkAction *
create_action   (const gchar *name,
 const gchar *accel,
 GtkActionGroup *actiongroup,
 GtkAccelGroup *accelgroup)
{
GtkAction *action = gtk_action_new (name, name, NULL, NULL);
gtk_action_group_add_action_with_accel (actiongroup, action, accel);
gtk_action_set_accel_group (action, accelgroup);
gtk_action_connect_accelerator (action);
g_signal_connect (action, activate, G_CALLBACK (action_activated), NULL);
return action;
}

static GtkButton *
create_item (GtkAction *action)
{
HildonSizeType buttonsize = HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH;
GtkWidget *button = hildon_gtk_button_new (buttonsize);
gtk_action_connect_proxy (action, button);
return GTK_BUTTON (button);
}

static GtkRadioAction *
create_radio_action (const gchar *name,
 GtkRadioAction *previous)
{
static gint count = 0;
GtkRadioAction *action = gtk_radio_action_new (name, name, NULL, NULL, count++);
if (previous) {
gtk_radio_action_set_group (action, gtk_radio_action_get_group (previous));
}
return action;
}

static GtkButton *
create_radio_item   (GtkRadioAction *action)
{
static GSList *group = NULL;
HildonSizeType buttonsize = HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH;
GtkWidget *button = hildon_gtk_radio_button_new (buttonsize, group);
group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
gtk_action_connect_proxy (GTK_ACTION (action), button);
return GTK_BUTTON (button);
}

static HildonAppMenu *

Re: GtkAction vs. AppMenu

2009-05-23 Thread Alberto Garcia
On Fri, May 22, 2009 at 10:09:49PM +0200, Murray Cumming wrote:

 if radio buttons are meant to look a certain way in Maemo, why isn't
 that just a matter of theming or even of making a change in the GTK+
 code instead of asking people to use the GTK+ API in an abnormal
 way?

Well, there are several reasons for that:

   * First, I don't think there's anything abnormal about that
 API. gtk_toggle_button_set_mode() is there exactly for that
 purpose and it's trivial to use. I don't think it's necessary to
 patch GTK when GTK is already designed to do what we want here.

   * Second, maemo-gtk already differs from the upstream version of
 GTK in quite a few things. Using a fork of GTK is not something
 desirable in general, and keeping it in sync with upstream is not
 a trivial task either, as the maemo-gtk maintainers (Lanedo) will
 probably tell you if you ask them. So we try to introduce as few
 changes as possible to maemo-gtk unless they're really
 necessary. We don't think it's the case here, for the reason
 explained above.

   * Third, GTK is a general purpose toolkit, and contains lots of
 very different widgets for all kinds of needs, but that doesn't
 need that they're all equally suited to every kind of platform or
 device.

 We can decide how we want Maemo to be and how we want its
 applications look like. GTK is good enough to allow us to create
 the widgets that we need, and that's why GTK was chosen. But that
 doesn't mean that we have to remove all the widgets and functions
 that we don't need/recommend for Fremantle. We cannot stop people
 from doing things that we think don't fit in the Fremantle UI
 style.

Berto
___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: GtkAction vs. AppMenu

2009-05-23 Thread Alberto Garcia
On Sat, May 23, 2009 at 02:33:05PM +0200, Cornelius Hald wrote:

  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.

As I've just said in a message to Murray, the fact that they're
commonly used in Desktop applications doesn't mean that it has to be
the same way in other kinds of platforms. Toggle-like radio buttons
are quite common too in many user interfaces.

For Fremantle it has been decided that the way to show radio buttons
it to make them look like toggle buttons, and applications have been
designed with that in mind (and that includes making sure that radio
buttons and toggle buttons are not mixed in a way that can confuse the
user). You can also use other widgets (e.g. HildonTouchSelector) for a
similar functionality.

We cannot really force people to use the widgets that we want, but
we can say how Fremantle apps are designed to look like and give
recommendations and guidelines to make 3rd-party apps look consistent
with the overall style of the platform.

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

Well, I didn't design the Fremantle UI style so I cannot really help
you much :) but my personal opinion is that the current design is not
confusing at all (at least if used correctly).

 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.

I'll try to take a look when I have a few minutes more :)

Berto
___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: GtkAction vs. AppMenu

2009-05-23 Thread Murray Cumming
On Sat, 2009-05-23 at 18:08 +0200, Alberto Garcia wrote:
 On Fri, May 22, 2009 at 10:09:49PM +0200, Murray Cumming wrote:
 
  if radio buttons are meant to look a certain way in Maemo, why isn't
  that just a matter of theming or even of making a change in the GTK+
  code instead of asking people to use the GTK+ API in an abnormal
  way?
 
 Well, there are several reasons for that:
 
* First, I don't think there's anything abnormal about that
  API. gtk_toggle_button_set_mode() is there exactly for that
  purpose and it's trivial to use.

I think that function is widely considered to be useless and illogical. 

  I don't think it's necessary to
  patch GTK when GTK is already designed to do what we want here.
 
* Second, maemo-gtk already differs from the upstream version of
  GTK in quite a few things.

Still, API differences should be avoided where possible. A lot of
unpleasant API differences were reduced before the Fremantle work.

[snip]

-- 
murr...@murrayc.com
www.murrayc.com
www.openismus.com

___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: GtkAction vs. AppMenu

2009-05-23 Thread Murray Cumming
On Sat, 2009-05-23 at 18:38 +0200, Alberto Garcia wrote:
[snip]
 Toggle-like radio buttons
 are quite common too in many user interfaces.

Not that I can think of.

 For Fremantle it has been decided that the way to show radio buttons
 it to make them look like toggle buttons,

Fair enough. The Fremantle UI guidelines are out of our control,
unfortunately.

  and applications have been
 designed with that in mind (and that includes making sure that radio
 buttons and toggle buttons are not mixed in a way that can confuse the
 user).
[snip]

Well, toggle buttons that act like radio buttons is confusing. But given
that the Fremantle UI guidelines force us to have them, surely the very
existence of any real radio buttons will confuse the user, making them
even less likely to understand that these non-radio-radio-buttons
actually act like radio buttons. So I still feel that you should just
change the appearance of radio buttons and thus make both the UI and API
simpler.

Of course, I know it's too late to change any of this now, so I'm just
complaining. These kinds of mistakes are always made when development is
allowed to be done in isolation for a while, just as the initial Maemo
API had many obvious mistakes.

-- 
murr...@murrayc.com
www.murrayc.com
www.openismus.com

___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: GtkAction vs. AppMenu

2009-05-23 Thread Alberto Garcia
On Sat, May 23, 2009 at 10:36:42PM +0200, Murray Cumming wrote:

 * First, I don't think there's anything abnormal about that
   API. gtk_toggle_button_set_mode() is there exactly for that
   purpose and it's trivial to use.
 
 I think that function is widely considered to be useless and
 illogical.

Why isn't it deprecated then? I haven't found a style property to
achieve the same effect either. Have you reported a bug against Gtk to
remove it?

I personally don't think it's bad, but I don't have a very strong
opinion about it either. I'd like to see comments from upstream Gtk
developers, or from people who are already using it.

Berto
___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: GtkAction vs. AppMenu

2009-05-23 Thread Alberto Garcia
On Sat, May 23, 2009 at 10:44:50PM +0200, Murray Cumming wrote:

  Toggle-like radio buttons are quite common too in many user
  interfaces.
 Not that I can think of.

Well, I haven't made a list :) but out of the blue I can think at
least of the GIMP, Audacity, OpenOffice/MS Word/Abiword/Gnumeric,
the iPhone... and I'd swear I saw them in the Moblin 2 UI too. But I
wasn't only thinking about computer interfaces, they're used in some
home appliances too.

 Well, toggle buttons that act like radio buttons is confusing.

Not if the UI is well designed. E.g. if you pack them together and set
clear labels or icons I don't think it's confusing at all. And taking
into account that all Fremantle apps are going to be like that I don't
think there's that much room for confusion.

A standard toggle button can also be confused with a normal button for
that matter, and we're not talking about removing toggle buttons, are
we?

But let's take a more extreme example: MS Word/OpenOffice/Abiword/etc.
not only mix toggle buttons and toggle-like radio buttons, they're
also located next to one another! :)

 But given that the Fremantle UI guidelines force us to have them,
 surely the very existence of any real radio buttons will confuse
 the user, making them even less likely to understand that these
 non-radio-radio-buttons actually act like radio buttons. So I still
 feel that you should just change the appearance of radio buttons and
 thus make both the UI and API simpler.

Well, it seems clear that you don't like toggle-like radio buttons at
all.

As that's Gtk code rather than Hildon, I think that you should talk
to the maemo-gtk maintainers and also file a bug against Gtk in
bugzilla.gnome.org to deprecate gtk_toggle_button_set_mode() and make
that feature themeable.

 Of course, I know it's too late to change any of this now, so I'm
 just complaining. These kinds of mistakes are always made when
 development is allowed to be done in isolation for a while, just as
 the initial Maemo API had many obvious mistakes.

I don't think it's late. What you're complaining about is Gtk API
that has been there for at least ten years, and there's nothing that
prevents us from making all radio buttons look like toggle buttons in
Fremantle and make gtk_toggle_button_set_mode() a no-op.

So go ahead. As I said before I think it's fine as it is now but I
don't have a very strong opinion about it either. So if you convince
the maemo-gtk maintainers to change GtkRadioButton I'll respect their
decision.

Berto
___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: GtkAction vs. AppMenu

2009-05-22 Thread Cornelius Hald
On Thu, 2009-05-21 at 17:28 +0200, Alberto Garcia wrote:
 On Tue, May 19, 2009 at 05:24:47PM +0200, Cornelius Hald wrote:
 
 First of all, sorry for the delay :)

No problem at all. I really appreciate your help :)

 They are not supposed to show up, but they should work. I've just
 tested it here and it works fine. If you can send your test case I can
 take a look at it.

Well, I don't really have a test case, but rather a complete
application ;) The complete source can be found here:
https://garage.maemo.org/viewvc/trunk/conboy/src/interface.c?view=markuproot=conboypathrev=134
The menu starts around line 280. Note that Fremantle specific code is
marked with #ifdef HILDON_HAS_APP_MENU.

But so that you don't have to read through this big and ugly file, I'll
try to outline what I do with one of the actions. Casts etc. are removed
to make it less cluttered:

action = gtk_toggle_action_new(bold, Bold, NULL, GTK_STOCK_BOLD));
gtk_action_set_accel_group(action, accel_group);
gtk_action_set_accel_path(action, ACCEL_PATH_STYLE_BOLD);
gtk_accel_map_add_entry(ACCEL_PATH_STYLE_BOLD, GDK_b, GDK_CONTROL_MASK);

text_style_menu = hildon_app_menu_new();

menu_bold = gtk_button_new();
gtk_action_connect_proxy(action_bold, menu_bold);
hildon_app_menu_append(text_style_menu, menu_bold);

The result is a menu with the correct labels on the buttons and the
correct behavior - only the accelerators (here Ctrl+b) do not work.

  2) How do I get my GtkRadioActions to work with the HildonAppMenu? I
  created the the buttons with gtk_radio_button_new() and then used
  gtk_action_connect_proxy() like with the normal GtkActions above.
  The problem is that now all of the radio buttons are selected active
  at the same time.
 
 Try using gtk_radio_button_new_from_widget () to create all buttons
 after the first one.

I'll tried in three different ways with different outcomes.
Unfortunately non of them was good :(

First, my GtkRadioActions are set up like this:

a1 = gtk_radio_action_new(size:small,  Small),  NULL, NULL, 0);
a2 = gtk_radio_action_new(size:normal, Normal), NULL, NULL, 1);
a3 = gtk_radio_action_new(size:large,  Large),  NULL, NULL, 2);

gtk_radio_action_set_group(a1, action_group);
action_group = gtk_radio_action_get_group(a1);

gtk_radio_action_set_group(a2, action_group);
action_group = gtk_radio_action_get_group(a2);

gtk_radio_action_set_group(a3, action_group);
action_group = gtk_radio_action_get_group(a3);

gtk_radio_action_set_current_value(a2, 1);

Now we come to the part, where I create the buttons. I tried these three
different ways:

/* Correctly shown, but not reacting on
gtk_radio_action_set_current_value() */
but1 = gtk_radio_button_new(NULL);
but2 = gtk_radio_button_new_from_widget(but1);
but3 = gtk_radio_button_new_from_widget(but1);

/* All shown as active */
but1 = gtk_radio_button_new(NULL);
but2 = gtk_radio_button_new(NULL);
but3 = gtk_radio_button_new(NULL);

/* Same effect as with NULL /*
but1 = gtk_radio_button_new(action_group);
but2 = gtk_radio_button_new(action_group);
but3 = gtk_radio_button_new(action_group);

Then I simply connect the buttons with the actions

gtk_action_connect_proxy(a1, but1);
gtk_action_connect_proxy(a2, but2);
gtk_action_connect_proxy(a3, but3);


In all cases the label text is correctly taken from the actions, so I
would say there is a connection somehow. I couldn't find examples for
using GtkRadioAction with GtkRadioButton and gtk_action_connect_proxy()
on the net, so it would really help me if you would take the time to
look into it again :)

Thanks!
Conny



___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: GtkAction vs. AppMenu

2009-05-22 Thread Cornelius Hald
On Fri, 2009-05-22 at 16:00 +0200, Alberto Garcia wrote:
 On Fri, May 22, 2009 at 03:24:01PM +0200, Cornelius Hald wrote:
 Try also this:
 
 gtk_window_add_accel_group (window, accel);

I have this, it was only not included in my mail.

 Look at the correction I sent in a subsequent e-mail: try using
 gtk_toggle_button_new() instead of gtk_radio_button_*()

Ah sorry, I was reading your correction wrong. I was reading radio
instead of toggle.

So now I tried it with gtk_toggle_button_new() and with
gtk_radio_button_new() and the result is the same only the graphical
representation is different.

Then I started again the Diablo version just to notice that the behavior
is the same there... Arrg it looks like at some point I completely
f***ed up my event handling...

So it seems like the solution was already in your post from yesterday.
I'll check my code and then report back here.

I'm sorry if I have caused you unnecessary work. Thanks again!
Conny


___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: GtkAction vs. AppMenu

2009-05-22 Thread Cornelius Hald
On Fri, 2009-05-22 at 16:20 +0200, Cornelius Hald wrote:
 So it seems like the solution was already in your post from yesterday.
 I'll check my code and then report back here.

Good, I checked again. I had a small bug which prevented the radio
buttons to select the normal entry, but the rest was still working.

The result now is:
- gtk_toggle_button_new() is working but it displays the buttons as
toggle buttons not as radio buttons.
- Everything else what I tried is not working.

Here are two screenshots to show the difference.

RadioButtons:
http://zwong.de/wp-content/uploads/2009/05/conboy_new_style_menu.png

ToggleButtons:
http://zwong.de/wp-content/uploads/2009/05/toggle_buttons.png

The thing is, that semantically those buttons should really be radio
buttons not toggle buttons, so if anyone has more suggestions please
write them. If not I'll shut up for now. Hmm... and there is still this
accelerator thing... ;)



___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: GtkAction vs. AppMenu

2009-05-22 Thread Alberto Garcia
On Fri, May 22, 2009 at 05:08:08PM +0200, Cornelius Hald wrote:

 The result now is:
 - gtk_toggle_button_new() is working but it displays the buttons as
 toggle buttons not as radio buttons.

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);

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).

Berto

#includehildon/hildon.h

static void
radio_action_changed(GtkAction *action,
 GtkAction *current)
{
g_debug (Radio action changed: %s, gtk_action_get_name (current));
}

static void
action_activated(GtkAction *action)
{
g_debug (Button clicked: %s, gtk_action_get_name (action));
}

static GtkAction *
create_action   (const gchar *name,
 const gchar *accel,
 GtkActionGroup *actiongroup,
 GtkAccelGroup *accelgroup)
{
GtkAction *action = gtk_action_new (name, name, NULL, NULL);
gtk_action_group_add_action_with_accel (actiongroup, action, accel);
gtk_action_set_accel_group (action, accelgroup);
gtk_action_connect_accelerator (action);
g_signal_connect (action, activate, G_CALLBACK (action_activated), NULL);
return action;
}

static GtkButton *
create_item (GtkAction *action)
{
HildonSizeType buttonsize = HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH;
GtkWidget *button = hildon_gtk_button_new (buttonsize);
gtk_action_connect_proxy (action, button);
return GTK_BUTTON (button);
}

static GtkRadioAction *
create_radio_action (const gchar *name,
 GtkRadioAction *previous)
{
static gint count = 0;
GtkRadioAction *action = gtk_radio_action_new (name, name, NULL, NULL, count++);
if (previous) {
gtk_radio_action_set_group (action, gtk_radio_action_get_group (previous));
}
return action;
}

static GtkButton *
create_radio_item   (GtkRadioAction *action)
{
static GSList *group = NULL;
HildonSizeType buttonsize = HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH;
GtkWidget *button = hildon_gtk_radio_button_new (buttonsize, group);
group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
gtk_action_connect_proxy (GTK_ACTION (action), button);
return GTK_BUTTON (button);
}

static HildonAppMenu *
create_menu (GtkAccelGroup *accel)
{
HildonAppMenu *menu = HILDON_APP_MENU (hildon_app_menu_new ());
GtkActionGroup *group = gtk_action_group_new (actiongroup);
GtkAction *action;
GtkRadioAction *radioaction;

/* Items */
action = create_action (Action one, Ctrl1, group, accel);
hildon_app_menu_append (menu, create_item (action));

action = create_action (Action two, Ctrl2, group, accel);
hildon_app_menu_append (menu, create_item (action));

action = create_action (Action three, Ctrl3, group, accel);
hildon_app_menu_append (menu, create_item (action));

action = create_action (Action four, Ctrl4, group, accel);
hildon_app_menu_append (menu, create_item (action));

/* Filters */
radioaction = create_radio_action (Radio one, NULL);
g_signal_connect (radioaction, changed, G_CALLBACK (radio_action_changed), NULL);
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (radioaction), TRUE);
hildon_app_menu_add_filter (menu, create_radio_item (radioaction));

radioaction = create_radio_action (Radio two, radioaction);
hildon_app_menu_add_filter (menu, create_radio_item (radioaction));

radioaction = create_radio_action (Radio three, radioaction);
hildon_app_menu_add_filter (menu, create_radio_item (radioaction));

gtk_widget_show_all (GTK_WIDGET (menu));

return menu;
}

int
main(int argc,
 char **argv)
{
GtkWidget *win;
GtkWidget *label;
HildonAppMenu *menu;
GtkAccelGroup *accel;

hildon_gtk_init (argc, argv);

label = gtk_label_new (This is an example of the\nHildonAppMenu widget.\n\n
   Click on the titlebar\nto pop up the menu.);
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_CENTER);

win = hildon_stackable_window_new ();

accel = gtk_accel_group_new ();
menu = create_menu (accel);
hildon_window_set_app_menu (HILDON_WINDOW (win), menu);

gtk_window_add_accel_group (GTK_WINDOW (win), 

Re: GtkAction vs. AppMenu

2009-05-22 Thread Murray Cumming
On Fri, 2009-05-22 at 19:00 +0200, Alberto Garcia wrote:
 On Fri, May 22, 2009 at 05:08:08PM +0200, Cornelius Hald wrote:
 
  The result now is:
  - gtk_toggle_button_new() is working but it displays the buttons as
  toggle buttons not as radio buttons.
 
 Well, that's what looks better in the Fremantle UI style.

Yes, the Hildon HIG seems to suggest this, though it's very vague due to
the non-native-speaker English and the lack of screenshots (I filed bugs
about that already):
http://maemo.org/api_refs/5.0/beta/hig/html/ch06s08.html

However, if radio buttons are meant to look a certain way in Maemo, why
isn't that just a matter of theming or even of making a change in the
GTK+ code instead of asking people to use the GTK+ API in an abnormal
way?

 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);
 
 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).
 
 Berto
 ___
 maemo-developers mailing list
 maemo-developers@maemo.org
 https://lists.maemo.org/mailman/listinfo/maemo-developers
-- 
murr...@murrayc.com
www.murrayc.com
www.openismus.com

___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: GtkAction vs. AppMenu

2009-05-21 Thread Alberto Garcia
On Tue, May 19, 2009 at 05:24:47PM +0200, Cornelius Hald wrote:

First of all, sorry for the delay :)

 1) The accelerators of my actions don't show up on the menu
 buttons and they don't work. What do I have to do to get them
 back? If I create an old school GtkMenuItem out of my GtkAction the
 accelerators are working fine.

They are not supposed to show up, but they should work. I've just
tested it here and it works fine. If you can send your test case I can
take a look at it.

 2) How do I get my GtkRadioActions to work with the HildonAppMenu? I
 created the the buttons with gtk_radio_button_new() and then used
 gtk_action_connect_proxy() like with the normal GtkActions above.
 The problem is that now all of the radio buttons are selected active
 at the same time.

Try using gtk_radio_button_new_from_widget () to create all buttons
after the first one.

Berto
___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: GtkAction vs. AppMenu

2009-05-21 Thread Alberto Garcia
On Thu, May 21, 2009 at 05:28:35PM +0200, Alberto Garcia wrote:

Correction:

  2) How do I get my GtkRadioActions to work with
  the HildonAppMenu? I created the the buttons with
  gtk_radio_button_new()

Well, actually in this case you should probably use
gtk_toggle_button_new() instead (GtkRadioAction will make sure that
only one is enabled).

Berto
___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: GtkAction vs. AppMenu

2009-05-19 Thread Cornelius Hald
On Wed, 2009-04-29 at 20:19 +0200, Alberto Garcia wrote:
 On Wed, Apr 29, 2009 at 07:37:03PM +0200, Cornelius Hald wrote:
 
  Or is it possible to create a GtkButton out of a GtkAction?
 
 Try this:
 
 button = gtk_button_new ();
 gtk_action_connect_proxy (action, button);

Thanks again for your answer it worked very well and I have now a nice
HildonAppMenu containing buttons which were created like you wrote.

I have only two more problems related with that. Hopefully you can help
me there too:

1) The accelerators of my actions don't show up on the menu buttons and
they don't work. What do I have to do to get them back? If I create an
old school GtkMenuItem out of my GtkAction the accelerators are working
fine.

2) How do I get my GtkRadioActions to work with the HildonAppMenu? I
created the the buttons with gtk_radio_button_new() and then used
gtk_action_connect_proxy() like with the normal GtkActions above.
The problem is that now all of the radio buttons are selected active at
the same time.

A screenshot of how the menu looks atm can be found here:
http://zwong.de/wp-content/uploads/2009/05/conboy_new_style_menu.png


Thanks for your time!
Conny

___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


GtkAction vs. AppMenu

2009-04-29 Thread Cornelius Hald
Hi,

last week I just changed my UI code to use GtkAction instead of directly
using GtkMenuItem and GtkToolItem. This brought me several advantages
and cleaner code.

Now I tried the new HildonAppMenu and it looks like it's no longer
possible to use GtkAction with it. The HildonAppMenu expect the menu
items to be GtkButtons, but GtkAction can only create GtkMenuItems and
GtkToolButtons which both don't inherit GtkButton :(

Does anyone have a better idea then to rewrite this code again? Maybe it
is somehow possible to convert a GtkToolButton into a normal GtkButton?
Or is it possible to create a GtkButton out of a GtkAction?

Someone must have seen this use case while designing the new API!?

Thanks!
Conny


___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: GtkAction vs. AppMenu

2009-04-29 Thread Alberto Garcia
On Wed, Apr 29, 2009 at 07:37:03PM +0200, Cornelius Hald wrote:

 Or is it possible to create a GtkButton out of a GtkAction?

Try this:

button = gtk_button_new ();
gtk_action_connect_proxy (action, button);

Berto
___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: GtkAction vs. AppMenu

2009-04-29 Thread Cornelius Hald
Hi Berto,

On Wed, 2009-04-29 at 20:19 +0200, Alberto Garcia wrote:
 On Wed, Apr 29, 2009 at 07:37:03PM +0200, Cornelius Hald wrote:
 
  Or is it possible to create a GtkButton out of a GtkAction?
 
 Try this:
 
 button = gtk_button_new ();
 gtk_action_connect_proxy (action, button);

I think you just saved my day :) Sounds very good and I'll try tomorrow!

Thanks very much!
Conny


___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers