summaryrefslogtreecommitdiffstats
path: root/meta/packages/gtk+/gtk+-2.6.4-1.osso7/gtktreeselection.c.diff
diff options
context:
space:
mode:
Diffstat (limited to 'meta/packages/gtk+/gtk+-2.6.4-1.osso7/gtktreeselection.c.diff')
-rw-r--r--meta/packages/gtk+/gtk+-2.6.4-1.osso7/gtktreeselection.c.diff91
1 files changed, 91 insertions, 0 deletions
diff --git a/meta/packages/gtk+/gtk+-2.6.4-1.osso7/gtktreeselection.c.diff b/meta/packages/gtk+/gtk+-2.6.4-1.osso7/gtktreeselection.c.diff
new file mode 100644
index 0000000000..5361f9b5d1
--- /dev/null
+++ b/meta/packages/gtk+/gtk+-2.6.4-1.osso7/gtktreeselection.c.diff
@@ -0,0 +1,91 @@
1--- gtk+-2.6.4/gtk/gtktreeselection.c 2004-11-20 01:18:38.000000000 +0200
2+++ gtk+-2.6.4/gtk/gtktreeselection.c 2005-04-06 16:19:38.186733096 +0300
3@@ -190,11 +190,28 @@
4 GtkSelectionMode type)
5 {
6 GtkTreeSelectionFunc tmp_func;
7+
8 g_return_if_fail (GTK_IS_TREE_SELECTION (selection));
9
10 if (selection->type == type)
11 return;
12
13+ /* Hildon addition */
14+ if ((type == GTK_SELECTION_SINGLE) &&
15+ (selection->type == GTK_SELECTION_MULTIPLE ||
16+ selection->type == GTK_SELECTION_BROWSE))
17+ {
18+ GtkTreePath *cursor_path;
19+
20+ /* to successfully switch from multiple selection mode to single
21+ selection, we must ensure that anchor exists and is selected
22+ since otherwise gtk_tree_selection_select_path won't work anymore */
23+ if (gtk_tree_row_reference_valid (selection->tree_view->priv->cursor))
24+ {
25+ cursor_path = gtk_tree_row_reference_get_path (selection->tree_view->priv->cursor); gtk_tree_selection_select_path (selection, cursor_path);
26+ gtk_tree_path_free (cursor_path);
27+ }
28+ }
29
30 if (type == GTK_SELECTION_NONE)
31 {
32@@ -251,6 +268,20 @@
33 }
34
35 selection->type = type;
36+
37+ /* Hildon addition */
38+ if (type == GTK_SELECTION_SINGLE)
39+ {
40+ GtkTreePath *path;
41+ GtkTreeIter iter;
42+
43+ /* reset cursor to the selected row */
44+ gtk_tree_selection_get_selected (selection, NULL, &iter);
45+ path = gtk_tree_model_get_path (selection->tree_view->priv->model,
46+ &iter);
47+ gtk_tree_view_set_cursor (selection->tree_view, path, NULL, FALSE);
48+ gtk_tree_path_free (path);
49+ }
50 }
51
52 /**
53@@ -1319,10 +1350,10 @@
54 return sensitive;
55 }
56
57-static gboolean
58-row_is_selectable (GtkTreeSelection *selection,
59- GtkRBNode *node,
60- GtkTreePath *path)
61+gboolean
62+_gtk_tree_selection_is_row_selectable (GtkTreeSelection *selection,
63+ GtkRBNode *node,
64+ GtkTreePath *path)
65 {
66 GList *list;
67 GtkTreeIter iter;
68@@ -1411,7 +1442,7 @@
69 {
70 /* We only want to select the new node if we can unselect the old one,
71 * and we can select the new one. */
72- dirty = row_is_selectable (selection, node, path);
73+ dirty = _gtk_tree_selection_is_row_selectable (selection, node, path);
74
75 /* if dirty is FALSE, we weren't able to select the new one, otherwise, we try to
76 * unselect the new one
77@@ -1528,8 +1559,13 @@
78 if (GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_SELECTED) != select)
79 {
80 path = _gtk_tree_view_find_path (selection->tree_view, tree, node);
81- selected = row_is_selectable (selection, node, path);
82+ selected = _gtk_tree_selection_is_row_selectable (selection, node, path);
83 gtk_tree_path_free (path);
84+
85+ /* if row is unselectable, allow unselection only */
86+ if (!selected && !select &&
87+ GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_SELECTED))
88+ selected = TRUE;
89 }
90
91 if (selected == TRUE)