Commit fe8eecdf authored by Jonathan Blandford's avatar Jonathan Blandford Committed by Jonathan Blandford

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.
parent f67ae736
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
......
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
......
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
......
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
......
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
......
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
......
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
......
......@@ -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:
......
......@@ -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)
{
......
......@@ -1234,6 +1234,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)
{
......@@ -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);
}
......@@ -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);
......
......@@ -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,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment