[Xfce4-commits] <thunar:jannis/new-shortcuts-pane> Make sure that now two rows are prelighted at the same time.

Jannis Pohlmann noreply at xfce.org
Fri Jul 15 21:10:22 CEST 2011


Updating branch refs/heads/jannis/new-shortcuts-pane
         to d5529c999db4d3c596696aa0ae8b90eee9bbda6c (commit)
       from 67efe79080132b16f97de8d42728cc56145e5ec1 (commit)

commit d5529c999db4d3c596696aa0ae8b90eee9bbda6c
Author: Jannis Pohlmann <jannis at xfce.org>
Date:   Tue Jun 7 14:34:34 2011 +0200

    Make sure that now two rows are prelighted at the same time.

 thunar/thunar-shortcuts-view.c |   32 +++++++++++++++++++++++++++++++-
 1 files changed, 31 insertions(+), 1 deletions(-)

diff --git a/thunar/thunar-shortcuts-view.c b/thunar/thunar-shortcuts-view.c
index 8a35a0e..acd901f 100644
--- a/thunar/thunar-shortcuts-view.c
+++ b/thunar/thunar-shortcuts-view.c
@@ -105,6 +105,9 @@ static void       thunar_shortcuts_view_foreach_row              (ThunarShortcut
 static void       thunar_shortcuts_view_unselect_rows            (ThunarShortcutsView              *view,
                                                                   ThunarShortcutRow                *row,
                                                                   gpointer                          user_data);
+static void       thunar_shortcuts_view_unprelight_rows          (ThunarShortcutsView              *view,
+                                                                  ThunarShortcutRow                *row,
+                                                                  gpointer                          user_data);
 static void       thunar_shortcuts_view_update_selection_by_file (ThunarShortcutsView              *view,
                                                                   ThunarShortcutRow                *row,
                                                                   gpointer                          user_data);
@@ -482,12 +485,18 @@ thunar_shortcuts_view_row_state_changed (ThunarShortcutsView *view,
   _thunar_return_if_fail (THUNAR_IS_SHORTCUTS_VIEW (view));
   _thunar_return_if_fail (THUNAR_IS_SHORTCUT_ROW (row));
 
-  /* check if the row has been selected */
+  /* check if the row has been selected or highlighted */
   if (gtk_widget_get_state (GTK_WIDGET (row)) == GTK_STATE_SELECTED)
     {
       /* unselect all other rows */
       thunar_shortcuts_view_foreach_row (view, thunar_shortcuts_view_unselect_rows, row);
     }
+  else if (gtk_widget_get_state (GTK_WIDGET (row)) == GTK_STATE_PRELIGHT)
+    {
+      /* unprelight all other rows */
+      thunar_shortcuts_view_foreach_row (view, thunar_shortcuts_view_unprelight_rows,
+                                         row);
+    }
 }
 
 
@@ -557,6 +566,27 @@ thunar_shortcuts_view_unselect_rows (ThunarShortcutsView *view,
 
 
 static void
+thunar_shortcuts_view_unprelight_rows (ThunarShortcutsView *view,
+                                       ThunarShortcutRow   *row,
+                                       gpointer             user_data)
+{
+  ThunarShortcutRow *selected_row = THUNAR_SHORTCUT_ROW (user_data);
+
+  _thunar_return_if_fail (THUNAR_IS_SHORTCUTS_VIEW (view));
+  _thunar_return_if_fail (THUNAR_IS_SHORTCUT_ROW (row));
+  _thunar_return_if_fail (THUNAR_IS_SHORTCUT_ROW (selected_row));
+
+  /* reset the row state if it is not the selected row */
+  if (row != selected_row && 
+      gtk_widget_get_state (GTK_WIDGET (row)) == GTK_STATE_PRELIGHT)
+    {
+      gtk_widget_set_state (GTK_WIDGET (row), GTK_STATE_NORMAL);
+    }
+}
+
+
+
+static void
 thunar_shortcuts_view_update_selection_by_file (ThunarShortcutsView *view,
                                                 ThunarShortcutRow   *row,
                                                 gpointer             user_data)



More information about the Xfce4-commits mailing list