After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 341723 - [PATCH] Support gtk.ToggleAction and gtk.RadioAction
[PATCH] Support gtk.ToggleAction and gtk.RadioAction
Status: RESOLVED WONTFIX
Product: Gazpacho
Classification: Deprecated
Component: widget support
SVN trunk
Other All
: Normal normal
: ---
Assigned To: Gazpacho Maintainer(s)
Gazpacho Maintainer(s)
gnome[unmaintained]
Depends on:
Blocks: 338089
 
 
Reported: 2006-05-14 10:59 UTC by Michael Gratton
Modified: 2011-02-04 04:08 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
initial patch (15.27 KB, patch)
2006-05-14 11:03 UTC, Michael Gratton
none Details | Review
updated patch with UI improvements and loading/saving support (22.87 KB, patch)
2006-06-01 14:46 UTC, Michael Gratton
needs-work Details | Review
Fixed to use filewriter for writing actions (21.06 KB, patch)
2006-06-01 16:05 UTC, Michael Gratton
none Details | Review

Description Michael Gratton 2006-05-14 10:59:57 UTC
Please describe the problem:
Gazpacho does not support adding ToggleActions and RadioActions, so it is not
possible to use those as menu items or toolbars.

Steps to reproduce:


Actual results:


Expected results:


Does this happen every time?


Other information:
Comment 1 Michael Gratton 2006-05-14 11:03:52 UTC
Created attachment 65425 [details] [review]
initial patch

Initial patch, needs some work still:
- remove code duplication in subclasses of GAction
- add support and UI for additional ToggleAction and RadioAction properties
- cleanup the Gazpacho toolbar/menu UI for adding the different actions (i.e. don't have three "Add" buttons/menu items in a row).
Comment 2 Michael Gratton 2006-05-14 11:05:35 UTC
Looking for comments on the way I have started to implement this...
Comment 3 Mattias Karlsson 2006-05-14 23:14:28 UTC
This sounds great. I haven't got time to look at the code right now (I'll see if I can find some time later this week, please remind me if I forget). 

About adding the actions. It would probably be best to reuse the same dialog for the different actions? Just add a combobox for selecting the type of action you want to create and make sure the content of the dialog reflects the chosen action type. It should probably not be possible to change the action type after the action have been created.

cheers
Comment 4 Mattias Karlsson 2006-05-23 20:17:12 UTC
I've taken a (quick) look at the code now and it seems to me that you're on the right track. As you mentioned earlier, there are a few things left to do but it's a good start. The action tree view should probably be modified a bit to make it possible to see the action types. And if you have time to write a couple unit tests to verify that the code is correct that would be greatly appreciated. :)
Comment 5 Michael Gratton 2006-06-01 14:46:45 UTC
Created attachment 66601 [details] [review]
updated patch with UI improvements and loading/saving support

Still not complete, but a good step down that road...

This one adds UI for setting Toggle and Radio action properties (although setting the radio group is broken) and removes the additional "New Blah Action" buttons/menu items - the New/Edit Action dialog now has a combo to select the action type (not sensitive when editing an action) and the UI for the additional properties is shown/hidden as appropriate. This makes GActionDialog's internals kinda ugly, but I don't see any good way of avoiding this.

Radio and toggle properties are getting saved/loaded as well, so the TODO is now:
- remove code duplication in subclasses of GAction
- make setting radio group work
- write some unit tests (of course :)
Comment 6 Johan (not receiving bugmail) Dahlin 2006-06-01 14:54:51 UTC
Comment on attachment 66601 [details] [review]
updated patch with UI improvements and loading/saving support

Some general comments:
* You're still repeating code in actioneditor, the toggle and radio handling should be refactored methods.
* I recently migrated all  xml writing code to xmlwriter, you need to remove the code from your copy, GAction.write() is no longer called for instance.
Comment 7 Michael Gratton 2006-06-01 16:05:42 UTC
Created attachment 66606 [details] [review]
Fixed to use filewriter for writing actions

Ah, thanks for pointing that out Johan, I didn't test saving after updating from svn. Whoops.

I'm not sure what you mean about duplicated code in actioneditor, however. Are you talking about in _load_widgets, et al? Eg, adding methods like _load_radio_widgets for each of those?
Comment 8 Michael Gratton 2006-06-01 16:07:32 UTC
About the action tree view, I'll look at doing that next.

For toggles, I could just append the text " (Toggle)" after the id, or use an
icon or similar. Either that or add an additional column to the view, but that
seems like overkill.

For radio actions, it would be good to show the groups in the tree, something
like:

ActionGroup
 |- Action
 |- Action
 \- Radio Group
     |- Radio Action
     \- Radio Action

From the user's perspective, it would be nice if the groups had a name that
they could specify, but the groups are just a list, so that would not be
possible. Maybe Gazpacho should just generate the names for radio groups on the
fly (something like "Radio Group n"), which would be displayed in the action
tree and in GActionDialog when selecting a group.
Comment 9 Johan (not receiving bugmail) Dahlin 2006-06-05 03:06:45 UTC
Mike: code looks better now.
The UI modifications are looking quite good too, but I have a couple of
suggestions that would make it even better:

 - draw-as-radio is not very useful, I can't really see a use case when you want
   a toggle drawn as a radio button or a radio not drawn as a radio. 
   I think this is mostly an internal property which shouldn't be messed with.
 - value makes sense for toggle actions as well, right?
 - mark the group in radio as insensitive if there are no other radio actions 
 - it's unfortunate that the interface resizes when you switch action, is  
   it possible to avoid that?

Can you add some tests too, modify test/glade/uimanager.glade to include at least one radio and one toggle action.
Comment 10 John Steele Scott (ttec) 2007-08-21 01:14:40 UTC
I would like to see ToggleAction support in Gazpacho. Currently I have to patch my glade file after every edit, because Gazpacho 0.7.1 replaces my GtkToggleAction with a regular GtkAction. :(
Comment 11 Akhil Laddha 2011-02-04 04:08:02 UTC
Gazpacho development has been stalled and it has been unmaintained for a few years now. Maintainers don't have future development plan so i am closing the bugs as WONTFIX. Please feel free to reopen the bugs in future if anyone takes the responsibility for active development.