Mercurial > pidgin.yaz
comparison src/status.c @ 10419:c9b1f3fac753
[gaim-migrate @ 11670]
Added some GaimStatusPrimitive<-->text mapping functions
Renamed the GaimStatusSaved data types to GaimSavedStatus
Modifying a status will now bring up an editor thing with the
correct values set
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Sun, 26 Dec 2004 02:03:14 +0000 |
parents | bed2c96bc1fb |
children | 6feef0a9098a |
comparison
equal
deleted
inserted
replaced
10418:bed2c96bc1fb | 10419:c9b1f3fac753 |
---|---|
139 | 139 |
140 #define SCORE_IDLE 5 | 140 #define SCORE_IDLE 5 |
141 #define SCORE_IDLE_TIME 6 | 141 #define SCORE_IDLE_TIME 6 |
142 | 142 |
143 /************************************************************************** | 143 /************************************************************************** |
144 * GaimStatusPrimitive API | |
145 **************************************************************************/ | |
146 static struct GaimStatusPrimitiveMap | |
147 { | |
148 GaimStatusPrimitive type; | |
149 const char *id; | |
150 const char *name; | |
151 | |
152 } const status_primitive_map[] = | |
153 { | |
154 { GAIM_STATUS_UNSET, "unset", N_("Unset") }, | |
155 { GAIM_STATUS_OFFLINE, "offline", N_("Offline") }, | |
156 { GAIM_STATUS_ONLINE, "online", N_("Online") }, | |
157 { GAIM_STATUS_AVAILABLE, "available", N_("Available") }, | |
158 { GAIM_STATUS_UNAVAILABLE, "unavailable", N_("Unavailable") }, | |
159 { GAIM_STATUS_HIDDEN, "hidden", N_("Hidden") }, | |
160 { GAIM_STATUS_AWAY, "away", N_("Away") }, | |
161 { GAIM_STATUS_EXTENDED_AWAY, "extended_away", N_("Extended Away") } | |
162 }; | |
163 | |
164 const char * | |
165 gaim_primitive_get_id_from_type(GaimStatusPrimitive type) | |
166 { | |
167 int i; | |
168 | |
169 for (i = 0; i < GAIM_STATUS_NUM_PRIMITIVES; i++) | |
170 { | |
171 if (type == status_primitive_map[i].type) | |
172 return status_primitive_map[i].id; | |
173 } | |
174 | |
175 return status_primitive_map[0].id; | |
176 } | |
177 | |
178 const char * | |
179 gaim_primitive_get_name_from_type(GaimStatusPrimitive type) | |
180 { | |
181 int i; | |
182 | |
183 for (i = 0; i < GAIM_STATUS_NUM_PRIMITIVES; i++) | |
184 { | |
185 if (type == status_primitive_map[i].type) | |
186 return status_primitive_map[i].name; | |
187 } | |
188 | |
189 return status_primitive_map[0].name; | |
190 } | |
191 | |
192 GaimStatusPrimitive | |
193 gaim_primitive_get_type_from_id(const char *id) | |
194 { | |
195 int i; | |
196 | |
197 g_return_val_if_fail(id != NULL, GAIM_STATUS_UNSET); | |
198 | |
199 for (i = 0; i < GAIM_STATUS_NUM_PRIMITIVES; i++) | |
200 { | |
201 if (!strcmp(id, status_primitive_map[i].id)) | |
202 return status_primitive_map[i].type; | |
203 } | |
204 | |
205 return status_primitive_map[0].type; | |
206 } | |
207 | |
208 | |
209 /************************************************************************** | |
144 * GaimStatusType API | 210 * GaimStatusType API |
145 **************************************************************************/ | 211 **************************************************************************/ |
146 GaimStatusType * | 212 GaimStatusType * |
147 gaim_status_type_new_full(GaimStatusPrimitive primitive, const char *id, | 213 gaim_status_type_new_full(GaimStatusPrimitive primitive, const char *id, |
148 const char *name, gboolean saveable, | 214 const char *name, gboolean saveable, |