comparison pidgin/gtkblist-theme.c @ 29471:d83ee160ffb6

propagate from branch 'im.pidgin.pidgin' (head eb9385f349a20856b9d3f9911dbc8024caa44052) to branch 'im.pidgin.pidgin.next.minor' (head 439fb2dd7a285d9ca645f65f36ef0f037abe7311)
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Wed, 19 Aug 2009 00:46:04 +0000
parents 348967766bbc
children 12cef8d4feb1
comparison
equal deleted inserted replaced
29470:7a3458436140 29471:d83ee160ffb6
18 * You should have received a copy of the GNU General Public License 18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software 19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
21 */ 21 */
22 22
23 #include "internal.h"
23 #include "gtkblist-theme.h" 24 #include "gtkblist-theme.h"
24 25
25 #define PIDGIN_BLIST_THEME_GET_PRIVATE(Gobject) \ 26 #define PIDGIN_BLIST_THEME_GET_PRIVATE(Gobject) \
26 ((PidginBlistThemePrivate *) ((PIDGIN_BLIST_THEME(Gobject))->priv)) 27 ((PidginBlistThemePrivate *) ((PIDGIN_BLIST_THEME(Gobject))->priv))
27 28
35 GdkColor *bgcolor; 36 GdkColor *bgcolor;
36 PidginBlistLayout *layout; 37 PidginBlistLayout *layout;
37 38
38 /* groups */ 39 /* groups */
39 GdkColor *expanded_color; 40 GdkColor *expanded_color;
40 FontColorPair *expanded; 41 PidginThemeFont *expanded;
41 42
42 GdkColor *collapsed_color; 43 GdkColor *collapsed_color;
43 FontColorPair *collapsed; 44 PidginThemeFont *collapsed;
44 45
45 /* buddy */ 46 /* buddy */
46 GdkColor *contact_color; 47 GdkColor *contact_color;
47 48
48 FontColorPair *contact; 49 PidginThemeFont *contact;
49 50
50 FontColorPair *online; 51 PidginThemeFont *online;
51 FontColorPair *away; 52 PidginThemeFont *away;
52 FontColorPair *offline; 53 PidginThemeFont *offline;
53 FontColorPair *idle; 54 PidginThemeFont *idle;
54 FontColorPair *message; 55 PidginThemeFont *message;
55 FontColorPair *message_nick_said; 56 PidginThemeFont *message_nick_said;
56 57
57 FontColorPair *status; 58 PidginThemeFont *status;
58 59
59 } PidginBlistThemePrivate; 60 } PidginBlistThemePrivate;
61
62 struct _PidginThemeFont
63 {
64 gchar *font;
65 gchar color[10];
66 GdkColor *gdkcolor;
67 };
60 68
61 /****************************************************************************** 69 /******************************************************************************
62 * Globals 70 * Globals
63 *****************************************************************************/ 71 *****************************************************************************/
64 72
90 98
91 /****************************************************************************** 99 /******************************************************************************
92 * Helpers 100 * Helpers
93 *****************************************************************************/ 101 *****************************************************************************/
94 102
95 void 103 PidginThemeFont *
96 free_font_and_color(FontColorPair *pair) 104 pidgin_theme_font_new(const gchar *face, GdkColor *color)
105 {
106 PidginThemeFont *font = g_new0(PidginThemeFont, 1);
107 font->font = g_strdup(face);
108 if (color)
109 pidgin_theme_font_set_color(font, color);
110 return font;
111 }
112
113 void
114 pidgin_theme_font_free(PidginThemeFont *pair)
97 { 115 {
98 if (pair != NULL) { 116 if (pair != NULL) {
99 if (pair->font) 117 g_free(pair->font);
100 g_free(pair->font); 118 if (pair->gdkcolor)
101 if (pair->color) 119 gdk_color_free(pair->gdkcolor);
102 g_free(pair->color);
103 g_free(pair); 120 g_free(pair);
104 } 121 }
122 }
123
124 static PidginThemeFont *
125 copy_font_and_color(const PidginThemeFont *pair)
126 {
127 PidginThemeFont *copy;
128
129 if (pair == NULL)
130 return NULL;
131
132 copy = g_new0(PidginThemeFont, 1);
133 copy->font = g_strdup(pair->font);
134 strncpy(copy->color, pair->color, sizeof(copy->color) - 1);
135 if (pair->gdkcolor)
136 copy->gdkcolor = gdk_color_copy(pair->gdkcolor);
137 return copy;
138 }
139
140 void
141 pidgin_theme_font_set_font_face(PidginThemeFont *font, const gchar *face)
142 {
143 g_return_if_fail(font);
144 g_return_if_fail(face);
145
146 g_free(font->font);
147 font->font = g_strdup(face);
148 }
149
150 void
151 pidgin_theme_font_set_color(PidginThemeFont *font, const GdkColor *color)
152 {
153 g_return_if_fail(font);
154
155 if (font->gdkcolor)
156 gdk_color_free(font->gdkcolor);
157
158 font->gdkcolor = color ? gdk_color_copy(color) : NULL;
159 if (color)
160 g_snprintf(font->color, sizeof(font->color),
161 "#%02x%02x%02x", color->red >> 8, color->green >> 8, color->blue >> 8);
162 else
163 font->color[0] = '\0';
164 }
165
166 const gchar *
167 pidgin_theme_font_get_font_face(PidginThemeFont *font)
168 {
169 g_return_val_if_fail(font, NULL);
170 return font->font;
171 }
172
173 const GdkColor *
174 pidgin_theme_font_get_color(PidginThemeFont *font)
175 {
176 g_return_val_if_fail(font, NULL);
177 return font->gdkcolor;
178 }
179
180 const gchar *
181 pidgin_theme_font_get_color_describe(PidginThemeFont *font)
182 {
183 g_return_val_if_fail(font, NULL);
184 return font->color[0] ? font->color : NULL;
105 } 185 }
106 186
107 /****************************************************************************** 187 /******************************************************************************
108 * GObject Stuff 188 * GObject Stuff
109 *****************************************************************************/ 189 *****************************************************************************/
121 { 201 {
122 PidginBlistTheme *theme = PIDGIN_BLIST_THEME(obj); 202 PidginBlistTheme *theme = PIDGIN_BLIST_THEME(obj);
123 203
124 switch (param_id) { 204 switch (param_id) {
125 case PROP_BACKGROUND_COLOR: 205 case PROP_BACKGROUND_COLOR:
126 g_value_set_pointer(value, pidgin_blist_theme_get_background_color(theme)); 206 g_value_set_boxed(value, pidgin_blist_theme_get_background_color(theme));
127 break; 207 break;
128 case PROP_OPACITY: 208 case PROP_OPACITY:
129 g_value_set_double(value, pidgin_blist_theme_get_opacity(theme)); 209 g_value_set_double(value, pidgin_blist_theme_get_opacity(theme));
130 break; 210 break;
131 case PROP_LAYOUT: 211 case PROP_LAYOUT:
132 g_value_set_pointer(value, pidgin_blist_theme_get_layout(theme)); 212 g_value_set_pointer(value, pidgin_blist_theme_get_layout(theme));
133 break; 213 break;
134 case PROP_EXPANDED_COLOR: 214 case PROP_EXPANDED_COLOR:
135 g_value_set_pointer(value, pidgin_blist_theme_get_expanded_background_color(theme)); 215 g_value_set_boxed(value, pidgin_blist_theme_get_expanded_background_color(theme));
136 break; 216 break;
137 case PROP_EXPANDED_TEXT: 217 case PROP_EXPANDED_TEXT:
138 g_value_set_pointer(value, pidgin_blist_theme_get_expanded_text_info(theme)); 218 g_value_set_pointer(value, pidgin_blist_theme_get_expanded_text_info(theme));
139 break; 219 break;
140 case PROP_COLLAPSED_COLOR: 220 case PROP_COLLAPSED_COLOR:
141 g_value_set_pointer(value, pidgin_blist_theme_get_collapsed_background_color(theme)); 221 g_value_set_boxed(value, pidgin_blist_theme_get_collapsed_background_color(theme));
142 break; 222 break;
143 case PROP_COLLAPSED_TEXT: 223 case PROP_COLLAPSED_TEXT:
144 g_value_set_pointer(value, pidgin_blist_theme_get_collapsed_text_info(theme)); 224 g_value_set_pointer(value, pidgin_blist_theme_get_collapsed_text_info(theme));
145 break; 225 break;
146 case PROP_CONTACT_COLOR: 226 case PROP_CONTACT_COLOR:
147 g_value_set_pointer(value, pidgin_blist_theme_get_contact_color(theme)); 227 g_value_set_boxed(value, pidgin_blist_theme_get_contact_color(theme));
148 break; 228 break;
149 case PROP_CONTACT: 229 case PROP_CONTACT:
150 g_value_set_pointer(value, pidgin_blist_theme_get_contact_text_info(theme)); 230 g_value_set_pointer(value, pidgin_blist_theme_get_contact_text_info(theme));
151 break; 231 break;
152 case PROP_ONLINE: 232 case PROP_ONLINE:
182 { 262 {
183 PidginBlistTheme *theme = PIDGIN_BLIST_THEME(obj); 263 PidginBlistTheme *theme = PIDGIN_BLIST_THEME(obj);
184 264
185 switch (param_id) { 265 switch (param_id) {
186 case PROP_BACKGROUND_COLOR: 266 case PROP_BACKGROUND_COLOR:
187 pidgin_blist_theme_set_background_color(theme, g_value_get_pointer(value)); 267 pidgin_blist_theme_set_background_color(theme, g_value_get_boxed(value));
188 break; 268 break;
189 case PROP_OPACITY: 269 case PROP_OPACITY:
190 pidgin_blist_theme_set_opacity(theme, g_value_get_double(value)); 270 pidgin_blist_theme_set_opacity(theme, g_value_get_double(value));
191 break; 271 break;
192 case PROP_LAYOUT: 272 case PROP_LAYOUT:
193 pidgin_blist_theme_set_layout(theme, g_value_get_pointer(value)); 273 pidgin_blist_theme_set_layout(theme, g_value_get_pointer(value));
194 break; 274 break;
195 case PROP_EXPANDED_COLOR: 275 case PROP_EXPANDED_COLOR:
196 pidgin_blist_theme_set_expanded_background_color(theme, g_value_get_pointer(value)); 276 pidgin_blist_theme_set_expanded_background_color(theme, g_value_get_boxed(value));
197 break; 277 break;
198 case PROP_EXPANDED_TEXT: 278 case PROP_EXPANDED_TEXT:
199 pidgin_blist_theme_set_expanded_text_info(theme, g_value_get_pointer(value)); 279 pidgin_blist_theme_set_expanded_text_info(theme, g_value_get_pointer(value));
200 break; 280 break;
201 case PROP_COLLAPSED_COLOR: 281 case PROP_COLLAPSED_COLOR:
202 pidgin_blist_theme_set_collapsed_background_color(theme, g_value_get_pointer(value)); 282 pidgin_blist_theme_set_collapsed_background_color(theme, g_value_get_boxed(value));
203 break; 283 break;
204 case PROP_COLLAPSED_TEXT: 284 case PROP_COLLAPSED_TEXT:
205 pidgin_blist_theme_set_collapsed_text_info(theme, g_value_get_pointer(value)); 285 pidgin_blist_theme_set_collapsed_text_info(theme, g_value_get_pointer(value));
206 break; 286 break;
207 case PROP_CONTACT_COLOR: 287 case PROP_CONTACT_COLOR:
208 pidgin_blist_theme_set_contact_color(theme, g_value_get_pointer(value)); 288 pidgin_blist_theme_set_contact_color(theme, g_value_get_boxed(value));
209 break; 289 break;
210 case PROP_CONTACT: 290 case PROP_CONTACT:
211 pidgin_blist_theme_set_contact_text_info(theme, g_value_get_pointer(value)); 291 pidgin_blist_theme_set_contact_text_info(theme, g_value_get_pointer(value));
212 break; 292 break;
213 case PROP_ONLINE: 293 case PROP_ONLINE:
243 PidginBlistThemePrivate *priv; 323 PidginBlistThemePrivate *priv;
244 324
245 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(obj); 325 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(obj);
246 326
247 /* Buddy List */ 327 /* Buddy List */
328 if (priv->bgcolor)
329 gdk_color_free(priv->bgcolor);
248 g_free(priv->layout); 330 g_free(priv->layout);
249 331
250 /* Group */ 332 /* Group */
251 free_font_and_color(priv->expanded); 333 if (priv->expanded_color)
252 free_font_and_color(priv->collapsed); 334 gdk_color_free(priv->expanded_color);
335 pidgin_theme_font_free(priv->expanded);
336 if (priv->collapsed_color)
337 gdk_color_free(priv->collapsed_color);
338 pidgin_theme_font_free(priv->collapsed);
253 339
254 /* Buddy */ 340 /* Buddy */
255 free_font_and_color(priv->contact); 341 if (priv->contact_color)
256 free_font_and_color(priv->online); 342 gdk_color_free(priv->contact_color);
257 free_font_and_color(priv->away); 343 pidgin_theme_font_free(priv->contact);
258 free_font_and_color(priv->offline); 344 pidgin_theme_font_free(priv->online);
259 free_font_and_color(priv->message); 345 pidgin_theme_font_free(priv->away);
260 free_font_and_color(priv->message_nick_said); 346 pidgin_theme_font_free(priv->offline);
261 free_font_and_color(priv->status); 347 pidgin_theme_font_free(priv->idle);
348 pidgin_theme_font_free(priv->message);
349 pidgin_theme_font_free(priv->message_nick_said);
350 pidgin_theme_font_free(priv->status);
262 351
263 g_free(priv); 352 g_free(priv);
264 353
265 parent_class->finalize (obj); 354 parent_class->finalize (obj);
266 } 355 }
276 obj_class->get_property = pidgin_blist_theme_get_property; 365 obj_class->get_property = pidgin_blist_theme_get_property;
277 obj_class->set_property = pidgin_blist_theme_set_property; 366 obj_class->set_property = pidgin_blist_theme_set_property;
278 obj_class->finalize = pidgin_blist_theme_finalize; 367 obj_class->finalize = pidgin_blist_theme_finalize;
279 368
280 /* Buddy List */ 369 /* Buddy List */
281 pspec = g_param_spec_pointer("background-color", "Background Color", 370 pspec = g_param_spec_boxed("background-color", _("Background Color"),
282 "The background color for the buddy list", 371 _("The background color for the buddy list"),
283 G_PARAM_READWRITE); 372 GDK_TYPE_COLOR, G_PARAM_READWRITE);
284 g_object_class_install_property(obj_class, PROP_BACKGROUND_COLOR, pspec); 373 g_object_class_install_property(obj_class, PROP_BACKGROUND_COLOR, pspec);
285 374
286 pspec = g_param_spec_pointer("layout", "Layout", 375 pspec = g_param_spec_pointer("layout", _("Layout"),
287 "The layout of icons, name, and status of the blist", 376 _("The layout of icons, name, and status of the buddy list"),
288 G_PARAM_READWRITE); 377 G_PARAM_READWRITE);
289 378
290 g_object_class_install_property(obj_class, PROP_LAYOUT, pspec); 379 g_object_class_install_property(obj_class, PROP_LAYOUT, pspec);
291 380
292 /* Group */ 381 /* Group */
293 pspec = g_param_spec_pointer("expanded-color", "Expanded Background Color", 382 pspec = g_param_spec_boxed("expanded-color", _("Expanded Background Color"),
294 "The background color of an expanded group", 383 _("The background color of an expanded group"),
295 G_PARAM_READWRITE); 384 GDK_TYPE_COLOR, G_PARAM_READWRITE);
296 g_object_class_install_property(obj_class, PROP_EXPANDED_COLOR, pspec); 385 g_object_class_install_property(obj_class, PROP_EXPANDED_COLOR, pspec);
297 386
298 pspec = g_param_spec_pointer("expanded-text", "Expanded Text", 387 pspec = g_param_spec_pointer("expanded-text", _("Expanded Text"),
299 "The text information for when a group is expanded", 388 _("The text information for when a group is expanded"),
300 G_PARAM_READWRITE); 389 G_PARAM_READWRITE);
301 g_object_class_install_property(obj_class, PROP_EXPANDED_TEXT, pspec); 390 g_object_class_install_property(obj_class, PROP_EXPANDED_TEXT, pspec);
302 391
303 pspec = g_param_spec_pointer("collapsed-color", "Collapsed Background Color", 392 pspec = g_param_spec_boxed("collapsed-color", _("Collapsed Background Color"),
304 "The background color of a collapsed group", 393 _("The background color of a collapsed group"),
305 G_PARAM_READWRITE); 394 GDK_TYPE_COLOR, G_PARAM_READWRITE);
306 g_object_class_install_property(obj_class, PROP_COLLAPSED_COLOR, pspec); 395 g_object_class_install_property(obj_class, PROP_COLLAPSED_COLOR, pspec);
307 396
308 pspec = g_param_spec_pointer("collapsed-text", "Collapsed Text", 397 pspec = g_param_spec_pointer("collapsed-text", _("Collapsed Text"),
309 "The text information for when a group is collapsed", 398 _("The text information for when a group is collapsed"),
310 G_PARAM_READWRITE); 399 G_PARAM_READWRITE);
311 g_object_class_install_property(obj_class, PROP_COLLAPSED_TEXT, pspec); 400 g_object_class_install_property(obj_class, PROP_COLLAPSED_TEXT, pspec);
312 401
313 /* Buddy */ 402 /* Buddy */
314 pspec = g_param_spec_pointer("contact-color", "Contact/Chat Background Color", 403 pspec = g_param_spec_boxed("contact-color", _("Contact/Chat Background Color"),
315 "The background color of a contact or chat", 404 _("The background color of a contact or chat"),
316 G_PARAM_READWRITE); 405 GDK_TYPE_COLOR, G_PARAM_READWRITE);
317 g_object_class_install_property(obj_class, PROP_CONTACT_COLOR, pspec); 406 g_object_class_install_property(obj_class, PROP_CONTACT_COLOR, pspec);
318 407
319 pspec = g_param_spec_pointer("contact", "Contact Text", 408 pspec = g_param_spec_pointer("contact", _("Contact Text"),
320 "The text information for when a contact is expanded", 409 _("The text information for when a contact is expanded"),
321 G_PARAM_READWRITE); 410 G_PARAM_READWRITE);
322 g_object_class_install_property(obj_class, PROP_CONTACT, pspec); 411 g_object_class_install_property(obj_class, PROP_CONTACT, pspec);
323 412
324 pspec = g_param_spec_pointer("online", "On-line Text", 413 pspec = g_param_spec_pointer("online", _("On-line Text"),
325 "The text information for when a buddy is online", 414 _("The text information for when a buddy is online"),
326 G_PARAM_READWRITE); 415 G_PARAM_READWRITE);
327 g_object_class_install_property(obj_class, PROP_ONLINE, pspec); 416 g_object_class_install_property(obj_class, PROP_ONLINE, pspec);
328 417
329 pspec = g_param_spec_pointer("away", "Away Text", 418 pspec = g_param_spec_pointer("away", _("Away Text"),
330 "The text information for when a buddy is away", 419 _("The text information for when a buddy is away"),
331 G_PARAM_READWRITE); 420 G_PARAM_READWRITE);
332 g_object_class_install_property(obj_class, PROP_AWAY, pspec); 421 g_object_class_install_property(obj_class, PROP_AWAY, pspec);
333 422
334 pspec = g_param_spec_pointer("offline", "Off-line Text", 423 pspec = g_param_spec_pointer("offline", _("Off-line Text"),
335 "The text information for when a buddy is off-line", 424 _("The text information for when a buddy is off-line"),
336 G_PARAM_READWRITE); 425 G_PARAM_READWRITE);
337 g_object_class_install_property(obj_class, PROP_OFFLINE, pspec); 426 g_object_class_install_property(obj_class, PROP_OFFLINE, pspec);
338 427
339 pspec = g_param_spec_pointer("idle", "Idle Text", 428 pspec = g_param_spec_pointer("idle", _("Idle Text"),
340 "The text information for when a buddy is idle", 429 _("The text information for when a buddy is idle"),
341 G_PARAM_READWRITE); 430 G_PARAM_READWRITE);
342 g_object_class_install_property(obj_class, PROP_IDLE, pspec); 431 g_object_class_install_property(obj_class, PROP_IDLE, pspec);
343 432
344 pspec = g_param_spec_pointer("message", "Message Text", 433 pspec = g_param_spec_pointer("message", _("Message Text"),
345 "The text information for when a buddy has an unread message", 434 _("The text information for when a buddy has an unread message"),
346 G_PARAM_READWRITE); 435 G_PARAM_READWRITE);
347 g_object_class_install_property(obj_class, PROP_MESSAGE, pspec); 436 g_object_class_install_property(obj_class, PROP_MESSAGE, pspec);
348 437
349 pspec = g_param_spec_pointer("message_nick_said", "Message (Nick Said) Text", 438 pspec = g_param_spec_pointer("message_nick_said", _("Message (Nick Said) Text"),
350 "The text information for when a chat has an unread message that mentions your nick", 439 _("The text information for when a chat has an unread message that mentions your nick"),
351 G_PARAM_READWRITE); 440 G_PARAM_READWRITE);
352 g_object_class_install_property(obj_class, PROP_MESSAGE_NICK_SAID, pspec); 441 g_object_class_install_property(obj_class, PROP_MESSAGE_NICK_SAID, pspec);
353 442
354 pspec = g_param_spec_pointer("status", "Status Text", 443 pspec = g_param_spec_pointer("status", _("Status Text"),
355 "The text information for a buddy's status", 444 _("The text information for a buddy's status"),
356 G_PARAM_READWRITE); 445 G_PARAM_READWRITE);
357 g_object_class_install_property(obj_class, PROP_STATUS, pspec); 446 g_object_class_install_property(obj_class, PROP_STATUS, pspec);
358 } 447 }
359 448
360 GType 449 GType
433 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); 522 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
434 523
435 return priv->expanded_color; 524 return priv->expanded_color;
436 } 525 }
437 526
438 FontColorPair * 527 PidginThemeFont *
439 pidgin_blist_theme_get_expanded_text_info(PidginBlistTheme *theme) 528 pidgin_blist_theme_get_expanded_text_info(PidginBlistTheme *theme)
440 { 529 {
441 PidginBlistThemePrivate *priv; 530 PidginBlistThemePrivate *priv;
442 531
443 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL); 532 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL);
457 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); 546 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
458 547
459 return priv->collapsed_color; 548 return priv->collapsed_color;
460 } 549 }
461 550
462 FontColorPair * 551 PidginThemeFont *
463 pidgin_blist_theme_get_collapsed_text_info(PidginBlistTheme *theme) 552 pidgin_blist_theme_get_collapsed_text_info(PidginBlistTheme *theme)
464 { 553 {
465 PidginBlistThemePrivate *priv; 554 PidginBlistThemePrivate *priv;
466 555
467 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL); 556 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL);
481 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); 570 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
482 571
483 return priv->contact_color; 572 return priv->contact_color;
484 } 573 }
485 574
486 FontColorPair * 575 PidginThemeFont *
487 pidgin_blist_theme_get_contact_text_info(PidginBlistTheme *theme) 576 pidgin_blist_theme_get_contact_text_info(PidginBlistTheme *theme)
488 { 577 {
489 PidginBlistThemePrivate *priv; 578 PidginBlistThemePrivate *priv;
490 579
491 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL); 580 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL);
493 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); 582 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
494 583
495 return priv->contact; 584 return priv->contact;
496 } 585 }
497 586
498 FontColorPair * 587 PidginThemeFont *
499 pidgin_blist_theme_get_online_text_info(PidginBlistTheme *theme) 588 pidgin_blist_theme_get_online_text_info(PidginBlistTheme *theme)
500 { 589 {
501 PidginBlistThemePrivate *priv; 590 PidginBlistThemePrivate *priv;
502 591
503 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL); 592 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL);
505 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); 594 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
506 595
507 return priv->online; 596 return priv->online;
508 } 597 }
509 598
510 FontColorPair * 599 PidginThemeFont *
511 pidgin_blist_theme_get_away_text_info(PidginBlistTheme *theme) 600 pidgin_blist_theme_get_away_text_info(PidginBlistTheme *theme)
512 { 601 {
513 PidginBlistThemePrivate *priv; 602 PidginBlistThemePrivate *priv;
514 603
515 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL); 604 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL);
517 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); 606 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
518 607
519 return priv->away; 608 return priv->away;
520 } 609 }
521 610
522 FontColorPair * 611 PidginThemeFont *
523 pidgin_blist_theme_get_offline_text_info(PidginBlistTheme *theme) 612 pidgin_blist_theme_get_offline_text_info(PidginBlistTheme *theme)
524 { 613 {
525 PidginBlistThemePrivate *priv; 614 PidginBlistThemePrivate *priv;
526 615
527 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL); 616 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL);
529 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); 618 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
530 619
531 return priv->offline; 620 return priv->offline;
532 } 621 }
533 622
534 FontColorPair * 623 PidginThemeFont *
535 pidgin_blist_theme_get_idle_text_info(PidginBlistTheme *theme) 624 pidgin_blist_theme_get_idle_text_info(PidginBlistTheme *theme)
536 { 625 {
537 PidginBlistThemePrivate *priv; 626 PidginBlistThemePrivate *priv;
538 627
539 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL); 628 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL);
541 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); 630 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
542 631
543 return priv->idle; 632 return priv->idle;
544 } 633 }
545 634
546 FontColorPair * 635 PidginThemeFont *
547 pidgin_blist_theme_get_unread_message_text_info(PidginBlistTheme *theme) 636 pidgin_blist_theme_get_unread_message_text_info(PidginBlistTheme *theme)
548 { 637 {
549 PidginBlistThemePrivate *priv; 638 PidginBlistThemePrivate *priv;
550 639
551 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL); 640 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL);
553 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); 642 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
554 643
555 return priv->message; 644 return priv->message;
556 } 645 }
557 646
558 FontColorPair * 647 PidginThemeFont *
559 pidgin_blist_theme_get_unread_message_nick_said_text_info(PidginBlistTheme *theme) 648 pidgin_blist_theme_get_unread_message_nick_said_text_info(PidginBlistTheme *theme)
560 { 649 {
561 PidginBlistThemePrivate *priv; 650 PidginBlistThemePrivate *priv;
562 651
563 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL); 652 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL);
565 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); 654 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
566 655
567 return priv->message_nick_said; 656 return priv->message_nick_said;
568 } 657 }
569 658
570 FontColorPair * 659 PidginThemeFont *
571 pidgin_blist_theme_get_status_text_info(PidginBlistTheme *theme) 660 pidgin_blist_theme_get_status_text_info(PidginBlistTheme *theme)
572 { 661 {
573 PidginBlistThemePrivate *priv; 662 PidginBlistThemePrivate *priv;
574 663
575 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL); 664 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL);
579 return priv->status; 668 return priv->status;
580 } 669 }
581 670
582 /* Set Methods */ 671 /* Set Methods */
583 void 672 void
584 pidgin_blist_theme_set_background_color(PidginBlistTheme *theme, GdkColor *color) 673 pidgin_blist_theme_set_background_color(PidginBlistTheme *theme, const GdkColor *color)
585 { 674 {
586 PidginBlistThemePrivate *priv; 675 PidginBlistThemePrivate *priv;
587 676
588 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme)); 677 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme));
589 678
590 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); 679 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
591 680
592 priv->bgcolor = color; 681 if (priv->bgcolor)
682 gdk_color_free(priv->bgcolor);
683 priv->bgcolor = gdk_color_copy(color);
593 } 684 }
594 685
595 void 686 void
596 pidgin_blist_theme_set_opacity(PidginBlistTheme *theme, gdouble opacity) 687 pidgin_blist_theme_set_opacity(PidginBlistTheme *theme, gdouble opacity)
597 { 688 {
603 694
604 priv->opacity = opacity; 695 priv->opacity = opacity;
605 } 696 }
606 697
607 void 698 void
608 pidgin_blist_theme_set_layout(PidginBlistTheme *theme, PidginBlistLayout *layout) 699 pidgin_blist_theme_set_layout(PidginBlistTheme *theme, const PidginBlistLayout *layout)
609 { 700 {
610 PidginBlistThemePrivate *priv; 701 PidginBlistThemePrivate *priv;
611 702
612 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme)); 703 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme));
613 704
614 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); 705 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
615 706
616 g_free(priv->layout); 707 g_free(priv->layout);
617 priv->layout = layout; 708 priv->layout = g_memdup(layout, sizeof(PidginBlistLayout));
618 } 709 }
619 710
620 void 711 void
621 pidgin_blist_theme_set_expanded_background_color(PidginBlistTheme *theme, GdkColor *color) 712 pidgin_blist_theme_set_expanded_background_color(PidginBlistTheme *theme, const GdkColor *color)
622 { 713 {
623 PidginBlistThemePrivate *priv; 714 PidginBlistThemePrivate *priv;
624 715
625 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme)); 716 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme));
626 717
627 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); 718 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
628 719
629 priv->expanded_color = color; 720 if (priv->expanded_color)
630 } 721 gdk_color_free(priv->expanded_color);
631 722 priv->expanded_color = gdk_color_copy(color);
632 void 723 }
633 pidgin_blist_theme_set_expanded_text_info(PidginBlistTheme *theme, FontColorPair *pair) 724
634 { 725 void
635 PidginBlistThemePrivate *priv; 726 pidgin_blist_theme_set_expanded_text_info(PidginBlistTheme *theme, const PidginThemeFont *pair)
636 727 {
637 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme)); 728 PidginBlistThemePrivate *priv;
638 729
639 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); 730 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme));
640 731
641 free_font_and_color(priv->expanded); 732 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
642 priv->expanded = pair; 733
643 } 734 pidgin_theme_font_free(priv->expanded);
644 735 priv->expanded = copy_font_and_color(pair);
645 void 736 }
646 pidgin_blist_theme_set_collapsed_background_color(PidginBlistTheme *theme, GdkColor *color) 737
647 { 738 void
648 PidginBlistThemePrivate *priv; 739 pidgin_blist_theme_set_collapsed_background_color(PidginBlistTheme *theme, const GdkColor *color)
649 740 {
650 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme)); 741 PidginBlistThemePrivate *priv;
651 742
652 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); 743 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme));
653 744
654 priv->collapsed_color = color; 745 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
655 } 746
656 747 if (priv->collapsed_color)
657 void 748 gdk_color_free(priv->collapsed_color);
658 pidgin_blist_theme_set_collapsed_text_info(PidginBlistTheme *theme, FontColorPair *pair) 749 priv->collapsed_color = gdk_color_copy(color);
659 { 750 }
660 PidginBlistThemePrivate *priv; 751
661 752 void
662 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme)); 753 pidgin_blist_theme_set_collapsed_text_info(PidginBlistTheme *theme, const PidginThemeFont *pair)
663 754 {
664 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); 755 PidginBlistThemePrivate *priv;
665 756
666 free_font_and_color(priv->collapsed); 757 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme));
667 priv->collapsed = pair; 758
668 } 759 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
669 760
670 void 761 pidgin_theme_font_free(priv->collapsed);
671 pidgin_blist_theme_set_contact_color(PidginBlistTheme *theme, GdkColor *color) 762 priv->collapsed = copy_font_and_color(pair);
672 { 763 }
673 PidginBlistThemePrivate *priv; 764
674 765 void
675 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme)); 766 pidgin_blist_theme_set_contact_color(PidginBlistTheme *theme, const GdkColor *color)
676 767 {
677 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); 768 PidginBlistThemePrivate *priv;
678 769
679 priv->contact_color = color; 770 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme));
680 } 771
681 772 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
682 void 773
683 pidgin_blist_theme_set_contact_text_info(PidginBlistTheme *theme, FontColorPair *pair) 774 if (priv->contact_color)
684 { 775 gdk_color_free(priv->contact_color);
685 PidginBlistThemePrivate *priv; 776 priv->contact_color = gdk_color_copy(color);
686 777 }
687 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme)); 778
688 779 void
689 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); 780 pidgin_blist_theme_set_contact_text_info(PidginBlistTheme *theme, const PidginThemeFont *pair)
690 781 {
691 free_font_and_color(priv->contact); 782 PidginBlistThemePrivate *priv;
692 priv->contact = pair; 783
693 } 784 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme));
694 785
695 void 786 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
696 pidgin_blist_theme_set_online_text_info(PidginBlistTheme *theme, FontColorPair *pair) 787
697 { 788 pidgin_theme_font_free(priv->contact);
698 PidginBlistThemePrivate *priv; 789 priv->contact = copy_font_and_color(pair);
699 790 }
700 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme)); 791
701 792 void
702 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); 793 pidgin_blist_theme_set_online_text_info(PidginBlistTheme *theme, const PidginThemeFont *pair)
703 794 {
704 free_font_and_color(priv->online); 795 PidginBlistThemePrivate *priv;
705 priv->online = pair; 796
706 } 797 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme));
707 798
708 void 799 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
709 pidgin_blist_theme_set_away_text_info(PidginBlistTheme *theme, FontColorPair *pair) 800
710 { 801 pidgin_theme_font_free(priv->online);
711 PidginBlistThemePrivate *priv; 802 priv->online = copy_font_and_color(pair);
712 803 }
713 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme)); 804
714 805 void
715 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); 806 pidgin_blist_theme_set_away_text_info(PidginBlistTheme *theme, const PidginThemeFont *pair)
716 807 {
717 free_font_and_color(priv->away); 808 PidginBlistThemePrivate *priv;
718 priv->away = pair; 809
719 } 810 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme));
720 811
721 void 812 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
722 pidgin_blist_theme_set_offline_text_info(PidginBlistTheme *theme, FontColorPair *pair) 813
723 { 814 pidgin_theme_font_free(priv->away);
724 PidginBlistThemePrivate *priv; 815 priv->away = copy_font_and_color(pair);
725 816 }
726 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme)); 817
727 818 void
728 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); 819 pidgin_blist_theme_set_offline_text_info(PidginBlistTheme *theme, const PidginThemeFont *pair)
729 820 {
730 free_font_and_color(priv->offline); 821 PidginBlistThemePrivate *priv;
731 priv->offline = pair; 822
732 } 823 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme));
733 824
734 void 825 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
735 pidgin_blist_theme_set_idle_text_info(PidginBlistTheme *theme, FontColorPair *pair) 826
736 { 827 pidgin_theme_font_free(priv->offline);
737 PidginBlistThemePrivate *priv; 828 priv->offline = copy_font_and_color(pair);
738 829 }
739 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme)); 830
740 831 void
741 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); 832 pidgin_blist_theme_set_idle_text_info(PidginBlistTheme *theme, const PidginThemeFont *pair)
742 833 {
743 free_font_and_color(priv->idle); 834 PidginBlistThemePrivate *priv;
744 priv->idle = pair; 835
745 } 836 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme));
746 837
747 void 838 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
748 pidgin_blist_theme_set_unread_message_text_info(PidginBlistTheme *theme, FontColorPair *pair) 839
749 { 840 pidgin_theme_font_free(priv->idle);
750 PidginBlistThemePrivate *priv; 841 priv->idle = copy_font_and_color(pair);
751 842 }
752 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme)); 843
753 844 void
754 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); 845 pidgin_blist_theme_set_unread_message_text_info(PidginBlistTheme *theme, const PidginThemeFont *pair)
755 846 {
756 free_font_and_color(priv->message); 847 PidginBlistThemePrivate *priv;
757 priv->message = pair; 848
758 } 849 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme));
759 850
760 void 851 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
761 pidgin_blist_theme_set_unread_message_nick_said_text_info(PidginBlistTheme *theme, FontColorPair *pair) 852
762 { 853 pidgin_theme_font_free(priv->message);
763 PidginBlistThemePrivate *priv; 854 priv->message = copy_font_and_color(pair);
764 855 }
765 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme)); 856
766 857 void
767 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); 858 pidgin_blist_theme_set_unread_message_nick_said_text_info(PidginBlistTheme *theme, const PidginThemeFont *pair)
768 859 {
769 free_font_and_color(priv->message_nick_said); 860 PidginBlistThemePrivate *priv;
770 priv->message_nick_said = pair; 861
771 } 862 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme));
772 863
773 void 864 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
774 pidgin_blist_theme_set_status_text_info(PidginBlistTheme *theme, FontColorPair *pair) 865
775 { 866 pidgin_theme_font_free(priv->message_nick_said);
776 PidginBlistThemePrivate *priv; 867 priv->message_nick_said = copy_font_and_color(pair);
777 868 }
778 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme)); 869
779 870 void
780 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); 871 pidgin_blist_theme_set_status_text_info(PidginBlistTheme *theme, const PidginThemeFont *pair)
781 872 {
782 free_font_and_color(priv->status); 873 PidginBlistThemePrivate *priv;
783 priv->status = pair; 874
784 } 875 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme));
876
877 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
878
879 pidgin_theme_font_free(priv->status);
880 priv->status = copy_font_and_color(pair);
881 }