[perl-Glib-Object-Introspection] perli11ndoc: make Right/Left expand/collapse rows in the tree view



commit e4a295d83f25d860bbe4efcdca2c710630882e2f
Author: Torsten Schönfeld <kaffeetisch gmx de>
Date:   Tue Sep 8 12:09:28 2015 +0200

    perli11ndoc: make Right/Left expand/collapse rows in the tree view

 bin/perli11ndoc |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/bin/perli11ndoc b/bin/perli11ndoc
index e8a89a5..6abc13c 100755
--- a/bin/perli11ndoc
+++ b/bin/perli11ndoc
@@ -1310,6 +1310,26 @@ sub setup_gir_view {
     Gtk3::CellRendererText->new,
     text => GIR_VIEW_COL_TEXT);
   $gir_view->set_headers_visible (FALSE);
+
+  $gir_view->signal_connect (key_press_event => sub {
+    my (undef, $event) = @_;
+    if ($event->keyval == Gtk3::Gdk::KEY_Left () ||
+        $event->keyval == Gtk3::Gdk::KEY_Right ()) {
+      my $selection = $gir_view->get_selection;
+      my ($model, $iter) = $selection->get_selected;
+      if (defined $iter) {
+        my $path = $model->get_path ($iter);
+        if ($event->keyval == Gtk3::Gdk::KEY_Left ()) {
+          $gir_view->collapse_row ($path);
+        } else {
+          $gir_view->expand_row ($path, FALSE);
+        }
+      }
+      return Gtk3::EVENT_STOP ();
+    }
+    return Gtk3::EVENT_PROPAGATE ();
+  });
+
   $gir_view->get_selection->signal_connect (changed => sub {
     $self->update_result_view unless $self->{suppress_gir_view_selection_changes};
   });


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]