Commit bd20ab01 authored by Kristian Rietveld's avatar Kristian Rietveld Committed by Kristian Rietveld

Behaviour change, apply changes if the entry of the editable gets a focus

Tue Oct 15 00:53:14 2002  Kristian Rietveld  <kris@gtk.org>

        Behaviour change, apply changes if the entry of the editable gets
        a focus out event (#82405).

        * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_focus_out_event):
        new function,
        (gtk_cell_renderer_text_start_editing): stop editing and apply
        changes on focus-out.

Tue Oct 15 00:47:35 2002  Kristian Rietveld  <kris@gtk.org>

        Fixes an *evil* GtkTreeModelSort bug, #93629.

        * gtk/gtktreemodel.c (release_row_references): return if the
        refs->list is NULL.

        * gtk/gtktreemodelsort.c (gtk_tree_model_sort_row_changed): if we
        are swapping two rows (re-insertion on row_changed), also *emit*
        a rows_reordered signal. oops.

Tue Oct 15 00:45:03 2002  Kristian Rietveld  <kris@gtk.org>

        * gtk/gtkliststore.c (gtk_list_store_remove_silently): free
        the actual link after the node has been removed (#92014).

        * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_column_finalize):
        free the cell_list and the child if the exists (#92014).

Tue Oct 15 00:40:25 2002  Kristian Rietveld  <kris@gtk.org>

        Don't accept drops if the model has been sorted, #93758)

        * gtk/gtkliststore.c (gtk_list_store_row_drop_possible): return
        FALSE if the list has been sorted.

        * gtk/gtktreestore.c (gtk_tree_store_row_drop_possible): check
        if drag_dest is a TreeStore, return FALSE if the tree has been
        sorted.

Tue Oct 15 00:33:59 2002  Kristian Rietveld  <kris@gtk.org>

        Compiler warning fixage, (#85858, #85859, #85860, #85872)

        * gtk/gtkcellrendererpixbuf (gtk_cell_renderer_pixbuf_render):
        s/guint/GtkCellRendererState/.

        * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_render):
        ditto.

        * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render),
        (gtk_cell_renderer_toggle_activate): ditto.

        * gtk/gtkliststore.c (gtk_list_store_get_flags): a
        s/guint/GtkTreeModelFlags/ on the return type.
parent cba9d7e8
Tue Oct 15 00:53:14 2002 Kristian Rietveld <kris@gtk.org>
Behaviour change, apply changes if the entry of the editable gets
a focus out event (#82405).
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_focus_out_event):
new function,
(gtk_cell_renderer_text_start_editing): stop editing and apply
changes on focus-out.
Tue Oct 15 00:47:35 2002 Kristian Rietveld <kris@gtk.org>
Fixes an *evil* GtkTreeModelSort bug, #93629.
* gtk/gtktreemodel.c (release_row_references): return if the
refs->list is NULL.
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_row_changed): if we
are swapping two rows (re-insertion on row_changed), also *emit*
a rows_reordered signal. oops.
Tue Oct 15 00:45:03 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtkliststore.c (gtk_list_store_remove_silently): free
the actual link after the node has been removed (#92014).
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_column_finalize):
free the cell_list and the child if the exists (#92014).
Tue Oct 15 00:40:25 2002 Kristian Rietveld <kris@gtk.org>
Don't accept drops if the model has been sorted, #93758)
* gtk/gtkliststore.c (gtk_list_store_row_drop_possible): return
FALSE if the list has been sorted.
* gtk/gtktreestore.c (gtk_tree_store_row_drop_possible): check
if drag_dest is a TreeStore, return FALSE if the tree has been
sorted.
Tue Oct 15 00:33:59 2002 Kristian Rietveld <kris@gtk.org>
Compiler warning fixage, (#85858, #85859, #85860, #85872)
* gtk/gtkcellrendererpixbuf (gtk_cell_renderer_pixbuf_render):
s/guint/GtkCellRendererState/.
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_render):
ditto.
* gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render),
(gtk_cell_renderer_toggle_activate): ditto.
* gtk/gtkliststore.c (gtk_list_store_get_flags): a
s/guint/GtkTreeModelFlags/ on the return type.
Mon Oct 14 15:10:34 2002 Owen Taylor <otaylor@redhat.com>
* modules/input/gtkimcontextxim.c:
......
Tue Oct 15 00:53:14 2002 Kristian Rietveld <kris@gtk.org>
Behaviour change, apply changes if the entry of the editable gets
a focus out event (#82405).
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_focus_out_event):
new function,
(gtk_cell_renderer_text_start_editing): stop editing and apply
changes on focus-out.
Tue Oct 15 00:47:35 2002 Kristian Rietveld <kris@gtk.org>
Fixes an *evil* GtkTreeModelSort bug, #93629.
* gtk/gtktreemodel.c (release_row_references): return if the
refs->list is NULL.
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_row_changed): if we
are swapping two rows (re-insertion on row_changed), also *emit*
a rows_reordered signal. oops.
Tue Oct 15 00:45:03 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtkliststore.c (gtk_list_store_remove_silently): free
the actual link after the node has been removed (#92014).
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_column_finalize):
free the cell_list and the child if the exists (#92014).
Tue Oct 15 00:40:25 2002 Kristian Rietveld <kris@gtk.org>
Don't accept drops if the model has been sorted, #93758)
* gtk/gtkliststore.c (gtk_list_store_row_drop_possible): return
FALSE if the list has been sorted.
* gtk/gtktreestore.c (gtk_tree_store_row_drop_possible): check
if drag_dest is a TreeStore, return FALSE if the tree has been
sorted.
Tue Oct 15 00:33:59 2002 Kristian Rietveld <kris@gtk.org>
Compiler warning fixage, (#85858, #85859, #85860, #85872)
* gtk/gtkcellrendererpixbuf (gtk_cell_renderer_pixbuf_render):
s/guint/GtkCellRendererState/.
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_render):
ditto.
* gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render),
(gtk_cell_renderer_toggle_activate): ditto.
* gtk/gtkliststore.c (gtk_list_store_get_flags): a
s/guint/GtkTreeModelFlags/ on the return type.
Mon Oct 14 15:10:34 2002 Owen Taylor <otaylor@redhat.com>
* modules/input/gtkimcontextxim.c:
......
Tue Oct 15 00:53:14 2002 Kristian Rietveld <kris@gtk.org>
Behaviour change, apply changes if the entry of the editable gets
a focus out event (#82405).
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_focus_out_event):
new function,
(gtk_cell_renderer_text_start_editing): stop editing and apply
changes on focus-out.
Tue Oct 15 00:47:35 2002 Kristian Rietveld <kris@gtk.org>
Fixes an *evil* GtkTreeModelSort bug, #93629.
* gtk/gtktreemodel.c (release_row_references): return if the
refs->list is NULL.
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_row_changed): if we
are swapping two rows (re-insertion on row_changed), also *emit*
a rows_reordered signal. oops.
Tue Oct 15 00:45:03 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtkliststore.c (gtk_list_store_remove_silently): free
the actual link after the node has been removed (#92014).
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_column_finalize):
free the cell_list and the child if the exists (#92014).
Tue Oct 15 00:40:25 2002 Kristian Rietveld <kris@gtk.org>
Don't accept drops if the model has been sorted, #93758)
* gtk/gtkliststore.c (gtk_list_store_row_drop_possible): return
FALSE if the list has been sorted.
* gtk/gtktreestore.c (gtk_tree_store_row_drop_possible): check
if drag_dest is a TreeStore, return FALSE if the tree has been
sorted.
Tue Oct 15 00:33:59 2002 Kristian Rietveld <kris@gtk.org>
Compiler warning fixage, (#85858, #85859, #85860, #85872)
* gtk/gtkcellrendererpixbuf (gtk_cell_renderer_pixbuf_render):
s/guint/GtkCellRendererState/.
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_render):
ditto.
* gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render),
(gtk_cell_renderer_toggle_activate): ditto.
* gtk/gtkliststore.c (gtk_list_store_get_flags): a
s/guint/GtkTreeModelFlags/ on the return type.
Mon Oct 14 15:10:34 2002 Owen Taylor <otaylor@redhat.com>
* modules/input/gtkimcontextxim.c:
......
Tue Oct 15 00:53:14 2002 Kristian Rietveld <kris@gtk.org>
Behaviour change, apply changes if the entry of the editable gets
a focus out event (#82405).
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_focus_out_event):
new function,
(gtk_cell_renderer_text_start_editing): stop editing and apply
changes on focus-out.
Tue Oct 15 00:47:35 2002 Kristian Rietveld <kris@gtk.org>
Fixes an *evil* GtkTreeModelSort bug, #93629.
* gtk/gtktreemodel.c (release_row_references): return if the
refs->list is NULL.
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_row_changed): if we
are swapping two rows (re-insertion on row_changed), also *emit*
a rows_reordered signal. oops.
Tue Oct 15 00:45:03 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtkliststore.c (gtk_list_store_remove_silently): free
the actual link after the node has been removed (#92014).
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_column_finalize):
free the cell_list and the child if the exists (#92014).
Tue Oct 15 00:40:25 2002 Kristian Rietveld <kris@gtk.org>
Don't accept drops if the model has been sorted, #93758)
* gtk/gtkliststore.c (gtk_list_store_row_drop_possible): return
FALSE if the list has been sorted.
* gtk/gtktreestore.c (gtk_tree_store_row_drop_possible): check
if drag_dest is a TreeStore, return FALSE if the tree has been
sorted.
Tue Oct 15 00:33:59 2002 Kristian Rietveld <kris@gtk.org>
Compiler warning fixage, (#85858, #85859, #85860, #85872)
* gtk/gtkcellrendererpixbuf (gtk_cell_renderer_pixbuf_render):
s/guint/GtkCellRendererState/.
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_render):
ditto.
* gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render),
(gtk_cell_renderer_toggle_activate): ditto.
* gtk/gtkliststore.c (gtk_list_store_get_flags): a
s/guint/GtkTreeModelFlags/ on the return type.
Mon Oct 14 15:10:34 2002 Owen Taylor <otaylor@redhat.com>
* modules/input/gtkimcontextxim.c:
......
Tue Oct 15 00:53:14 2002 Kristian Rietveld <kris@gtk.org>
Behaviour change, apply changes if the entry of the editable gets
a focus out event (#82405).
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_focus_out_event):
new function,
(gtk_cell_renderer_text_start_editing): stop editing and apply
changes on focus-out.
Tue Oct 15 00:47:35 2002 Kristian Rietveld <kris@gtk.org>
Fixes an *evil* GtkTreeModelSort bug, #93629.
* gtk/gtktreemodel.c (release_row_references): return if the
refs->list is NULL.
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_row_changed): if we
are swapping two rows (re-insertion on row_changed), also *emit*
a rows_reordered signal. oops.
Tue Oct 15 00:45:03 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtkliststore.c (gtk_list_store_remove_silently): free
the actual link after the node has been removed (#92014).
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_column_finalize):
free the cell_list and the child if the exists (#92014).
Tue Oct 15 00:40:25 2002 Kristian Rietveld <kris@gtk.org>
Don't accept drops if the model has been sorted, #93758)
* gtk/gtkliststore.c (gtk_list_store_row_drop_possible): return
FALSE if the list has been sorted.
* gtk/gtktreestore.c (gtk_tree_store_row_drop_possible): check
if drag_dest is a TreeStore, return FALSE if the tree has been
sorted.
Tue Oct 15 00:33:59 2002 Kristian Rietveld <kris@gtk.org>
Compiler warning fixage, (#85858, #85859, #85860, #85872)
* gtk/gtkcellrendererpixbuf (gtk_cell_renderer_pixbuf_render):
s/guint/GtkCellRendererState/.
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_render):
ditto.
* gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render),
(gtk_cell_renderer_toggle_activate): ditto.
* gtk/gtkliststore.c (gtk_list_store_get_flags): a
s/guint/GtkTreeModelFlags/ on the return type.
Mon Oct 14 15:10:34 2002 Owen Taylor <otaylor@redhat.com>
* modules/input/gtkimcontextxim.c:
......
Tue Oct 15 00:53:14 2002 Kristian Rietveld <kris@gtk.org>
Behaviour change, apply changes if the entry of the editable gets
a focus out event (#82405).
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_focus_out_event):
new function,
(gtk_cell_renderer_text_start_editing): stop editing and apply
changes on focus-out.
Tue Oct 15 00:47:35 2002 Kristian Rietveld <kris@gtk.org>
Fixes an *evil* GtkTreeModelSort bug, #93629.
* gtk/gtktreemodel.c (release_row_references): return if the
refs->list is NULL.
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_row_changed): if we
are swapping two rows (re-insertion on row_changed), also *emit*
a rows_reordered signal. oops.
Tue Oct 15 00:45:03 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtkliststore.c (gtk_list_store_remove_silently): free
the actual link after the node has been removed (#92014).
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_column_finalize):
free the cell_list and the child if the exists (#92014).
Tue Oct 15 00:40:25 2002 Kristian Rietveld <kris@gtk.org>
Don't accept drops if the model has been sorted, #93758)
* gtk/gtkliststore.c (gtk_list_store_row_drop_possible): return
FALSE if the list has been sorted.
* gtk/gtktreestore.c (gtk_tree_store_row_drop_possible): check
if drag_dest is a TreeStore, return FALSE if the tree has been
sorted.
Tue Oct 15 00:33:59 2002 Kristian Rietveld <kris@gtk.org>
Compiler warning fixage, (#85858, #85859, #85860, #85872)
* gtk/gtkcellrendererpixbuf (gtk_cell_renderer_pixbuf_render):
s/guint/GtkCellRendererState/.
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_render):
ditto.
* gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render),
(gtk_cell_renderer_toggle_activate): ditto.
* gtk/gtkliststore.c (gtk_list_store_get_flags): a
s/guint/GtkTreeModelFlags/ on the return type.
Mon Oct 14 15:10:34 2002 Owen Taylor <otaylor@redhat.com>
* modules/input/gtkimcontextxim.c:
......
......@@ -47,7 +47,7 @@ static void gtk_cell_renderer_pixbuf_render (GtkCellRenderer *cel
GdkRectangle *background_area,
GdkRectangle *cell_area,
GdkRectangle *expose_area,
guint flags);
GtkCellRendererState flags);
enum {
......@@ -400,13 +400,13 @@ gtk_cell_renderer_pixbuf_get_size (GtkCellRenderer *cell,
}
static void
gtk_cell_renderer_pixbuf_render (GtkCellRenderer *cell,
GdkWindow *window,
GtkWidget *widget,
GdkRectangle *background_area,
GdkRectangle *cell_area,
GdkRectangle *expose_area,
guint flags)
gtk_cell_renderer_pixbuf_render (GtkCellRenderer *cell,
GdkWindow *window,
GtkWidget *widget,
GdkRectangle *background_area,
GdkRectangle *cell_area,
GdkRectangle *expose_area,
GtkCellRendererState flags)
{
GtkCellRendererPixbuf *cellpixbuf = (GtkCellRendererPixbuf *) cell;
......
......@@ -49,7 +49,7 @@ static void gtk_cell_renderer_text_render (GtkCellRenderer *cell,
GdkRectangle *background_area,
GdkRectangle *cell_area,
GdkRectangle *expose_area,
guint flags);
GtkCellRendererState flags);
static GtkCellEditable *gtk_cell_renderer_text_start_editing (GtkCellRenderer *cell,
GdkEvent *event,
......@@ -1250,13 +1250,13 @@ gtk_cell_renderer_text_get_size (GtkCellRenderer *cell,
}
static void
gtk_cell_renderer_text_render (GtkCellRenderer *cell,
GdkWindow *window,
GtkWidget *widget,
GdkRectangle *background_area,
GdkRectangle *cell_area,
GdkRectangle *expose_area,
guint flags)
gtk_cell_renderer_text_render (GtkCellRenderer *cell,
GdkWindow *window,
GtkWidget *widget,
GdkRectangle *background_area,
GdkRectangle *cell_area,
GdkRectangle *expose_area,
GtkCellRendererState flags)
{
GtkCellRendererText *celltext = (GtkCellRendererText *) cell;
......@@ -1321,6 +1321,7 @@ gtk_cell_renderer_text_render (GtkCellRenderer *cell,
g_object_unref (layout);
}
static void
gtk_cell_renderer_text_editing_done (GtkCellEditable *entry,
gpointer data)
......@@ -1337,6 +1338,17 @@ gtk_cell_renderer_text_editing_done (GtkCellEditable *entry,
g_signal_emit (data, text_cell_renderer_signals[EDITED], 0, path, new_text);
}
static gboolean
gtk_cell_renderer_text_focus_out_event (GtkWidget *entry,
GdkEvent *event,
gpointer data)
{
gtk_cell_renderer_text_editing_done (GTK_CELL_EDITABLE (entry), data);
/* entry needs focus-out-event */
return FALSE;
}
static GtkCellEditable *
gtk_cell_renderer_text_start_editing (GtkCellRenderer *cell,
GdkEvent *event,
......@@ -1369,6 +1381,10 @@ gtk_cell_renderer_text_start_editing (GtkCellRenderer *cell,
"editing_done",
G_CALLBACK (gtk_cell_renderer_text_editing_done),
celltext);
g_signal_connect (entry, "focus_out_event",
G_CALLBACK (gtk_cell_renderer_text_focus_out_event),
celltext);
return GTK_CELL_EDITABLE (entry);
}
......
......@@ -45,14 +45,14 @@ static void gtk_cell_renderer_toggle_render (GtkCellRenderer *cel
GdkRectangle *background_area,
GdkRectangle *cell_area,
GdkRectangle *expose_area,
guint flags);
GtkCellRendererState flags);
static gboolean gtk_cell_renderer_toggle_activate (GtkCellRenderer *cell,
GdkEvent *event,
GtkWidget *widget,
const gchar *path,
GdkRectangle *background_area,
GdkRectangle *cell_area,
guint flags);
GtkCellRendererState flags);
enum {
......@@ -274,19 +274,19 @@ gtk_cell_renderer_toggle_get_size (GtkCellRenderer *cell,
}
static void
gtk_cell_renderer_toggle_render (GtkCellRenderer *cell,
GdkWindow *window,
GtkWidget *widget,
GdkRectangle *background_area,
GdkRectangle *cell_area,
GdkRectangle *expose_area,
guint flags)
gtk_cell_renderer_toggle_render (GtkCellRenderer *cell,
GdkWindow *window,
GtkWidget *widget,
GdkRectangle *background_area,
GdkRectangle *cell_area,
GdkRectangle *expose_area,
GtkCellRendererState flags)
{
GtkCellRendererToggle *celltoggle = (GtkCellRendererToggle *) cell;
gint width, height;
gint x_offset, y_offset;
GtkShadowType shadow;
GtkStateType state;
GtkStateType state = 0;
gtk_cell_renderer_toggle_get_size (cell, widget, cell_area,
&x_offset, &y_offset,
......@@ -337,13 +337,13 @@ gtk_cell_renderer_toggle_render (GtkCellRenderer *cell,
}
static gint
gtk_cell_renderer_toggle_activate (GtkCellRenderer *cell,
GdkEvent *event,
GtkWidget *widget,
const gchar *path,
GdkRectangle *background_area,
GdkRectangle *cell_area,
guint flags)
gtk_cell_renderer_toggle_activate (GtkCellRenderer *cell,
GdkEvent *event,
GtkWidget *widget,
const gchar *path,
GdkRectangle *background_area,
GdkRectangle *cell_area,
GtkCellRendererState flags)
{
GtkCellRendererToggle *celltoggle;
......
......@@ -35,7 +35,7 @@ static void gtk_list_store_drag_source_init(GtkTreeDragSourceIface *ifac
static void gtk_list_store_drag_dest_init (GtkTreeDragDestIface *iface);
static void gtk_list_store_sortable_init (GtkTreeSortableIface *iface);
static void gtk_list_store_finalize (GObject *object);
static guint gtk_list_store_get_flags (GtkTreeModel *tree_model);
static GtkTreeModelFlags gtk_list_store_get_flags (GtkTreeModel *tree_model);
static gint gtk_list_store_get_n_columns (GtkTreeModel *tree_model);
static GType gtk_list_store_get_column_type (GtkTreeModel *tree_model,
gint index);
......@@ -448,7 +448,7 @@ gtk_list_store_finalize (GObject *object)
}
/* Fulfill the GtkTreeModel requirements */
static guint
static GtkTreeModelFlags
gtk_list_store_get_flags (GtkTreeModel *tree_model)
{
g_return_val_if_fail (GTK_IS_LIST_STORE (tree_model), 0);
......@@ -972,6 +972,8 @@ gtk_list_store_remove_silently (GtkListStore *list_store,
if (iter->user_data == list_store->tail)
list_store->tail = prev;
g_slist_free (G_SLIST (iter->user_data));
}
}
......@@ -1566,6 +1568,10 @@ gtk_list_store_row_drop_possible (GtkTreeDragDest *drag_dest,
g_return_val_if_fail (GTK_IS_LIST_STORE (drag_dest), FALSE);
/* don't accept drops if the list has been sorted */
if (GTK_LIST_STORE_IS_SORTED (drag_dest))
return FALSE;
if (!gtk_tree_get_row_drag_data (selection_data,
&src_model,
&src_path))
......
......@@ -1359,6 +1359,9 @@ release_row_references (gpointer data)
RowRefList *refs = data;
GSList *tmp_list = NULL;
if (!refs->list)
return;
tmp_list = refs->list;
while (tmp_list != NULL)
{
......
......@@ -436,7 +436,7 @@ gtk_tree_model_sort_row_changed (GtkTreeModel *s_model,
gboolean free_s_path = FALSE;
gint offset, index = 0, i;
gint offset, index = 0, old_index, i;
g_return_if_fail (start_s_path != NULL || start_s_iter != NULL);
......@@ -490,6 +490,8 @@ gtk_tree_model_sort_row_changed (GtkTreeModel *s_model,
memcpy (&tmp, elt, sizeof (SortElt));
g_array_remove_index (level->array, index);
old_index = index;
if (GTK_TREE_MODEL_SORT_CACHE_CHILD_ITERS (tree_model_sort))
index = gtk_tree_model_sort_level_find_insert (tree_model_sort,
level,
......@@ -511,8 +513,66 @@ gtk_tree_model_sort_row_changed (GtkTreeModel *s_model,
gtk_tree_path_append_index (path, index);
gtk_tree_model_sort_increment_stamp (tree_model_sort);
gtk_tree_model_get_iter (GTK_TREE_MODEL (data), &iter, path);
/* if the item moved, then emit rows_reordered */
if (old_index != index)
{
gint *new_order;
gint j;
GtkTreePath *tmppath;
new_order = g_new (gint, level->array->len);
for (j = 0; j < level->array->len; j++)
{
if (index > old_index)
{
if (j == index)
new_order[j] = old_index;
else if (j >= old_index && j < index)
new_order[j] = j + 1;
else
new_order[j] = j;
}
else if (index < old_index)
{
if (j == index)
new_order[j] = old_index;
else if (j > index && j <= old_index)
new_order[j] = j - 1;
else
new_order[j] = j;
}
/* else? shouldn't really happen */
}
if (level->parent_elt)
{
iter.stamp = tree_model_sort->stamp;
iter.user_data = level->parent_level;
iter.user_data2 = level->parent_elt;
tmppath = gtk_tree_model_get_path (GTK_TREE_MODEL (tree_model_sort), &iter);
gtk_tree_model_rows_reordered (GTK_TREE_MODEL (tree_model_sort),
tmppath, &iter, new_order);
}
else
{
/* toplevel */
tmppath = gtk_tree_path_new ();
gtk_tree_model_rows_reordered (GTK_TREE_MODEL (tree_model_sort), tmppath,
NULL, new_order);
}
gtk_tree_path_free (tmppath);
g_free (new_order);
}
/* emit row_changed signal (at new location) */
gtk_tree_model_get_iter (GTK_TREE_MODEL (data), &iter, path);
gtk_tree_model_row_changed (GTK_TREE_MODEL (data), path, &iter);
gtk_tree_path_free (path);
......@@ -1175,6 +1235,7 @@ gtk_tree_model_sort_real_unref_node (GtkTreeModel *tree_model,
elt->ref_count--;
level->ref_count--;
if (level->ref_count == 0)
{
SortLevel *parent_level = level->parent_level;
......@@ -1258,6 +1319,7 @@ gtk_tree_model_sort_set_sort_column_id (GtkTreeSortable *sortable,
tree_model_sort->order = order;
gtk_tree_model_sort_sort (tree_model_sort);
gtk_tree_sortable_sort_column_changed (sortable);
}
......
......@@ -1807,6 +1807,12 @@ gtk_tree_store_row_drop_possible (GtkTreeDragDest *drag_dest,
GtkTreePath *tmp = NULL;
gboolean retval = FALSE;
g_return_val_if_fail (GTK_IS_TREE_STORE (drag_dest), FALSE);
/* don't accept drops if the tree has been sorted */
if (GTK_TREE_STORE_IS_SORTED (drag_dest))
return FALSE;
if (!gtk_tree_get_row_drag_data (selection_data,
&src_model,
&src_path))
......
......@@ -354,6 +354,10 @@ gtk_tree_view_column_finalize (GObject *object)
}
g_free (tree_column->title);
g_list_free (tree_column->cell_list);
if (tree_column->child)
g_object_unref (G_OBJECT (tree_column->child));
G_OBJECT_CLASS (parent_class)->finalize (object);
}
......
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