mmh, looks like im to fast in asking questions... i got the most things extracted from the keyfile. Now i have to pass that info and create a table from it. I got a bit disorientated by the manual that told me it returns a string, so i used GString instead of gchar....
crpyto_get_keyfile(){ GtkWidget *crypto_keys, *crypto_key_groups; gboolean *isfile=FALSE; gchar *startgroup; gchar **groups=NULL; //GArray *groups=NULL; gint i, *groupcounter=0, *grouplenght=NULL; GString *device, *mapperdevice, *mountpoint, *password, *keyfile; crypto_keys = g_key_file_new(); g_key_file_load_from_file(crypto_keys, "/home/Programmierung/GTK_Projects/project_dmaster/src/crypto.ini", G_KEY_FILE_NONE, NULL) ; groups = g_key_file_get_groups(crypto_keys, &grouplenght); //g_print("\n %d", grouplenght); for(i=0; i<grouplenght; i++) { //g_print("\n %s", groups[i]); device = g_key_file_get_string(crypto_keys, groups[i], "device", NULL); mapperdevice = 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_string(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", mapperdevice); g_print("\n %s", mountpoint); g_print("\n %s", password); g_print("\n %s", keyfile); } //free the strings g_strfreev(groups); } On 8/1/06, rupert <[EMAIL PROTECTED]> wrote: > > ok, im a bit further, but i cant access the array that contains the > groupnames: > groups[i] shuold give me the names, but i get an error while compiling > that the type is not compatible...? > > crpyto_get_keyfile(){ > > GtkWidget *crypto_keys, *crypto_key_groups; > gboolean *isfile=FALSE; > gchar *startgroup; > GString *groups; //GArray *groups; > gint i, *groupcounter=0, *grouplenght=NULL; > GString *mapperdevice; > > > crypto_keys = g_key_file_new(); > g_key_file_load_from_file(crypto_keys, > "/home/Programmierung/GTK_Projects/project_dmaster/src/crypto.ini", > G_KEY_FILE_NONE, NULL) ; > > groups = g_key_file_get_groups(crypto_keys, &grouplenght); > > //g_print("\n %d", grouplenght); > > for(i=0; i<grouplenght; i++) > { > > mapperdevice = g_key_file_get_string(crypto_keys, groups[i], > "mapperdevice", NULL); > g_print("\n %s", mapperdevice); > } > > } > > > On 8/1/06, rupert <[EMAIL PROTECTED]> wrote: > > > > Im playing arroung with the Gkeyfile functions and now try to get all > > groups from the keyfile and create a for loop that than shows me the > > different values, packed into strings, including the group name > > i have something like this in mind: > > > > crpyto_get_keyfile(){ > > > > GtkWidget *crypto_keys, *crypto_key_groups; > > gboolean *isfile=FALSE; > > gchar *startgroup; > > gint *groupcounter=0; > > > > crypto_keys = g_key_file_new(); > > g_key_file_load_from_file(crypto_keys, > > "/home/Programmierung/GTK_Projects/project_dmaster/src/crypto.ini", > > G_KEY_FILE_NONE, NULL) ; > > > > crypto_key_groups = g_key_file_get_groups(crypto_keys, NULL); > > > > // g_print("%s", crypto_key_groups[0]); > > //startgroup = g_key_file_get_start_group(crypto_keys); > > > > while (g_key_file_get_groups(crypto_keys, NULL)) > > { > > > > crypto_key_groups[groupcounter] = > > g_key_file_get_groups(crypto_keys, NULL); > > // g_key_file_get_string(crypto_keys, "DATEN", "mountpoint", > > NULL); > > g_print("%s", g_key_file_get_string(crypto_keys, "DATEN", > > "mountpoint", NULL)); > > } > > > > } > > > > > > > > > > maybe someone has a link for an commented example. google only gives me > > crap and its really hard for me to work only with the refernce in some > > cases. > > > > thx > > > > _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list