Created
March 13, 2011 06:42
-
-
Save dmitryvk/867930 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <gtk/gtk.h> | |
int main (int argc, char * argv[]) | |
{ | |
gtk_init(&argc, &argv); | |
GtkListStore* store = gtk_list_store_new(1, G_TYPE_VALUE); | |
GValue v = { 0 }; | |
GtkTreeIter iter; | |
gtk_list_store_append(store, &iter); | |
g_value_init(&v, G_TYPE_INT); | |
g_value_set_int(&v, 10); | |
GValue gv = { 0 }; | |
g_value_init(&gv, G_TYPE_VALUE); | |
g_value_set_boxed(&gv, &v); | |
gtk_list_store_set_value(store, &iter, 0, &gv); | |
GValue gv2 = { 0 }; | |
gtk_tree_model_get_value((GtkTreeModel*)store, &iter, 0, &gv2); | |
printf("gv2 holds %s\n", g_type_name(G_VALUE_TYPE(&gv2))); | |
GValue * gv3 = (GValue*)g_value_get_boxed(&gv2); | |
printf("gv3 holds %s\n", g_type_name(G_VALUE_TYPE(gv3))); | |
int int_v = g_value_get_int(gv3); | |
printf("int_v = %d\n", int_v); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment