gEDA-dev: Button ordering
Carlos Nieves Ónega
cnieves.mail at gmail.com
Wed Sep 13 14:02:09 EDT 2006
Hi all,
as discussed previously, the button order can be changed on the fly
using a GTK function. See:
http://developer.gnome.org/doc/API/2.0/gtk/GtkSettings.html#GtkSettings--gtk-alternative-button-order
It's a GTK function, so it doesn't depends on GNOME, but it was included
in 2.6 for the first time.
The requisites for getting this working are:
- we must define a default button ordering. For me, the default order
is "cancel, ok", but it depends on the system you are using. As the
automatic button reordering is there since GTK version 2.6, we must
define the button ordering for previous GTK versions. Can we use this
default ordering as well, or use the alternate "ok, cancel" (current
geda button order)?
- after creating a dialog, we call the function above (only if GTK
version >= 2.6), and the button order is changed automatically if the
GTK property "gtk-alternative-button-order" is TRUE.
I'd like to get some feedback to confirm this solution works for
everyone. So I attach one test program (test.c) which can be compiled
typing:
gcc -Wall -g test.c -o test `pkg-config --cflags gtk+-2.0` `pkg-config
--libs gtk+-2.0`
and then executed: ./test
The defined button order are:
Default: Help, Cancel, OK.
Alternate (GTK >= 2.6 only): Ok, Cancel, Help.
I'd like to get some report (specially for non Linux machines) including
the OS, GTK version (can someone test it with GTK version < 2.6?),
window environment (gnome, kde, mac, windows,...), button order
displayed by the test program, and button order of other native programs
(to see if they are the same).
Thanks,
Carlos
El lun, 11-09-2006 a las 10:51 +0100, Peter Clifton escribió:
> On Sun, 2006-09-10 at 22:58 -0400, Ales Hvezda wrote:
> > Hi Carlos,
> >
> > >A while ago, I spent some time looking for an automatic way to do it
> > >(GTK, or whatever), but I found nothing. Now I looked for it again and I
> > >found it:
> > >http://developer.gnome.org/doc/API/2.0/gtk/GtkSettings.html#GtkSettings--gtk-a
> > >lternative-button-order
> > >
> > >so it can be done. I filled bug #1553483.
> >
> > Interesting. I wouldn't be opposed to this, as long as:
> >
> > 1) it doesn't drag in any gconf, registry thingy, or any additional
> > hidden gnome dependancy.
> >
> > and
> >
> > 2) It doesn't create/require yet another config file.
>
> >From example at
> http://developer.gnome.org/doc/API/2.0/gtk/GtkDialog.html#gtk-dialog-set-alternative-button-order
> (Blank lines removed)
>
> "
> cancel_button = gtk_dialog_add_button (GTK_DIALOG (dialog),
> GTK_STOCK_CANCEL,
> GTK_RESPONSE_CANCEL); ok_button
> = gtk_dialog_add_button (GTK_DIALOG (dialog),
> GTK_STOCK_OK,
> GTK_RESPONSE_OK);
> gtk_widget_grab_default (ok_button); help_button =
> gtk_dialog_add_button (GTK_DIALOG (dialog),
> GTK_STOCK_HELP,
> GTK_RESPONSE_HELP);
> gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
> GTK_RESPONSE_OK,
> GTK_RESPONSE_CANCEL,
> GTK_RESPONSE_HELP,
> -1);
>
> Looks like we set the button order in the default "HIG" ordering, and
> then specify an alternate ordering which is used if the
> "gtk-alternative-button-order" property is set.
>
> There is a default GtkSettings object, and presumably, the
> "gtk-alternative-button-order" property is set in that depending on
> what platform the app is running under. (Or parsed from the gtkrc)
>
>
> This doesn't cover all eventualities well in my opinion, as it doesn't
> say which OS you're defining the alterernate ordering for.
>
> Do we assume that all dialogs should eventually be moved to the Gnome
> HIG ordering, with alternate ordering set to be the reverse (current)
> behaviour? We might then get the old behaviour back by simply
> over-writing the "gtk-alternative-button-order" property.
>
>
> Regards
>
> Peter Clifton
>
>
>
>
> _______________________________________________
> geda-dev mailing list
> geda-dev at moria.seul.org
> http://www.seul.org/cgi-bin/mailman/listinfo/geda-dev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.c
Type: text/x-csrc
Size: 2096 bytes
Desc: not available
Url : http://www.seul.org/pipermail/geda-dev/attachments/20060913/8b9cc7ca/test.c
More information about the geda-dev
mailing list