Re: GtkTreeIter assignment
- From: Vlasov Vitaly <vnigtha gmail com>
- To: David NeÄas <yeti physics muni cz>
- Cc: gtk-app-devel-list <gtk-app-devel-list gnome org>
- Subject: Re: GtkTreeIter assignment
- Date: Tue, 30 Oct 2012 18:53:18 +0400
Oops!
GtkTreeIter *default_iter --> GtkTreeIter default_iter;
It's question about:
default_iter = *iter; <-- is that normal?
I can give you more verbose example(it's pseudo-code, not C):
prepare_iter()
{
GtkTreeIter iter;
gtk_tree_store_insert_after( ... , &iter , ...);
add_new_entry(model, &iter);
}
add_new_entry(GtkTreeModel, GtkTreeIter *iter)
{
GtkTreeIter default_iter;
GtkTreeStore *store = GTK_TREE_STORE(model);
if(iter != NULL)
{
default_iter = *iter; <-- i need that
}
else gtk_tree_store_append(... , &default_iter, ...);
gtk_tree_store_set(store, &default_iter, 1, "name", -1);
}
So, i need to call add_new_entry() somewhere outside with some model and
second NULL arg.
If you're interested, this is how i doing right now:
http://pastebin.com/QKDivBub
It's work, but i don't like it.
Ð ÐÑ., 30/10/2012 Ð 14:36 +0100, David NeÄas ÐÐÑÐÑ:
On Tue, Oct 30, 2012 at 05:05:37PM +0400, Vlasov Vitaly wrote:
Is that normal, to assign one GtkTreeIter to another?
For example:
void add_new( ... , GtkTreeIter *iter)
{
GtkTreeIter *default_iter;
if(iter != NULL)
{
default_iter = iter; <-- is that noraml??
This is pointer assignment: default_iter will denote the same chunk of
memory as iter. What exactly should be abnormal here?
}
gtk_tree_store_append(&default_iter);
This is invalid code: wrong number of arguments of wrong type. And, of
course, default_iter is possibly being used uninitialised.
Yeti
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]