diff options
author | Chris Toshok <toshok@novell.com> | 2008-12-11 07:17:44 +0300 |
---|---|---|
committer | Chris Toshok <toshok@novell.com> | 2008-12-11 07:17:44 +0300 |
commit | 00d4c6bacd9b0be2e2ab89f7015c4b3caeb1e572 (patch) | |
tree | b88ecca4854f7e5cfefb915de3b04a259b6c60ca /gui-compare | |
parent | 93aead166936d30ed6804f3799c6abcb66ae94cf (diff) |
make <space> toggle the expanded/collapsed state of tree nodes. i miss my mouse.
svn path=/trunk/mono-tools/; revision=121274
Diffstat (limited to 'gui-compare')
-rw-r--r-- | gui-compare/MainWindow.cs | 14 | ||||
-rw-r--r-- | gui-compare/gtk-gui/MainWindow.cs | 8 | ||||
-rw-r--r-- | gui-compare/gtk-gui/gui.stetic | 9 |
3 files changed, 30 insertions, 1 deletions
diff --git a/gui-compare/MainWindow.cs b/gui-compare/MainWindow.cs index 0acd0168..7bdc3f5f 100644 --- a/gui-compare/MainWindow.cs +++ b/gui-compare/MainWindow.cs @@ -555,4 +555,18 @@ public partial class MainWindow: Gtk.Window cc.Destroy (); } + + protected virtual void OnToggleRowExpansion (object sender, System.EventArgs e) + { + Gtk.TreeIter iter; + if (tree.Selection.GetSelected (out iter)) { + Gtk.TreePath path = tree.Model.GetPath(iter); + if (path != null) { + if (tree.GetRowExpanded (path)) + tree.CollapseRow (path); + else + tree.ExpandRow (path, false); + } + } + } } diff --git a/gui-compare/gtk-gui/MainWindow.cs b/gui-compare/gtk-gui/MainWindow.cs index 7584ec99..48efaba4 100644 --- a/gui-compare/gtk-gui/MainWindow.cs +++ b/gui-compare/gtk-gui/MainWindow.cs @@ -42,6 +42,8 @@ public partial class MainWindow { private Gtk.ToggleAction ShowNotImplemented; + private Gtk.Action ToggleRowExpansionAction; + private Gtk.VBox vbox1; private Gtk.MenuBar menubar1; @@ -120,6 +122,9 @@ public partial class MainWindow { this.ShowNotImplemented.Active = true; this.ShowNotImplemented.ShortLabel = Mono.Unix.Catalog.GetString("Show NotImplemented"); w2.Add(this.ShowNotImplemented, null); + this.ToggleRowExpansionAction = new Gtk.Action("ToggleRowExpansionAction", Mono.Unix.Catalog.GetString("Toggle Row Expansion"), null, null); + this.ToggleRowExpansionAction.ShortLabel = Mono.Unix.Catalog.GetString("Toggle Row Expansion"); + w2.Add(this.ToggleRowExpansionAction, "<Mod2>space"); w1.InsertActionGroup(w2, 0); this.AddAccelGroup(w1.AccelGroup); this.Name = "MainWindow"; @@ -130,7 +135,7 @@ public partial class MainWindow { this.vbox1.Name = "vbox1"; this.vbox1.Spacing = 6; // Container child vbox1.Gtk.Box+BoxChild - w1.AddUiFromString("<ui><menubar name='menubar1'><menu action='File'><menu action='RecentComparisons'/><separator/><menuitem action='Refresh'/><separator/><menuitem action='quit'/></menu><menu action='Compare'><menuitem action='Custom'/></menu><menu action='View'><menuitem action='ShowErrors'/><menuitem action='ShowMissing'/><menuitem action='ShowNotImplemented'/><menuitem action='ShowExtra'/><menuitem action='ShowTodo'/><menuitem action='ShowPresent'/></menu></menubar></ui>"); + w1.AddUiFromString("<ui><menubar name='menubar1'><menu action='File'><menu action='RecentComparisons'/><separator/><menuitem action='Refresh'/><separator/><menuitem action='quit'/></menu><menu action='Compare'><menuitem action='Custom'/></menu><menu action='View'><menuitem action='ShowErrors'/><menuitem action='ShowMissing'/><menuitem action='ShowNotImplemented'/><menuitem action='ShowExtra'/><menuitem action='ShowTodo'/><menuitem action='ShowPresent'/><separator/><menuitem action='ToggleRowExpansionAction'/></menu></menubar></ui>"); this.menubar1 = ((Gtk.MenuBar)(w1.GetWidget("/menubar1"))); this.menubar1.Name = "menubar1"; this.vbox1.Add(this.menubar1); @@ -227,5 +232,6 @@ public partial class MainWindow { this.Refresh.Activated += new System.EventHandler(this.OnRefreshActivated); this.ShowTodo.Toggled += new System.EventHandler(this.OnShowTodoToggled); this.ShowNotImplemented.Toggled += new System.EventHandler(this.OnShowNotImplementedToggled); + this.ToggleRowExpansionAction.Activated += new System.EventHandler(this.OnToggleRowExpansion); } } diff --git a/gui-compare/gtk-gui/gui.stetic b/gui-compare/gtk-gui/gui.stetic index bc267f2c..31cab4c3 100644 --- a/gui-compare/gtk-gui/gui.stetic +++ b/gui-compare/gtk-gui/gui.stetic @@ -108,6 +108,13 @@ <property name="Active">True</property> <signal name="Toggled" handler="OnShowNotImplementedToggled" /> </action> + <action id="ToggleRowExpansionAction"> + <property name="Type">Action</property> + <property name="Accelerator"><Mod2>space</property> + <property name="Label" translatable="yes">Toggle Row Expansion</property> + <property name="ShortLabel" translatable="yes">Toggle Row Expansion</property> + <signal name="Activated" handler="OnToggleRowExpansion" /> + </action> </action-group> <property name="MemberName" /> <property name="Title" translatable="yes">MainWindow</property> @@ -138,6 +145,8 @@ <node type="Menuitem" action="ShowExtra" /> <node type="Menuitem" action="ShowTodo" /> <node type="Menuitem" action="ShowPresent" /> + <node type="Separator" /> + <node type="Menuitem" action="ToggleRowExpansionAction" /> </node> </node> </widget> |