diff options
Diffstat (limited to 'packages/gtk+/gtk+-2.6.4-1.osso7/gtktreeselection.c.diff')
-rw-r--r-- | packages/gtk+/gtk+-2.6.4-1.osso7/gtktreeselection.c.diff | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/packages/gtk+/gtk+-2.6.4-1.osso7/gtktreeselection.c.diff b/packages/gtk+/gtk+-2.6.4-1.osso7/gtktreeselection.c.diff index e69de29bb2..5361f9b5d1 100644 --- a/packages/gtk+/gtk+-2.6.4-1.osso7/gtktreeselection.c.diff +++ b/packages/gtk+/gtk+-2.6.4-1.osso7/gtktreeselection.c.diff @@ -0,0 +1,91 @@ +--- gtk+-2.6.4/gtk/gtktreeselection.c 2004-11-20 01:18:38.000000000 +0200 ++++ gtk+-2.6.4/gtk/gtktreeselection.c 2005-04-06 16:19:38.186733096 +0300 +@@ -190,11 +190,28 @@ + GtkSelectionMode type) + { + GtkTreeSelectionFunc tmp_func; ++ + g_return_if_fail (GTK_IS_TREE_SELECTION (selection)); + + if (selection->type == type) + return; + ++ /* Hildon addition */ ++ if ((type == GTK_SELECTION_SINGLE) && ++ (selection->type == GTK_SELECTION_MULTIPLE || ++ selection->type == GTK_SELECTION_BROWSE)) ++ { ++ GtkTreePath *cursor_path; ++ ++ /* to successfully switch from multiple selection mode to single ++ selection, we must ensure that anchor exists and is selected ++ since otherwise gtk_tree_selection_select_path won't work anymore */ ++ if (gtk_tree_row_reference_valid (selection->tree_view->priv->cursor)) ++ { ++ cursor_path = gtk_tree_row_reference_get_path (selection->tree_view->priv->cursor); gtk_tree_selection_select_path (selection, cursor_path); ++ gtk_tree_path_free (cursor_path); ++ } ++ } + + if (type == GTK_SELECTION_NONE) + { +@@ -251,6 +268,20 @@ + } + + selection->type = type; ++ ++ /* Hildon addition */ ++ if (type == GTK_SELECTION_SINGLE) ++ { ++ GtkTreePath *path; ++ GtkTreeIter iter; ++ ++ /* reset cursor to the selected row */ ++ gtk_tree_selection_get_selected (selection, NULL, &iter); ++ path = gtk_tree_model_get_path (selection->tree_view->priv->model, ++ &iter); ++ gtk_tree_view_set_cursor (selection->tree_view, path, NULL, FALSE); ++ gtk_tree_path_free (path); ++ } + } + + /** +@@ -1319,10 +1350,10 @@ + return sensitive; + } + +-static gboolean +-row_is_selectable (GtkTreeSelection *selection, +- GtkRBNode *node, +- GtkTreePath *path) ++gboolean ++_gtk_tree_selection_is_row_selectable (GtkTreeSelection *selection, ++ GtkRBNode *node, ++ GtkTreePath *path) + { + GList *list; + GtkTreeIter iter; +@@ -1411,7 +1442,7 @@ + { + /* We only want to select the new node if we can unselect the old one, + * and we can select the new one. */ +- dirty = row_is_selectable (selection, node, path); ++ dirty = _gtk_tree_selection_is_row_selectable (selection, node, path); + + /* if dirty is FALSE, we weren't able to select the new one, otherwise, we try to + * unselect the new one +@@ -1528,8 +1559,13 @@ + if (GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_SELECTED) != select) + { + path = _gtk_tree_view_find_path (selection->tree_view, tree, node); +- selected = row_is_selectable (selection, node, path); ++ selected = _gtk_tree_selection_is_row_selectable (selection, node, path); + gtk_tree_path_free (path); ++ ++ /* if row is unselectable, allow unselection only */ ++ if (!selected && !select && ++ GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_SELECTED)) ++ selected = TRUE; + } + + if (selected == TRUE) |