Commit b1ea32b8 authored by Jonathan Blandford's avatar Jonathan Blandford

sync minor clenup

parent 11e6236b
......@@ -677,7 +677,6 @@ gtk_tree_model_sort_rows_reordered (GtkTreeModel *s_model,
gpointer data)
{
int i;
int len;
SortElt *elt;
SortLevel *level;
......@@ -686,47 +685,25 @@ gtk_tree_model_sort_rows_reordered (GtkTreeModel *s_model,
GtkTreeModelSort *tree_model_sort = GTK_TREE_MODEL_SORT (data);
g_return_if_fail (s_path != NULL && s_iter != NULL);
g_return_if_fail (s_iter != NULL);
g_return_if_fail (new_order != NULL);
if (!gtk_tree_path_get_indices (s_path))
len = gtk_tree_model_iter_n_children (s_model, NULL);
else
len = gtk_tree_model_iter_n_children (s_model, s_iter);
if (len < 2)
if (s_path == NULL || gtk_tree_path_get_indices (s_path) == NULL)
{
return;
if (tree_model_sort->root == NULL)
return;
level = SORT_LEVEL (tree_model_sort->root);
}
/** get correct sort level **/
if (!gtk_tree_path_get_indices (s_path))
level = SORT_LEVEL (tree_model_sort->root);
else
{
path = gtk_tree_model_sort_convert_child_path_to_path (tree_model_sort,
s_path);
if (!path)
{
return;
}
path = gtk_real_tree_model_sort_convert_child_path_to_path (tree_model_sort, s_path, FALSE);
if (path == NULL)
return;
gtk_tree_model_get_iter (GTK_TREE_MODEL (data), &iter, path);
gtk_tree_path_free (path);
if (!gtk_tree_model_get_iter (GTK_TREE_MODEL (data), &iter, path))
{
/* no iter for me */
gtk_tree_path_free (path);
return;
}
level = SORT_LEVEL (iter.user_data);
elt = SORT_ELT (iter.user_data2);
gtk_tree_path_free (path);
/* FIXME: is this needed ? */
if (!s_iter)
gtk_tree_model_get_iter (s_model, s_iter, s_path);
if (!elt->children)
return;
......@@ -734,18 +711,8 @@ gtk_tree_model_sort_rows_reordered (GtkTreeModel *s_model,
level = elt->children;
}
if (!level)
{
/* ignore signal */
return;
}
if (len != level->array->len)
{
/* length mismatch, pretty bad, shouldn't happen */
return;
}
if (level->array->len < 2)
return;
/** unsorted: set offsets, resort without reordered emission **/
if (tree_model_sort->sort_column_id == -1)
......@@ -800,7 +767,6 @@ gtk_tree_model_sort_rows_reordered (GtkTreeModel *s_model,
new_order[g_array_index (level->array, SortElt, i).offset];
gtk_tree_model_sort_increment_stamp (tree_model_sort);
}
/* Fulfill our model requirements */
......
......@@ -98,7 +98,9 @@ main (int argc, char *argv[])
for (i = 0; data[i].word_1 != NULL; i++)
{
gint k;
GtkTreeIter child_iter;
gtk_tree_store_prepend (GTK_TREE_STORE (model), &iter, NULL);
gtk_tree_store_set (GTK_TREE_STORE (model), &iter,
WORD_COLUMN_1, data[i].word_1,
......@@ -106,11 +108,16 @@ main (int argc, char *argv[])
WORD_COLUMN_3, data[i].word_3,
WORD_COLUMN_4, data[i].word_4,
-1);
gtk_tree_store_append (GTK_TREE_STORE (model), &child_iter, &iter);
gtk_tree_store_set (GTK_TREE_STORE (model), &child_iter,
WORD_COLUMN_1, data[i].word_1,
WORD_COLUMN_2, data[i].word_2,
WORD_COLUMN_3, data[i].word_3,
WORD_COLUMN_4, data[i].word_4,
-1);
for (k = 0; childdata[k].word_1 != NULL; k++)
{
GtkTreeIter child_iter;
gtk_tree_store_append (GTK_TREE_STORE (model), &child_iter, &iter);
gtk_tree_store_set (GTK_TREE_STORE (model), &child_iter,
WORD_COLUMN_1, childdata[k].word_1,
......@@ -305,7 +312,7 @@ main (int argc, char *argv[])
gtk_window_set_default_size (GTK_WINDOW (window3), 400, 400);
gtk_widget_show_all (window3);
}
#if 0
for (i = 0; data[i].word_1 != NULL; i++)
{
gint k;
......@@ -330,7 +337,7 @@ main (int argc, char *argv[])
-1);
}
}
#endif
gtk_main ();
return 0;
......
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