Re: Hmm looks like gtk_tree_store_remove is broken?
- From: Mikael Hermansson <tyan linux se>
- To: Mikael Hermansson <tyan linux se>
- Cc: gtk-devel-list gnome org, jrb redhat com
- Subject: Re: Hmm looks like gtk_tree_store_remove is broken?
- Date: Fri, 8 Jun 2001 19:21:48 +0200
Forget this bugreport it was an stupid error in my code.
The routine was connected to "expand_row" signal.
And everytime I expand the row I wanted it to remove childnodes
and insert the "fresh" nodes.
But I forgot i needed to call gtk_tree_view_expand_row manually
after new insertion of nodes.
Greets
M.H.
On 2001.06.08 18:56 Mikael Hermansson wrote:
> If I'm removing all child node in a parent node and append new
> again (in the same parent node) the newly inserted node doesn't show:
>
> Example:
>
> GtkTreeIter iter,parentiter;
> int selid = 1;
>
> /* lookup the parent object */
> /* returns TRUE on success */
> if (!tree_find_albumid(selid, &parentiter))
> {
> cout << "didn't find album iterator???" << endl;
> return ;
> }
>
> /* remove all child objects to parentiter */
>
> while (gtk_tree_model_iter_children(treemodel, &iter,&piter))
> gtk_tree_store_remove(GTK_TREE_STORE(treemodel), &iter);
>
> /* now when were empty try insert some new again but first we
> make sure parent iter really is pointing correcly: */
>
>
> if (!tree_find_albumid(selid, &parentiter))
> {
> cout << "did't find album iterator" << endl;
> return ;
> }
>
>
> /* for some reason below code does NOT WORK ??? */
> /* because the newly inserted node doesn't show??? */
>
> gtk_tree_store_append(GTK_TREE_STORE(*treemodel), &iter, &parentiter);
>
>
> bool MyApp::tree_find_albumid(int id, GtkTreeIter *iter)
> {
> gchar *txt[1];
> gtk_tree_model_get_first(treemodel, iter);
> do {
> gtk_tree_model_get(treemodel, iter, 0, txt, -1);
> if(id == atoi(txt[0])) {
> g_free(txt[0]);
> return true;
> }
>
> g_free(txt[0]);
> } while(gtk_tree_model_iter_next(treemodel,iter));
>
> return false;
> }
>
> _______________________________________________
> gtk-devel-list mailing list
> gtk-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-devel-list
>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]