summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2004-09-14 19:37:48 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2004-09-14 19:37:48 +0000
commit03a6952c48c7b4679d1874532cbcffaf15fe2ef2 (patch)
tree84514b48d847871785d78ecb3d878e64cb8258aa
parent01743e7235b1840bb2ce04ba35afbd766b10c122 (diff)
downloadgtk+-03a6952c48c7b4679d1874532cbcffaf15fe2ef2.tar.gz
Set the cursor to the first selected row instead of always to the first
2004-09-14 Matthias Clasen <mclasen@redhat.com> * gtk/gtktreeview.c (gtk_tree_view_focus_to_cursor): Set the cursor to the first selected row instead of always to the first row if there is no cursor. (#143270, Jean Bréfort) * tests/testfilechooser.c (main): Fix a few typos.
-rw-r--r--ChangeLog8
-rw-r--r--ChangeLog.pre-2-108
-rw-r--r--ChangeLog.pre-2-68
-rw-r--r--ChangeLog.pre-2-88
-rw-r--r--gtk/gtktreeview.c17
-rw-r--r--tests/testfilechooser.c6
6 files changed, 51 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index ec8842a295..c3c0010458 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2004-09-14 Matthias Clasen <mclasen@redhat.com>
+
+ * gtk/gtktreeview.c (gtk_tree_view_focus_to_cursor): Set the cursor
+ to the first selected row instead of always to the first row if there
+ is no cursor. (#143270, Jean Bréfort)
+
+ * tests/testfilechooser.c (main): Fix a few typos.
+
2004-09-13 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkexpander.c:
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index ec8842a295..c3c0010458 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,3 +1,11 @@
+2004-09-14 Matthias Clasen <mclasen@redhat.com>
+
+ * gtk/gtktreeview.c (gtk_tree_view_focus_to_cursor): Set the cursor
+ to the first selected row instead of always to the first row if there
+ is no cursor. (#143270, Jean Bréfort)
+
+ * tests/testfilechooser.c (main): Fix a few typos.
+
2004-09-13 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkexpander.c:
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index ec8842a295..c3c0010458 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -1,3 +1,11 @@
+2004-09-14 Matthias Clasen <mclasen@redhat.com>
+
+ * gtk/gtktreeview.c (gtk_tree_view_focus_to_cursor): Set the cursor
+ to the first selected row instead of always to the first row if there
+ is no cursor. (#143270, Jean Bréfort)
+
+ * tests/testfilechooser.c (main): Fix a few typos.
+
2004-09-13 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkexpander.c:
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index ec8842a295..c3c0010458 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,3 +1,11 @@
+2004-09-14 Matthias Clasen <mclasen@redhat.com>
+
+ * gtk/gtktreeview.c (gtk_tree_view_focus_to_cursor): Set the cursor
+ to the first selected row instead of always to the first row if there
+ is no cursor. (#143270, Jean Bréfort)
+
+ * tests/testfilechooser.c (main): Fix a few typos.
+
2004-09-13 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkexpander.c:
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index 2f401ebaeb..cabda22907 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -8319,7 +8319,22 @@ gtk_tree_view_focus_to_cursor (GtkTreeView *tree_view)
if (cursor_path == NULL)
{
- cursor_path = gtk_tree_path_new_first ();
+ /* Consult the selection before defaulting to the first element */
+ GtkTreeSelection *selection;
+ GtkTreeModel *model;
+ GList *selected_rows;
+
+ selection = gtk_tree_view_get_selection (tree_view);
+ selected_rows = gtk_tree_selection_get_selected_rows (selection, &model);
+ if (selected_rows)
+ {
+ cursor_path = gtk_tree_path_copy((const GtkTreePath *)(selected_rows->data));
+ g_list_foreach (selected_rows, (GFunc)gtk_tree_path_free, NULL);
+ g_list_free (selected_rows);
+ }
+ else
+ cursor_path = gtk_tree_path_new_first ();
+
gtk_tree_row_reference_free (tree_view->priv->cursor);
tree_view->priv->cursor = NULL;
diff --git a/tests/testfilechooser.c b/tests/testfilechooser.c
index 30b1ced267..b6df9aced9 100644
--- a/tests/testfilechooser.c
+++ b/tests/testfilechooser.c
@@ -535,17 +535,17 @@ main (int argc, char **argv)
g_signal_connect (button, "clicked",
G_CALLBACK (set_folder_nonexistent_cb), dialog);
- button = gtk_button_new_with_label ("set_current_folder (\"/usr/nonexistent\"");
+ button = gtk_button_new_with_label ("set_current_folder (\"/usr/nonexistent\")");
gtk_container_add (GTK_CONTAINER (vbbox), button);
g_signal_connect (button, "clicked",
G_CALLBACK (set_folder_existing_nonexistent_cb), dialog);
- button = gtk_button_new_with_label ("set_filename (\"/nonexistent\"");
+ button = gtk_button_new_with_label ("set_filename (\"/nonexistent\")");
gtk_container_add (GTK_CONTAINER (vbbox), button);
g_signal_connect (button, "clicked",
G_CALLBACK (set_filename_nonexistent_cb), dialog);
- button = gtk_button_new_with_label ("set_filename (\"/usr/nonexistent\"");
+ button = gtk_button_new_with_label ("set_filename (\"/usr/nonexistent\")");
gtk_container_add (GTK_CONTAINER (vbbox), button);
g_signal_connect (button, "clicked",
G_CALLBACK (set_filename_existing_nonexistent_cb), dialog);