[nautilus] sidebar: don't allow selecting headers
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] sidebar: don't allow selecting headers
- Date: Thu, 26 Aug 2010 14:12:41 +0000 (UTC)
commit 8277ddc798fc78793364b54444fa53e9a287b5cc
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Thu Aug 26 16:09:44 2010 +0200
sidebar: don't allow selecting headers
src/nautilus-places-sidebar.c | 27 +++++++++++++++++++++++++++
1 files changed, 27 insertions(+), 0 deletions(-)
---
diff --git a/src/nautilus-places-sidebar.c b/src/nautilus-places-sidebar.c
index 70434bf..1abeba6 100644
--- a/src/nautilus-places-sidebar.c
+++ b/src/nautilus-places-sidebar.c
@@ -2807,6 +2807,28 @@ trash_state_changed_cb (NautilusTrashMonitor *trash_monitor,
bookmarks_check_popup_sensitivity (sidebar);
}
+static gboolean
+tree_selection_func (GtkTreeSelection *selection,
+ GtkTreeModel *model,
+ GtkTreePath *path,
+ gboolean path_currently_selected,
+ gpointer user_data)
+{
+ GtkTreeIter iter;
+ PlaceType row_type;
+
+ gtk_tree_model_get_iter (model, &iter, path);
+ gtk_tree_model_get (model, &iter,
+ PLACES_SIDEBAR_COLUMN_ROW_TYPE, &row_type,
+ -1);
+
+ if (row_type == PLACES_HEADING) {
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
static void
icon_cell_renderer_func (GtkTreeViewColumn *column,
GtkCellRenderer *cell,
@@ -3035,6 +3057,11 @@ nautilus_places_sidebar_init (NautilusPlacesSidebar *sidebar)
selection = gtk_tree_view_get_selection (tree_view);
gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);
+ gtk_tree_selection_set_select_function (selection,
+ tree_selection_func,
+ sidebar,
+ NULL);
+
gtk_tree_view_enable_model_drag_source (GTK_TREE_VIEW (tree_view),
GDK_BUTTON1_MASK,
nautilus_shortcuts_source_targets,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]