annotate Plugins/Visualization/paranormal/pn/pnlistoption.c @ 1523:aa1e05d66f6d trunk

[svn] - it might help if i actually ran bison on the script parser eh :)
author nenolod
date Mon, 07 Aug 2006 21:47:55 -0700
parents 0c5fdcf3f947
children 02841f72b897
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1507
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
1 /* Paranormal - A highly customizable audio visualization library
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
2 * Copyright (C) 2001 Jamie Gennis <jgennis@mindspring.com>
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
3 *
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
4 * This library is free software; you can redistribute it and/or
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
5 * modify it under the terms of the GNU Library General Public
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
6 * License as published by the Free Software Foundation; either
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
7 * version 2 of the License, or (at your option) any later version.
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
8 *
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
9 * This library is distributed in the hope that it will be useful,
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
12 * Library General Public License for more details.
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
13 *
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
14 * You should have received a copy of the GNU Library General Public
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
15 * License along with this library; if not, write to the Free
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
16 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
17 */
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
18
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
19 #include <config.h>
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
20
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
21 #include <ctype.h>
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
22 #include <glib.h>
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
23 #include "pnlistoption.h"
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
24 #include "pnxml.h"
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
25 #include "pnerror.h"
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
26
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
27 static void pn_list_option_class_init (PnListOptionClass *class);
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
28 static void pn_list_option_init (PnListOption *list_option,
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
29 PnListOptionClass *class);
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
30
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
31 /* PnUserObject methods */
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
32 static void pn_list_option_save_thyself (PnUserObject *user_object,
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
33 xmlNodePtr node);
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
34 static void pn_list_option_load_thyself (PnUserObject *user_object,
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
35 xmlNodePtr node);
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
36
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
37 static PnUserObjectClass *parent_class = NULL;
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
38
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
39 GType
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
40 pn_list_option_get_type (void)
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
41 {
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
42 static GType list_option_type = 0;
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
43
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
44 if (! list_option_type)
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
45 {
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
46 static const GTypeInfo list_option_info =
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
47 {
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
48 sizeof (PnListOptionClass),
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
49 NULL, /* base_init */
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
50 NULL, /* base_finalize */
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
51 (GClassInitFunc) pn_list_option_class_init,
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
52 NULL, /* class_finalize */
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
53 NULL, /* class_data */
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
54 sizeof (PnListOption),
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
55 0, /* n_preallocs */
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
56 (GInstanceInitFunc) pn_list_option_init
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
57 };
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
58
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
59 /* FIXME: should this be dynamic? */
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
60 list_option_type = g_type_register_static (PN_TYPE_OPTION,
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
61 "PnListOption",
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
62 &list_option_info,
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
63 0);
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
64 }
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
65 return list_option_type;
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
66 }
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
67
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
68 static void
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
69 pn_list_option_class_init (PnListOptionClass *class)
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
70 {
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
71 PnObjectClass *object_class;
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
72 PnUserObjectClass *user_object_class;
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
73 PnOptionClass *option_class;
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
74
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
75 parent_class = g_type_class_peek_parent (class);
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
76
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
77 object_class = (PnObjectClass *) class;
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
78 user_object_class = (PnUserObjectClass *) class;
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
79 option_class = (PnOptionClass *) class;
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
80
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
81 /* PnUserObject methods */
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
82 user_object_class->save_thyself = pn_list_option_save_thyself;
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
83 user_object_class->load_thyself = pn_list_option_load_thyself;
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
84
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
85 /* PnOption methods */
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
86 /* FIXME: this needs to be uncommented when the widget is done */
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
87 /* option_class->widget_type = PN_TYPE_LIST_OPTION_WIDGET; */
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
88 }
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
89
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
90 static void
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
91 pn_list_option_init (PnListOption *list_option, PnListOptionClass *class)
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
92 {
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
93 list_option->items = g_array_new (FALSE, FALSE, sizeof (const gchar *));
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
94 list_option->index = -1;
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
95 }
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
96
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
97 static void
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
98 pn_list_option_save_thyself (PnUserObject *user_object, xmlNodePtr node)
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
99 {
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
100 PnListOption *list_option;
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
101 xmlNodePtr value_node;
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
102
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
103 g_return_if_fail (user_object != NULL);
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
104 g_return_if_fail (PN_IS_LIST_OPTION (user_object));
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
105 g_return_if_fail (node != NULL);
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
106
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
107 list_option = (PnListOption *) user_object;
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
108
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
109 value_node = xmlNewChild (node, NULL, "Value", NULL);
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
110 xmlNodeSetContent (value_node, g_array_index (list_option->items, const gchar *, list_option->index));
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
111
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
112 if (parent_class->save_thyself)
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
113 parent_class->save_thyself (user_object, node);
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
114 }
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
115
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
116 static void
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
117 pn_list_option_load_thyself (PnUserObject *user_object, const xmlNodePtr node)
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
118 {
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
119 PnListOption *list_option;
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
120 xmlNodePtr list_option_node;
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
121 gchar *val_str;
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
122 guint i;
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
123
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
124 g_return_if_fail (user_object != NULL);
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
125 g_return_if_fail (PN_IS_LIST_OPTION (user_object));
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
126 g_return_if_fail (node != NULL);
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
127
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
128 list_option = (PnListOption *) user_object;
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
129
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
130 /* find the node for this class */
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
131 for (list_option_node = node->xmlChildrenNode;
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
132 list_option_node;
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
133 list_option_node = list_option_node->next)
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
134 if (g_strcasecmp (list_option_node->name, "Value") == 0)
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
135 break;
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
136 if (! list_option_node)
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
137 {
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
138 pn_error ("unable to load a PnListOption from xml node \"%s\"", node->name);
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
139 return;
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
140 }
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
141
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
142 val_str = xmlNodeGetContent (list_option_node);
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
143 if (! val_str)
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
144 goto done;
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
145
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
146 for (i=0; i < list_option->items->len; i++)
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
147 if (g_strcasecmp (val_str, g_array_index (list_option->items, const gchar *, i)) == 0)
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
148 {
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
149 list_option->index = i;
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
150 goto done;
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
151 }
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
152
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
153 pn_error ("invalid list option value encountered at xml node \"%s\"", node->name);
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
154 return;
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
155
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
156 done:
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
157 if (parent_class->load_thyself)
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
158 parent_class->load_thyself (user_object, node);
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
159 }
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
160
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
161 PnListOption*
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
162 pn_list_option_new (const gchar *name, const gchar *desc)
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
163 {
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
164 PnListOption *list_option;
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
165
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
166 g_return_val_if_fail (name != NULL, NULL);
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
167 g_return_val_if_fail (desc != NULL, NULL);
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
168
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
169 list_option = (PnListOption *) g_object_new (PN_TYPE_LIST_OPTION, NULL);
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
170
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
171 pn_user_object_set_name (PN_USER_OBJECT (list_option), name);
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
172 pn_user_object_set_description (PN_USER_OBJECT (list_option), desc);
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
173
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
174 return list_option;
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
175 }
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
176
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
177 void
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
178 pn_list_option_add_item (PnListOption *list_option, const gchar *item)
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
179 {
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
180 g_return_if_fail (list_option != NULL);
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
181 g_return_if_fail (PN_IS_LIST_OPTION (list_option));
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
182 g_return_if_fail (item != NULL);
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
183
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
184 g_array_append_val (list_option->items, item);
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
185
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
186 if (list_option->index < 0)
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
187 list_option->index = 0;
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
188 }
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
189
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
190 void
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
191 pn_list_option_set_index (PnListOption *list_option, guint index)
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
192 {
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
193 g_return_if_fail (list_option != NULL);
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
194 g_return_if_fail (PN_IS_LIST_OPTION (list_option));
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
195 g_return_if_fail (index < list_option->items->len);
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
196
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
197 list_option->index = index;
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
198 }
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
199
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
200 gint
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
201 pn_list_option_get_index (PnListOption *list_option)
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
202 {
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
203 g_return_val_if_fail (list_option != NULL, FALSE);
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
204 g_return_val_if_fail (PN_IS_LIST_OPTION (list_option), FALSE);
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
205
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
206 return list_option->index;
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
207 }