Getting crazy with GtkCTree widget
- From: José Carlos García Sogo <jsogo arrakis es>
- To: gtk-app-devel-list gnome org
- Subject: Getting crazy with GtkCTree widget
- Date: Tue, 26 Sep 2000 17:16:35 +0200
First of all hello! I'm new to this list.
Well, I'm writing a GTK/GNOME application called Seahorse
(http://seahorse.sourceforge.net), and for the keymanager I'm using a
CTree widget. I can build the CTree without any problem, but things
change when I want to access data in it.
When a user clicks on a button, I get the slected node through this
function:
GtkCTreeNode*
keymanager_get_selected_node (void)
{
GtkCTreeNode* node = NULL;
GList* list;
list = GTK_CLIST(keylist)->selection;
if (list != NULL)
node = GTK_CTREE_NODE(list->data);
return node;
}
This function returns me the node ok. Then I want, for example, get
the data stored in first column of the row. So I call this other
function:
gchar *
keymanager_get_username_from_node (GtkCTreeNode* node)
{
gchar **data;
if (node != NULL)
gtk_ctree_get_node_info (GTK_CTREE(keylist), node, data,
NULL,NULL,NULL,NULL,NULL,NULL,NULL);
return data[0];
}
Here starts the problems: this functions only gives me the first column
(which I want here, but no in other functions), and garbage in the
others. To solve this I need to use gtk_ctree_node_get_text to retrieve
data stored in other columns (but not in the first one! If I try with
this function it crahses!)
Well. Once I have "solved" this little problem with this hack. The REAL
problem appears. Let's see this function:
void
on_signkey_ok_clicked (GtkButton *button,
gpointer user_data)
{
[vars declaration]
[some stuff here]
node = keymanager_get_selected_node ();
type = keymanager_get_type_from_node (node);
if (type == 2) {
uidname = g_strdup (keymanager_get_username_from_node (node));
keyid = g_strdup (keymanager_get_keyid_from_node (node));
key = keyring_get_key_with_keyid (MyKeyring, keyid);
uid_nr = keyring_get_key_uid_position_with_userid (key, uidname);
free (uidname);
}
else keyid = g_strdup (keymanager_get_keyid_from_node (node));
[more stuff here]
gtk_widget_destroy (GTK_WIDGET(dialog));
display_keyring (keylist);
free (keyid);
}
As you can see I get the node, and type through two first functions.
This works.
If type == 2 I get uidname which also works, but when I try to get
keyid the program crash with a funny SIGSEGV, but if type != 2 I get
keyid properly.
So I don't know where's the problem. I'm getting crazy!
If anyone could help me I'll be very pleased.
Thank you!
----------------------------
José Carlos García Sogo
jsogo arrakis es
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]