diff options
author | Jonathan Blandford <jrb@redhat.com> | 2001-03-30 01:26:30 +0000 |
---|---|---|
committer | Jonathan Blandford <jrb@src.gnome.org> | 2001-03-30 01:26:30 +0000 |
commit | fe8eecdf7509819b2ffd489ce6929230d4d78032 (patch) | |
tree | c455fe39c744b11a6c80fffb15cd9c0b3f5ee69b | |
parent | f67ae736ee9a21ffc8f190ded724543bf66e1316 (diff) | |
download | gtk+-fe8eecdf7509819b2ffd489ce6929230d4d78032.tar.gz |
Now we listen to the reorder signal.
Thu Mar 29 20:20:38 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreemodel.c (gtk_tree_row_ref_reordered_callback): Now we
listen to the reorder signal.
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | ChangeLog.pre-2-0 | 5 | ||||
-rw-r--r-- | ChangeLog.pre-2-10 | 5 | ||||
-rw-r--r-- | ChangeLog.pre-2-2 | 5 | ||||
-rw-r--r-- | ChangeLog.pre-2-4 | 5 | ||||
-rw-r--r-- | ChangeLog.pre-2-6 | 5 | ||||
-rw-r--r-- | ChangeLog.pre-2-8 | 5 | ||||
-rw-r--r-- | docs/reference/gtk/tmpl/gtktreeviewcolumn.sgml | 4 | ||||
-rw-r--r-- | gtk/gtkliststore.c | 3 | ||||
-rw-r--r-- | gtk/gtktreemodel.c | 81 | ||||
-rw-r--r-- | gtk/gtktreemodel.h | 4 | ||||
-rw-r--r-- | gtk/gtktreeview.c | 5 |
12 files changed, 125 insertions, 7 deletions
@@ -1,3 +1,8 @@ +Thu Mar 29 20:20:38 2001 Jonathan Blandford <jrb@redhat.com> + + * gtk/gtktreemodel.c (gtk_tree_row_ref_reordered_callback): Now we + listen to the reorder signal. + Wed Mar 28 20:30:26 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkwidget.[ch] (_gtk_widget_get_aux_info): Add private function diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 2b174c1989..7502ac999f 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,8 @@ +Thu Mar 29 20:20:38 2001 Jonathan Blandford <jrb@redhat.com> + + * gtk/gtktreemodel.c (gtk_tree_row_ref_reordered_callback): Now we + listen to the reorder signal. + Wed Mar 28 20:30:26 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkwidget.[ch] (_gtk_widget_get_aux_info): Add private function diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 2b174c1989..7502ac999f 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,8 @@ +Thu Mar 29 20:20:38 2001 Jonathan Blandford <jrb@redhat.com> + + * gtk/gtktreemodel.c (gtk_tree_row_ref_reordered_callback): Now we + listen to the reorder signal. + Wed Mar 28 20:30:26 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkwidget.[ch] (_gtk_widget_get_aux_info): Add private function diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 2b174c1989..7502ac999f 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,8 @@ +Thu Mar 29 20:20:38 2001 Jonathan Blandford <jrb@redhat.com> + + * gtk/gtktreemodel.c (gtk_tree_row_ref_reordered_callback): Now we + listen to the reorder signal. + Wed Mar 28 20:30:26 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkwidget.[ch] (_gtk_widget_get_aux_info): Add private function diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 2b174c1989..7502ac999f 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,8 @@ +Thu Mar 29 20:20:38 2001 Jonathan Blandford <jrb@redhat.com> + + * gtk/gtktreemodel.c (gtk_tree_row_ref_reordered_callback): Now we + listen to the reorder signal. + Wed Mar 28 20:30:26 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkwidget.[ch] (_gtk_widget_get_aux_info): Add private function diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 2b174c1989..7502ac999f 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,8 @@ +Thu Mar 29 20:20:38 2001 Jonathan Blandford <jrb@redhat.com> + + * gtk/gtktreemodel.c (gtk_tree_row_ref_reordered_callback): Now we + listen to the reorder signal. + Wed Mar 28 20:30:26 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkwidget.[ch] (_gtk_widget_get_aux_info): Add private function diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 2b174c1989..7502ac999f 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,8 @@ +Thu Mar 29 20:20:38 2001 Jonathan Blandford <jrb@redhat.com> + + * gtk/gtktreemodel.c (gtk_tree_row_ref_reordered_callback): Now we + listen to the reorder signal. + Wed Mar 28 20:30:26 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkwidget.[ch] (_gtk_widget_get_aux_info): Add private function diff --git a/docs/reference/gtk/tmpl/gtktreeviewcolumn.sgml b/docs/reference/gtk/tmpl/gtktreeviewcolumn.sgml index 1164d6817b..95a3ae5829 100644 --- a/docs/reference/gtk/tmpl/gtktreeviewcolumn.sgml +++ b/docs/reference/gtk/tmpl/gtktreeviewcolumn.sgml @@ -34,6 +34,7 @@ GtkTreeViewColumn @alignment: @window: @xalign: +@model_changed_signal: @width: @min_width: @max_width: @@ -45,7 +46,8 @@ GtkTreeViewColumn @cell: @attributes: @column_type: -@sort_signal: +@sort_clicked_signal: +@sort_column_changed_signal: @sort_column_id: @sort_order: @visible: diff --git a/gtk/gtkliststore.c b/gtk/gtkliststore.c index 68cf78b9cb..910ac9499c 100644 --- a/gtk/gtkliststore.c +++ b/gtk/gtkliststore.c @@ -79,6 +79,7 @@ static gboolean gtk_list_store_row_drop_possible (GtkTreeDragDest *drag_dest, GtkTreePath *src_path, GtkTreePath *dest_path); + /* sortable */ static void gtk_list_store_sort (GtkListStore *list_store); static void gtk_list_store_sort_iter_changed (GtkListStore *list_store, @@ -96,8 +97,6 @@ static void gtk_list_store_sort_column_id_set_func (GtkTreeSortable * GtkDestroyNotify destroy); - - static void validate_list_store (GtkListStore *list_store) { diff --git a/gtk/gtktreemodel.c b/gtk/gtktreemodel.c index b7b6aaf63f..2d7aa0171a 100644 --- a/gtk/gtktreemodel.c +++ b/gtk/gtktreemodel.c @@ -1235,6 +1235,58 @@ gtk_tree_row_ref_deleted_callback (GObject *object, } static void +gtk_tree_row_ref_reordered_callback (GObject *object, + GtkTreePath *path, + GtkTreeIter *iter, + gint *new_order, + gpointer data) +{ + RowRefList *refs = g_object_get_data (data, ROW_REF_DATA_STRING); + GSList *tmp_list; + gint length; + + if (refs == NULL) + return; + + tmp_list = refs->list; + + while (tmp_list != NULL) + { + GtkTreeRowReference *reference = tmp_list->data; + + length = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (reference->model), iter); + + if (length < 2) + return; + + if ((reference->path) && + (gtk_tree_path_is_ancestor (path, reference->path))) + { + gint ref_depth = gtk_tree_path_get_depth (reference->path); + gint depth = gtk_tree_path_get_depth (path); + + if (ref_depth > depth) + { + gint i; + gint *indices = gtk_tree_path_get_indices (reference->path); + + for (i = 0; i < length; i++) + { + if (new_order[i] == indices[depth]) + { + indices[depth] = i; + return; + } + } + } + } + + tmp_list = g_slist_next (tmp_list); + } + +} + +static void connect_ref_callbacks (GtkTreeModel *model) { g_signal_connect_data (G_OBJECT (model), @@ -1252,6 +1304,14 @@ connect_ref_callbacks (GtkTreeModel *model) NULL, FALSE, FALSE); + + g_signal_connect_data (G_OBJECT (model), + "reordered", + (GCallback) gtk_tree_row_ref_reordered_callback, + model, + NULL, + FALSE, + FALSE); } static void @@ -1267,6 +1327,11 @@ disconnect_ref_callbacks (GtkTreeModel *model) 0, 0, NULL, gtk_tree_row_ref_deleted_callback, NULL); + g_signal_handlers_disconnect_matched (G_OBJECT (model), + G_SIGNAL_MATCH_FUNC, + 0, 0, NULL, + gtk_tree_row_ref_reordered_callback, + NULL); } GtkTreeRowReference * @@ -1288,9 +1353,7 @@ gtk_tree_row_reference_new_proxy (GObject *proxy, GtkTreeRowReference *reference; RowRefList *refs; - g_return_val_if_fail (proxy != NULL, NULL); g_return_val_if_fail (G_IS_OBJECT (proxy), NULL); - g_return_val_if_fail (model != NULL, NULL); g_return_val_if_fail (GTK_IS_TREE_MODEL (model), NULL); g_return_val_if_fail (path != NULL, NULL); @@ -1372,7 +1435,6 @@ void gtk_tree_row_reference_inserted (GObject *proxy, GtkTreePath *path) { - g_return_if_fail (proxy != NULL); g_return_if_fail (G_IS_OBJECT (proxy)); gtk_tree_row_ref_inserted_callback (NULL, path, NULL, proxy); @@ -1383,8 +1445,19 @@ void gtk_tree_row_reference_deleted (GObject *proxy, GtkTreePath *path) { - g_return_if_fail (proxy != NULL); g_return_if_fail (G_IS_OBJECT (proxy)); gtk_tree_row_ref_deleted_callback (NULL, path, proxy); } + +void +gtk_tree_row_reference_reordered (GObject *proxy, + GtkTreePath *path, + GtkTreeIter *iter, + gint *new_order) +{ + g_return_if_fail (G_IS_OBJECT (proxy)); + + gtk_tree_row_ref_reordered_callback (NULL, path, iter, new_order, proxy); +} + diff --git a/gtk/gtktreemodel.h b/gtk/gtktreemodel.h index 80ed13aa61..ead525f0ee 100644 --- a/gtk/gtktreemodel.h +++ b/gtk/gtktreemodel.h @@ -154,6 +154,10 @@ void gtk_tree_row_reference_inserted (GObject *proxy, GtkTreePath *path); void gtk_tree_row_reference_deleted (GObject *proxy, GtkTreePath *path); +void gtk_tree_row_reference_reordered (GObject *proxy, + GtkTreePath *path, + GtkTreeIter *iter, + gint *new_order); /* GtkTreeIter operations */ GtkTreeIter * gtk_tree_iter_copy (GtkTreeIter *iter); diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c index 3acfc3e2a5..f3a1fb0cf7 100644 --- a/gtk/gtktreeview.c +++ b/gtk/gtktreeview.c @@ -3025,6 +3025,11 @@ gtk_tree_view_reordered (GtkTreeModel *model, if (len < 2) return; + gtk_tree_row_reference_reordered (G_OBJECT (data), + parent, + iter, + new_order); + if (_gtk_tree_view_find_node (tree_view, parent, &tree, |