forked from AuroraMiddleware/gtk
fix reordered signal.
Mon Oct 29 13:54:49 2001 Jonathan Blandford <jrb@redhat.com> * gtk/gtktreemodelsort.c (gtk_tree_model_sort_rows_reordered): fix reordered signal.
This commit is contained in:
parent
326f771536
commit
b5ccbdfb67
@ -1,3 +1,8 @@
|
|||||||
|
Mon Oct 29 13:54:49 2001 Jonathan Blandford <jrb@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_rows_reordered): fix
|
||||||
|
reordered signal.
|
||||||
|
|
||||||
Mon Oct 29 12:27:51 2001 Owen Taylor <otaylor@redhat.com>
|
Mon Oct 29 12:27:51 2001 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gtk/gtkfilesel.c (gtk_file_selection_rename_file): Grab
|
* gtk/gtkfilesel.c (gtk_file_selection_rename_file): Grab
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
Mon Oct 29 13:54:49 2001 Jonathan Blandford <jrb@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_rows_reordered): fix
|
||||||
|
reordered signal.
|
||||||
|
|
||||||
Mon Oct 29 12:27:51 2001 Owen Taylor <otaylor@redhat.com>
|
Mon Oct 29 12:27:51 2001 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gtk/gtkfilesel.c (gtk_file_selection_rename_file): Grab
|
* gtk/gtkfilesel.c (gtk_file_selection_rename_file): Grab
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
Mon Oct 29 13:54:49 2001 Jonathan Blandford <jrb@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_rows_reordered): fix
|
||||||
|
reordered signal.
|
||||||
|
|
||||||
Mon Oct 29 12:27:51 2001 Owen Taylor <otaylor@redhat.com>
|
Mon Oct 29 12:27:51 2001 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gtk/gtkfilesel.c (gtk_file_selection_rename_file): Grab
|
* gtk/gtkfilesel.c (gtk_file_selection_rename_file): Grab
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
Mon Oct 29 13:54:49 2001 Jonathan Blandford <jrb@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_rows_reordered): fix
|
||||||
|
reordered signal.
|
||||||
|
|
||||||
Mon Oct 29 12:27:51 2001 Owen Taylor <otaylor@redhat.com>
|
Mon Oct 29 12:27:51 2001 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gtk/gtkfilesel.c (gtk_file_selection_rename_file): Grab
|
* gtk/gtkfilesel.c (gtk_file_selection_rename_file): Grab
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
Mon Oct 29 13:54:49 2001 Jonathan Blandford <jrb@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_rows_reordered): fix
|
||||||
|
reordered signal.
|
||||||
|
|
||||||
Mon Oct 29 12:27:51 2001 Owen Taylor <otaylor@redhat.com>
|
Mon Oct 29 12:27:51 2001 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gtk/gtkfilesel.c (gtk_file_selection_rename_file): Grab
|
* gtk/gtkfilesel.c (gtk_file_selection_rename_file): Grab
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
Mon Oct 29 13:54:49 2001 Jonathan Blandford <jrb@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_rows_reordered): fix
|
||||||
|
reordered signal.
|
||||||
|
|
||||||
Mon Oct 29 12:27:51 2001 Owen Taylor <otaylor@redhat.com>
|
Mon Oct 29 12:27:51 2001 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gtk/gtkfilesel.c (gtk_file_selection_rename_file): Grab
|
* gtk/gtkfilesel.c (gtk_file_selection_rename_file): Grab
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
Mon Oct 29 13:54:49 2001 Jonathan Blandford <jrb@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_rows_reordered): fix
|
||||||
|
reordered signal.
|
||||||
|
|
||||||
Mon Oct 29 12:27:51 2001 Owen Taylor <otaylor@redhat.com>
|
Mon Oct 29 12:27:51 2001 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gtk/gtkfilesel.c (gtk_file_selection_rename_file): Grab
|
* gtk/gtkfilesel.c (gtk_file_selection_rename_file): Grab
|
||||||
|
@ -627,7 +627,6 @@ gtk_tree_model_sort_row_deleted (GtkTreeModel *s_model,
|
|||||||
if (path == NULL)
|
if (path == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_print ("path to be deleted: %s\n", gtk_tree_path_to_string (path));
|
|
||||||
gtk_tree_model_get_iter (GTK_TREE_MODEL (data), &iter, path);
|
gtk_tree_model_get_iter (GTK_TREE_MODEL (data), &iter, path);
|
||||||
|
|
||||||
level = SORT_LEVEL (iter.user_data);
|
level = SORT_LEVEL (iter.user_data);
|
||||||
@ -676,22 +675,21 @@ gtk_tree_model_sort_rows_reordered (GtkTreeModel *s_model,
|
|||||||
gint *new_order,
|
gint *new_order,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
SortElt *elt;
|
SortElt *elt;
|
||||||
SortLevel *level;
|
SortLevel *level;
|
||||||
|
GtkTreeIter iter;
|
||||||
GtkTreeIter iter;
|
gint *tmp_array;
|
||||||
|
int i;
|
||||||
GtkTreePath *path;
|
GtkTreePath *path;
|
||||||
|
|
||||||
GtkTreeModelSort *tree_model_sort = GTK_TREE_MODEL_SORT (data);
|
GtkTreeModelSort *tree_model_sort = GTK_TREE_MODEL_SORT (data);
|
||||||
|
|
||||||
g_return_if_fail (s_iter != NULL);
|
|
||||||
g_return_if_fail (new_order != NULL);
|
g_return_if_fail (new_order != NULL);
|
||||||
|
|
||||||
if (s_path == NULL || gtk_tree_path_get_indices (s_path) == NULL)
|
if (s_path == NULL || gtk_tree_path_get_indices (s_path) == NULL)
|
||||||
{
|
{
|
||||||
if (tree_model_sort->root == NULL)
|
if (tree_model_sort->root == NULL)
|
||||||
return;
|
return;
|
||||||
|
path = gtk_tree_path_new ();
|
||||||
level = SORT_LEVEL (tree_model_sort->root);
|
level = SORT_LEVEL (tree_model_sort->root);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -700,48 +698,40 @@ gtk_tree_model_sort_rows_reordered (GtkTreeModel *s_model,
|
|||||||
if (path == NULL)
|
if (path == NULL)
|
||||||
return;
|
return;
|
||||||
gtk_tree_model_get_iter (GTK_TREE_MODEL (data), &iter, path);
|
gtk_tree_model_get_iter (GTK_TREE_MODEL (data), &iter, path);
|
||||||
gtk_tree_path_free (path);
|
|
||||||
|
|
||||||
level = SORT_LEVEL (iter.user_data);
|
level = SORT_LEVEL (iter.user_data);
|
||||||
elt = SORT_ELT (iter.user_data2);
|
elt = SORT_ELT (iter.user_data2);
|
||||||
|
|
||||||
if (!elt->children)
|
if (!elt->children)
|
||||||
return;
|
{
|
||||||
|
gtk_tree_path_free (path);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
level = elt->children;
|
level = elt->children;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (level->array->len < 2)
|
if (level->array->len < 2)
|
||||||
return;
|
|
||||||
|
|
||||||
/** unsorted: set offsets, resort without reordered emission **/
|
|
||||||
if (tree_model_sort->sort_column_id == -1)
|
|
||||||
{
|
{
|
||||||
path = gtk_tree_model_sort_convert_child_path_to_path (tree_model_sort,
|
gtk_tree_path_free (path);
|
||||||
s_path);
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!path)
|
tmp_array = g_new (int, level->array->len);
|
||||||
{
|
for (i = 0; i < level->array->len; i++)
|
||||||
return;
|
tmp_array[new_order[i]] = g_array_index (level->array, SortElt, i).offset;
|
||||||
}
|
for (i = 0; i < level->array->len; i++)
|
||||||
|
g_array_index (level->array, SortElt, i).offset = tmp_array[i];
|
||||||
for (i = 0; i < level->array->len; i++)
|
g_free (tmp_array);
|
||||||
{
|
|
||||||
g_array_index (level->array, SortElt, i).offset = new_order[i];
|
if (tree_model_sort->sort_column_id == -1 &&
|
||||||
|
tree_model_sort->default_sort_func == (GtkTreeIterCompareFunc) 0x1)
|
||||||
if (GTK_TREE_MODEL_SORT_CACHE_CHILD_ITERS (tree_model_sort)
|
{
|
||||||
&& tree_model_sort->sort_column_id == -1)
|
|
||||||
{
|
|
||||||
get_child_iter_from_elt_no_cache (tree_model_sort,
|
|
||||||
&(g_array_index (level->array, SortElt, i).iter), level, &g_array_index (level->array, SortElt, i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gtk_tree_model_sort_increment_stamp (tree_model_sort);
|
|
||||||
|
|
||||||
gtk_tree_model_sort_sort_level (tree_model_sort, level,
|
gtk_tree_model_sort_sort_level (tree_model_sort, level,
|
||||||
FALSE, FALSE);
|
FALSE, FALSE);
|
||||||
|
gtk_tree_model_sort_increment_stamp (tree_model_sort);
|
||||||
|
|
||||||
if (gtk_tree_path_get_depth (path))
|
if (gtk_tree_path_get_depth (path))
|
||||||
{
|
{
|
||||||
gtk_tree_model_get_iter (GTK_TREE_MODEL (tree_model_sort),
|
gtk_tree_model_get_iter (GTK_TREE_MODEL (tree_model_sort),
|
||||||
@ -755,18 +745,9 @@ gtk_tree_model_sort_rows_reordered (GtkTreeModel *s_model,
|
|||||||
gtk_tree_model_rows_reordered (GTK_TREE_MODEL (tree_model_sort),
|
gtk_tree_model_rows_reordered (GTK_TREE_MODEL (tree_model_sort),
|
||||||
path, NULL, new_order);
|
path, NULL, new_order);
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_tree_path_free (path);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** sorted: update offsets, no emission of reordered signal **/
|
gtk_tree_path_free (path);
|
||||||
for (i = 0; i < level->array->len; i++)
|
|
||||||
g_array_index (level->array, SortElt, i).offset =
|
|
||||||
new_order[g_array_index (level->array, SortElt, i).offset];
|
|
||||||
|
|
||||||
gtk_tree_model_sort_increment_stamp (tree_model_sort);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fulfill our model requirements */
|
/* Fulfill our model requirements */
|
||||||
@ -2131,7 +2112,6 @@ gtk_tree_model_sort_free_level (GtkTreeModelSort *tree_model_sort,
|
|||||||
|
|
||||||
g_assert (sort_level);
|
g_assert (sort_level);
|
||||||
|
|
||||||
g_print ("freeing a level\n");
|
|
||||||
if (sort_level->ref_count == 0)
|
if (sort_level->ref_count == 0)
|
||||||
{
|
{
|
||||||
SortLevel *parent_level = sort_level->parent_level;
|
SortLevel *parent_level = sort_level->parent_level;
|
||||||
|
@ -163,9 +163,9 @@ main (int argc, char *argv[])
|
|||||||
|
|
||||||
gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), column);
|
gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), column);
|
||||||
|
|
||||||
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (smodel),
|
/* gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (smodel),
|
||||||
WORD_COLUMN_1,
|
WORD_COLUMN_1,
|
||||||
GTK_SORT_ASCENDING);
|
GTK_SORT_ASCENDING);*/
|
||||||
|
|
||||||
gtk_container_add (GTK_CONTAINER (scrolled_window), tree_view);
|
gtk_container_add (GTK_CONTAINER (scrolled_window), tree_view);
|
||||||
gtk_window_set_default_size (GTK_WINDOW (window), 400, 400);
|
gtk_window_set_default_size (GTK_WINDOW (window), 400, 400);
|
||||||
@ -230,12 +230,13 @@ main (int argc, char *argv[])
|
|||||||
gtk_tree_view_column_set_sort_column_id (column, WORD_COLUMN_4);
|
gtk_tree_view_column_set_sort_column_id (column, WORD_COLUMN_4);
|
||||||
gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view2), column);
|
gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view2), column);
|
||||||
|
|
||||||
gtk_tree_sortable_set_default_sort_func (GTK_TREE_SORTABLE (smodel),
|
/* gtk_tree_sortable_set_default_sort_func (GTK_TREE_SORTABLE (smodel),
|
||||||
(GtkTreeIterCompareFunc)gtk_tree_data_list_compare_func,
|
(GtkTreeIterCompareFunc)gtk_tree_data_list_compare_func,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (smodel),
|
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (smodel),
|
||||||
WORD_COLUMN_1,
|
WORD_COLUMN_1,
|
||||||
GTK_SORT_DESCENDING);
|
GTK_SORT_DESCENDING);*/
|
||||||
|
|
||||||
|
|
||||||
gtk_container_add (GTK_CONTAINER (scrolled_window2), tree_view2);
|
gtk_container_add (GTK_CONTAINER (scrolled_window2), tree_view2);
|
||||||
gtk_window_set_default_size (GTK_WINDOW (window2), 400, 400);
|
gtk_window_set_default_size (GTK_WINDOW (window2), 400, 400);
|
||||||
@ -301,12 +302,12 @@ main (int argc, char *argv[])
|
|||||||
gtk_tree_view_column_set_sort_column_id (column, WORD_COLUMN_4);
|
gtk_tree_view_column_set_sort_column_id (column, WORD_COLUMN_4);
|
||||||
gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view3), column);
|
gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view3), column);
|
||||||
|
|
||||||
gtk_tree_sortable_set_default_sort_func (GTK_TREE_SORTABLE (ssmodel),
|
/* gtk_tree_sortable_set_default_sort_func (GTK_TREE_SORTABLE (ssmodel),
|
||||||
(GtkTreeIterCompareFunc)gtk_tree_data_list_compare_func,
|
(GtkTreeIterCompareFunc)gtk_tree_data_list_compare_func,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (ssmodel),
|
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (ssmodel),
|
||||||
WORD_COLUMN_1,
|
WORD_COLUMN_1,
|
||||||
GTK_SORT_ASCENDING);
|
GTK_SORT_ASCENDING);*/
|
||||||
|
|
||||||
gtk_container_add (GTK_CONTAINER (scrolled_window3), tree_view3);
|
gtk_container_add (GTK_CONTAINER (scrolled_window3), tree_view3);
|
||||||
gtk_window_set_default_size (GTK_WINDOW (window3), 400, 400);
|
gtk_window_set_default_size (GTK_WINDOW (window3), 400, 400);
|
||||||
|
Loading…
Reference in New Issue
Block a user