Mercurial > pidgin.yaz
comparison src/status.c @ 12595:3169cd6727ad
[gaim-migrate @ 14925]
I've been meaning to spend the time to commit these changes separately, but it's been a couple days without me finding the time...
1. Allow the creation of GaimStatusTypes by passing NULL for the name and/or id. The core uses the default name and/or id. This eliminates quite a bit of duplication in the prpls.
2. Make statuses more consistent. For example, in some prpls, "Busy" was descended from the UNAVAILABLE primitive and on others it was a case of AWAY. Another example... "On Vacation" is definitely an EXTENDED_AWAY not an AWAY.
3. Rename some pixmaps to elminate some special cases. The names of the pixmaps should now match the primitive default IDs.
4. Rename the HIDDEN primitive to INVISIBLE, since we seem to be using that term everywhere. In conjunction with #1, more duplication was eliminated.
5. Add a MOBILE status primitive. It's not used now. It'll be needed in the (hopefully not-too-distant) future, so I'm planning ahead.
6. Shrink the status select for small blist folks. Now if someone can get rid of that stupid extra padding, we'll be set (well, after we deal with imhtml space issues). I've fought with this for many many hours over several days and I can't get it. It's clear that the combo box is requesting more space than is really necessary, but I don't know why.
This is really my first go at anything significant status-related. Everyone should check their favorite prpls carefully to make sure I didn't break anything.
committer: Tailor Script <tailor@pidgin.im>
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Wed, 21 Dec 2005 08:24:17 +0000 |
parents | 8afd25a37b35 |
children | 57462d6542ea |
comparison
equal
deleted
inserted
replaced
12594:3d34460ecfd6 | 12595:3169cd6727ad |
---|---|
124 { | 124 { |
125 0, /* unset */ | 125 0, /* unset */ |
126 -500, /* offline */ | 126 -500, /* offline */ |
127 100, /* available */ | 127 100, /* available */ |
128 -75, /* unavailable */ | 128 -75, /* unavailable */ |
129 -50, /* hidden */ | 129 -50, /* invisible */ |
130 -100, /* away */ | 130 -100, /* away */ |
131 -200, /* extended away */ | 131 -200, /* extended away */ |
132 -400, /* mobile */ | |
132 -10, /* idle, special case. */ | 133 -10, /* idle, special case. */ |
133 -5 /* idle time, special case. */ | 134 -5 /* idle time, special case. */ |
134 }; | 135 }; |
135 | 136 |
136 static GHashTable *buddy_presences = NULL; | 137 static GHashTable *buddy_presences = NULL; |
151 { | 152 { |
152 { GAIM_STATUS_UNSET, "unset", N_("Unset") }, | 153 { GAIM_STATUS_UNSET, "unset", N_("Unset") }, |
153 { GAIM_STATUS_OFFLINE, "offline", N_("Offline") }, | 154 { GAIM_STATUS_OFFLINE, "offline", N_("Offline") }, |
154 { GAIM_STATUS_AVAILABLE, "available", N_("Available") }, | 155 { GAIM_STATUS_AVAILABLE, "available", N_("Available") }, |
155 { GAIM_STATUS_UNAVAILABLE, "unavailable", N_("Unavailable") }, | 156 { GAIM_STATUS_UNAVAILABLE, "unavailable", N_("Unavailable") }, |
156 { GAIM_STATUS_HIDDEN, "hidden", N_("Hidden") }, | 157 { GAIM_STATUS_INVISIBLE, "invisible", N_("Invisible") }, |
157 { GAIM_STATUS_AWAY, "away", N_("Away") }, | 158 { GAIM_STATUS_AWAY, "away", N_("Away") }, |
158 { GAIM_STATUS_EXTENDED_AWAY, "extended_away", N_("Extended Away") } | 159 { GAIM_STATUS_EXTENDED_AWAY, "extended_away", N_("Extended Away") }, |
160 { GAIM_STATUS_MOBILE, "mobile", N_("Mobile") } | |
159 }; | 161 }; |
160 | 162 |
161 const char * | 163 const char * |
162 gaim_primitive_get_id_from_type(GaimStatusPrimitive type) | 164 gaim_primitive_get_id_from_type(GaimStatusPrimitive type) |
163 { | 165 { |
177 { | 179 { |
178 int i; | 180 int i; |
179 | 181 |
180 for (i = 0; i < GAIM_STATUS_NUM_PRIMITIVES; i++) | 182 for (i = 0; i < GAIM_STATUS_NUM_PRIMITIVES; i++) |
181 { | 183 { |
182 if (type == status_primitive_map[i].type) | 184 if (type == status_primitive_map[i].type) |
183 return status_primitive_map[i].name; | 185 return status_primitive_map[i].name; |
184 } | 186 } |
185 | 187 |
186 return status_primitive_map[0].name; | 188 return status_primitive_map[0].name; |
187 } | 189 } |
188 | 190 |
212 gboolean user_settable, gboolean independent) | 214 gboolean user_settable, gboolean independent) |
213 { | 215 { |
214 GaimStatusType *status_type; | 216 GaimStatusType *status_type; |
215 | 217 |
216 g_return_val_if_fail(primitive != GAIM_STATUS_UNSET, NULL); | 218 g_return_val_if_fail(primitive != GAIM_STATUS_UNSET, NULL); |
217 g_return_val_if_fail(id != NULL, NULL); | |
218 g_return_val_if_fail(name != NULL, NULL); | |
219 | 219 |
220 status_type = g_new0(GaimStatusType, 1); | 220 status_type = g_new0(GaimStatusType, 1); |
221 GAIM_DBUS_REGISTER_POINTER(status_type, GaimStatusType); | 221 GAIM_DBUS_REGISTER_POINTER(status_type, GaimStatusType); |
222 | 222 |
223 status_type->primitive = primitive; | 223 status_type->primitive = primitive; |
224 status_type->id = g_strdup(id); | |
225 status_type->name = g_strdup(name); | |
226 status_type->saveable = saveable; | 224 status_type->saveable = saveable; |
227 status_type->user_settable = user_settable; | 225 status_type->user_settable = user_settable; |
228 status_type->independent = independent; | 226 status_type->independent = independent; |
229 | 227 |
228 if (id != NULL) | |
229 status_type->id = g_strdup(id); | |
230 else | |
231 status_type->id = g_strdup(gaim_primitive_get_id_from_type(primitive)); | |
232 | |
233 if (name != NULL) | |
234 status_type->name = g_strdup(name); | |
235 else | |
236 status_type->name = g_strdup(_(gaim_primitive_get_name_from_type(primitive))); | |
237 | |
230 return status_type; | 238 return status_type; |
231 } | 239 } |
232 | 240 |
233 GaimStatusType * | 241 GaimStatusType * |
234 gaim_status_type_new(GaimStatusPrimitive primitive, const char *id, | 242 gaim_status_type_new(GaimStatusPrimitive primitive, const char *id, |
235 const char *name, gboolean user_settable) | 243 const char *name, gboolean user_settable) |
236 { | 244 { |
237 g_return_val_if_fail(primitive != GAIM_STATUS_UNSET, NULL); | 245 g_return_val_if_fail(primitive != GAIM_STATUS_UNSET, NULL); |
238 g_return_val_if_fail(id != NULL, NULL); | |
239 g_return_val_if_fail(name != NULL, NULL); | |
240 | 246 |
241 return gaim_status_type_new_full(primitive, id, name, FALSE, | 247 return gaim_status_type_new_full(primitive, id, name, FALSE, |
242 user_settable, FALSE); | 248 user_settable, FALSE); |
243 } | 249 } |
244 | 250 |
252 { | 258 { |
253 GaimStatusType *status_type; | 259 GaimStatusType *status_type; |
254 va_list args; | 260 va_list args; |
255 | 261 |
256 g_return_val_if_fail(primitive != GAIM_STATUS_UNSET, NULL); | 262 g_return_val_if_fail(primitive != GAIM_STATUS_UNSET, NULL); |
257 g_return_val_if_fail(id != NULL, NULL); | |
258 g_return_val_if_fail(name != NULL, NULL); | |
259 g_return_val_if_fail(attr_id != NULL, NULL); | 263 g_return_val_if_fail(attr_id != NULL, NULL); |
260 g_return_val_if_fail(attr_name != NULL, NULL); | 264 g_return_val_if_fail(attr_name != NULL, NULL); |
261 g_return_val_if_fail(attr_value != NULL, NULL); | 265 g_return_val_if_fail(attr_value != NULL, NULL); |
262 | 266 |
263 status_type = gaim_status_type_new_full(primitive, id, name, saveable, | 267 status_type = gaim_status_type_new_full(primitive, id, name, saveable, |
1694 | 1698 |
1695 gaim_prefs_add_int("/core/status/scores/offline", | 1699 gaim_prefs_add_int("/core/status/scores/offline", |
1696 primitive_scores[GAIM_STATUS_OFFLINE]); | 1700 primitive_scores[GAIM_STATUS_OFFLINE]); |
1697 gaim_prefs_add_int("/core/status/scores/available", | 1701 gaim_prefs_add_int("/core/status/scores/available", |
1698 primitive_scores[GAIM_STATUS_AVAILABLE]); | 1702 primitive_scores[GAIM_STATUS_AVAILABLE]); |
1699 gaim_prefs_add_int("/core/status/scores/hidden", | 1703 gaim_prefs_add_int("/core/status/scores/invisible", |
1700 primitive_scores[GAIM_STATUS_HIDDEN]); | 1704 primitive_scores[GAIM_STATUS_INVISIBLE]); |
1701 gaim_prefs_add_int("/core/status/scores/away", | 1705 gaim_prefs_add_int("/core/status/scores/away", |
1702 primitive_scores[GAIM_STATUS_AWAY]); | 1706 primitive_scores[GAIM_STATUS_AWAY]); |
1703 gaim_prefs_add_int("/core/status/scores/extended_away", | 1707 gaim_prefs_add_int("/core/status/scores/extended_away", |
1704 primitive_scores[GAIM_STATUS_EXTENDED_AWAY]); | 1708 primitive_scores[GAIM_STATUS_EXTENDED_AWAY]); |
1705 gaim_prefs_add_int("/core/status/scores/idle", | 1709 gaim_prefs_add_int("/core/status/scores/idle", |
1709 score_pref_changed_cb, | 1713 score_pref_changed_cb, |
1710 GINT_TO_POINTER(GAIM_STATUS_OFFLINE)); | 1714 GINT_TO_POINTER(GAIM_STATUS_OFFLINE)); |
1711 gaim_prefs_connect_callback(handle, "/core/status/scores/available", | 1715 gaim_prefs_connect_callback(handle, "/core/status/scores/available", |
1712 score_pref_changed_cb, | 1716 score_pref_changed_cb, |
1713 GINT_TO_POINTER(GAIM_STATUS_AVAILABLE)); | 1717 GINT_TO_POINTER(GAIM_STATUS_AVAILABLE)); |
1714 gaim_prefs_connect_callback(handle, "/core/status/scores/hidden", | 1718 gaim_prefs_connect_callback(handle, "/core/status/scores/invisible", |
1715 score_pref_changed_cb, | 1719 score_pref_changed_cb, |
1716 GINT_TO_POINTER(GAIM_STATUS_HIDDEN)); | 1720 GINT_TO_POINTER(GAIM_STATUS_INVISIBLE)); |
1717 gaim_prefs_connect_callback(handle, "/core/status/scores/away", | 1721 gaim_prefs_connect_callback(handle, "/core/status/scores/away", |
1718 score_pref_changed_cb, | 1722 score_pref_changed_cb, |
1719 GINT_TO_POINTER(GAIM_STATUS_AWAY)); | 1723 GINT_TO_POINTER(GAIM_STATUS_AWAY)); |
1720 gaim_prefs_connect_callback(handle, "/core/status/scores/extended_away", | 1724 gaim_prefs_connect_callback(handle, "/core/status/scores/extended_away", |
1721 score_pref_changed_cb, | 1725 score_pref_changed_cb, |