Moving items in a GtkList



I want to move an item in a GtkList, but i can't get it to work.

I use this callback from an button, it's supposed to move the selected item 
one row up.

static void
attributes_list_move_up_callback(GtkWidget *button,
				 UMLClass *umlclass)
{
  GList *list;
  UMLClassDialog *prop_dialog;
  GtkList *gtklist;
  GtkWidget *list_item;
  int i;

  prop_dialog = umlclass->properties_dialog;
  gtklist = GTK_LIST(prop_dialog->attributes_list);

  if (gtklist->selection != NULL) {
    list_item = GTK_WIDGET(gtklist->selection->data);
    i = gtk_list_child_position(gtklist, list_item);
    if (i>0)
      i--;

    list = g_list_prepend(NULL, list_item);

    gtk_list_unselect_child(gtklist, list_item);
    gtk_list_remove_items_no_unref(gtklist, list);
    gtk_list_insert_items(gtklist, list, i);
    
    g_list_free(list);
  }
}

What happens is that the selected item is deleted and i get a lot of:
** WARNING **: invalid cast from `(unknown)' to `GtkObject'

Any tips?

/ Alex












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