Re: TreeView/ListStore reordering by DND

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 2014-03-01 at 23:46 +0100, Nicola Fontana wrote:
> > First question:
> > When I exchange rows by drag and drop, I get
> > 
> > value = (null)
> > 
> > similar to my test from Ruby yesterday. Is this intended, or is my
> code
> > wrong (I have not much practice with using GTK from plain C...)
> 
> Hi,
> 
> this is intended behavior. The problem is the insertion is done in two
> steps: (1) an empty row is created (and your on_row_inserted()
> callback
> is called) and (2) that row is filled with data.

Thank you for that information -- now I know at least that I am doing it
not the wrong way.

I have just added a callback for the "row_changed" signal. That signal
is emitted straight after the "row_inserted" signal and in the
signal-handler for "row_changed" signal I get a correct value.

void on_row_changed(GtkTreeModel *tree_model, GtkTreePath *path,
GtkTreeIter *iter, gpointer user_data)
{
  char *value;
  printf("row_changed\n");
  gtk_tree_model_get(tree_model, iter, LIST_ITEM, &value, -1);
  g_printf("value = %s\n", value);
  gint *i = gtk_tree_path_get_indices(path);
  g_printf("row cha = %d\n", i[0]);
}
  g_signal_connect(store, "row_changed", 
      G_CALLBACK(on_row_changed), NULL);

Now I get output like

row_inserted
value = (null)
row ins = 4
row_changed
value = Capote
row cha = 4
row_deleted
row del = 1

which indicates a sequence insert-change-delete.
At least I am understanding now what is going on and I should be able to
use it in that way in my application.

Thanks,

Stefan Salewski



_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-list




[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux