Re: Key-value file parser, howto get all groups and create loop from them
- From: rupert <rupertt gmail com>
- To: "Peter Firefly Lund" <firefly diku dk>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Key-value file parser, howto get all groups and create loop from them
- Date: Mon, 14 Aug 2006 13:53:40 +0200
On 8/14/06, Peter Firefly Lund <firefly diku dk> wrote:
On Mon, 14 Aug 2006, rupert wrote:
Strangely the function seems to stop, because i only get 1 test on the
bash:
(cryptomaster:11056): Gtk-CRITICAL **: gtk_list_store_set: assertion
`iter->stamp == list_store->stamp' failed
And how, pray tell, do you get your iterator initialized? ;)
The snippet you showed just copied the iterator in the struct into your
local iterator -- but how do you get a sensible value into the iterator in
the struct?
mmh, i have a function that fills the treeview
void make_list(GtkListStore *store, GtkTreeIter iter, gpointer
pixbuf_mapper_yes, gpointer pixbuf_mapper_no, gpointer pixbuf_mount_yes,
gpointer pixbuf_mount_no){
GKeyFile *crypto_keys;
gchar **groups;
gint i;
gsize grouplength;
gchar *device=NULL, *mapper=NULL, *mountpoint=NULL, *keyfile=NULL;
gboolean password;
GdkPixbuf *pixbuf_mapper=NULL, *pixbuf_mount=NULL;
crypto_keys = g_key_file_new();
g_key_file_load_from_file(crypto_keys,
"/home/Programmierung/GTK_Projects/crypto_master/src/crypto.ini",
G_KEY_FILE_NONE, NULL) ;
groups = g_key_file_get_groups(crypto_keys, &grouplength);
for(i=0; i<grouplength; i++)
{
// g_print("NR: %d\n", i);
device = g_key_file_get_string(crypto_keys, groups[i], "device",
NULL);
mapper = g_key_file_get_string(crypto_keys, groups[i],
"mapperdevice", NULL);
mountpoint = g_key_file_get_string(crypto_keys, groups[i],
"mountpoint", NULL);
password = g_key_file_get_boolean(crypto_keys, groups[i],
"password", NULL);
keyfile = g_key_file_get_string(crypto_keys, groups[i], "keyfile",
NULL);
//g_print("\n %s", device);
//g_print("\n %s", mapper);
//g_print("\n %s", mountpoint);
//g_print("\n %s", password);
//g_print("\n %s", keyfile);
if(crypto_mapper_check(mapper))
pixbuf_mapper = pixbuf_mapper_yes;
else
pixbuf_mapper = pixbuf_mapper_no;
//mapper = g_key_file_get_string(crypto_keys, groups[i],
"mapperdevice", NULL);
if(crypto_mount_check(mountpoint))
pixbuf_mount = pixbuf_mount_yes;
else
pixbuf_mount = pixbuf_mount_no;
//mountpoint = g_key_file_get_string(crypto_keys, groups[i],
"mountpoint", NULL);
gtk_list_store_append(store, &iter);
gtk_list_store_set(store, &iter,
INIT_COLUMN, pixbuf_mapper,
MOUNT_COLUMN, pixbuf_mount,
DEVICE_COLUMN, device,
NAME_COLUMN, mapper,
MOUNTPOINT_COLUMN, mountpoint,
PASSKEY_COLUMN, keyfile,
-1);
//g_print("PASS: %d", password);
if(password)
gtk_list_store_set(store, &iter, PASSKEY_COLUMN, NULL, -1);
}
/* free the strings */
g_strfreev(groups);
g_free(device);
g_free(mapper);
g_free(mountpoint);
// g_free(password);
g_free(keyfile);
g_object_unref(pixbuf_mapper);
g_object_unref(pixbuf_mount);
}
which gets started here, before the timeout
make_list(treedata.store, treedata.iter, treedata.pixbuf_mapper_yes,
treedata.pixbuf_mapper_no, treedata.pixbuf_mount_yes,
treedata.pixbuf_mount_no);
hope thats the part you are asking for
-Peter
- References:
- Key-value file parser, howto get all groups and create loop from them
- Re: Key-value file parser, howto get all groups and create loop from them
- Re: Key-value file parser, howto get all groups and create loop from them
- Re: Key-value file parser, howto get all groups and create loop from them
- From: David =?iso-8859-2?B?TmXoYXMgKFlldGkp?=
- Re: Key-value file parser, howto get all groups and create loop from them
- Re: Key-value file parser, howto get all groups and create loop from them
- From: David =?iso-8859-2?B?TmXoYXMgKFlldGkp?=
- Re: Key-value file parser, howto get all groups and create loop from them
- Re: Key-value file parser, howto get all groups and create loop from them
- Re: Key-value file parser, howto get all groups and create loop from them
- Re: Key-value file parser, howto get all groups and create loop from them
- From: Peter \"Firefly\" Lund
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]