diff options
Diffstat (limited to 'src/lib/glade.c')
-rw-r--r-- | src/lib/glade.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/lib/glade.c b/src/lib/glade.c index 4bfb0f7c..180a808b 100644 --- a/src/lib/glade.c +++ b/src/lib/glade.c | |||
@@ -59,6 +59,40 @@ GNUNET_GTK_get_data_dir () | |||
59 | 59 | ||
60 | 60 | ||
61 | /** | 61 | /** |
62 | * Obtain a string from a GtkTreeView's model. | ||
63 | * | ||
64 | * @param treeview treeview to inspect | ||
65 | * @param treepath path that identifies the item | ||
66 | * @param column number of the column with the string | ||
67 | * @param value where to store the string | ||
68 | * @return TRUE on success, FALSE on errors | ||
69 | */ | ||
70 | gboolean | ||
71 | GNUNET_GTK_get_tree_string (GtkTreeView * treeview, GtkTreePath * treepath, | ||
72 | guint column, gchar ** value) | ||
73 | { | ||
74 | gboolean ok; | ||
75 | GtkTreeModel *model; | ||
76 | |||
77 | model = gtk_tree_view_get_model (treeview); | ||
78 | if (!model) | ||
79 | return FALSE; | ||
80 | |||
81 | GtkTreeIter iter; | ||
82 | |||
83 | ok = gtk_tree_model_get_iter (model, &iter, treepath); | ||
84 | if (!ok) | ||
85 | return FALSE; | ||
86 | |||
87 | *value = NULL; | ||
88 | gtk_tree_model_get (model, &iter, column, value, -1); | ||
89 | if (*value == NULL) | ||
90 | return FALSE; | ||
91 | return TRUE; | ||
92 | } | ||
93 | |||
94 | |||
95 | /** | ||
62 | * Create an initialize a new builder based on the | 96 | * Create an initialize a new builder based on the |
63 | * GNUnet-GTK glade file. | 97 | * GNUnet-GTK glade file. |
64 | * | 98 | * |