[Xfce4-commits] <design:master> Grab the focus when selecting a row with the mouse.

Jannis Pohlmann noreply at xfce.org
Tue May 31 23:10:01 CEST 2011


Updating branch refs/heads/master
         to c728aa617e446866d1bfb93759c68df6e6ea3cb3 (commit)
       from 0ddb473a55eb4d19b66fc28ceebb44b5a36b4073 (commit)

commit c728aa617e446866d1bfb93759c68df6e6ea3cb3
Author: Jannis Pohlmann <jannis at xfce.org>
Date:   Tue May 31 23:09:21 2011 +0200

    Grab the focus when selecting a row with the mouse.

 .../demo-code/custom-view/shortcut-row.vala        |    1 +
 .../demo-code/custom-view/shortcuts-view.vala      |   14 +++++---------
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/thunar/shortcuts-pane/demo-code/custom-view/shortcut-row.vala b/thunar/shortcuts-pane/demo-code/custom-view/shortcut-row.vala
index 1e4bce0..3e0a2f2 100644
--- a/thunar/shortcuts-pane/demo-code/custom-view/shortcut-row.vala
+++ b/thunar/shortcuts-pane/demo-code/custom-view/shortcut-row.vala
@@ -208,6 +208,7 @@ public class ShortcutRow : EventBox {
       }
     } else {
       set_state (StateType.SELECTED);
+      grab_focus ();
     }
     return true;
   }
diff --git a/thunar/shortcuts-pane/demo-code/custom-view/shortcuts-view.vala b/thunar/shortcuts-pane/demo-code/custom-view/shortcuts-view.vala
index a324a46..c934a2a 100644
--- a/thunar/shortcuts-pane/demo-code/custom-view/shortcuts-view.vala
+++ b/thunar/shortcuts-pane/demo-code/custom-view/shortcuts-view.vala
@@ -49,6 +49,7 @@ public class Shortcut : GLib.Object {
 public class ShortcutsView : EventBox {
   private Alignment alignment { get; set; }
   private VBox box { get; set; }
+  private unowned List<Expander> expanders { get; set; }
 
   public ShortcutsView () {
     alignment = new Alignment (0.0f, 0.0f, 1.0f, 1.0f);
@@ -79,6 +80,8 @@ public class ShortcutsView : EventBox {
     shortcuts.append (new Shortcut ("sftp at xfce.org", "folder-remote", true));
     shortcuts.append (new Shortcut ("ftp at gezeiten.org", "folder-remote", false));
 
+    expanders = new List<Expander> ();
+
     Container? container = null;
     foreach (var item in shortcuts) {
       if (item is Category) {
@@ -96,6 +99,8 @@ public class ShortcutsView : EventBox {
         container = new VBox (false, 0);
         expander.add (container);
         container.show ();
+
+        expanders.append (expander);
       } else {
         Shortcut shortcut = (Shortcut) item;
         var row = new ShortcutRow (shortcut.name, shortcut.icon_name, shortcut.connected);
@@ -106,13 +111,4 @@ public class ShortcutsView : EventBox {
 
     show_all ();
   }
-
-  public Widget? get_selected_row () {
-    foreach (var child in get_children ()) {
-      if ((child.state & StateType.SELECTED) != 0) {
-        return child;
-      }
-    }
-    return null;
-  }
 }



More information about the Xfce4-commits mailing list