comparison pidgin/gtkblist-theme.c @ 23479:edb03a8d54bd

Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
author Justin Rodriguez <ffdragon@soc.pidgin.im>
date Thu, 17 Jul 2008 19:40:13 +0000
parents 4aeef8c3cce3
children fc3600ba68f1
comparison
equal deleted inserted replaced
23478:4aeef8c3cce3 23479:edb03a8d54bd
24 #include "gtkblist-theme.h" 24 #include "gtkblist-theme.h"
25 25
26 #define PIDGIN_BLIST_THEME_GET_PRIVATE(Gobject) \ 26 #define PIDGIN_BLIST_THEME_GET_PRIVATE(Gobject) \
27 ((PidginBlistThemePrivate *) ((PIDGIN_BLIST_THEME(Gobject))->priv)) 27 ((PidginBlistThemePrivate *) ((PIDGIN_BLIST_THEME(Gobject))->priv))
28 28
29 #define free_font_and_color(font_color_pair) \
30 g_free(font_color_pair->font); \
31 g_free(font_color_pair)
32 /****************************************************************************** 29 /******************************************************************************
33 * Structs 30 * Structs
34 *****************************************************************************/ 31 *****************************************************************************/
35 typedef struct { 32 typedef struct {
36 gchar *icon_theme; 33 gchar *icon_theme;
37 34
38 /* Buddy list */ 35 /* Buddy list */
39 GdkColor *bgcolor; 36 GdkColor *bgcolor;
40 gdouble opacity; 37 gdouble opacity;
41 blist_layout *layout; 38 PidginBlistLayout *layout;
42 39
43 /* groups */ 40 /* groups */
44 GdkColor *expanded_color; 41 GdkColor *expanded_color;
45 font_color_pair *expanded; 42 FontColorPair *expanded;
46 43
47 GdkColor *collapsed_color; 44 GdkColor *collapsed_color;
48 font_color_pair *collapsed; 45 FontColorPair *collapsed;
49 46
50 /* buddy */ 47 /* buddy */
51 GdkColor *buddy_bgcolor1; 48 GdkColor *buddy_bgcolor1;
52 GdkColor *buddy_bgcolor2; 49 GdkColor *buddy_bgcolor2;
53 50
54 font_color_pair *online; 51 FontColorPair *online;
55 font_color_pair *away; 52 FontColorPair *away;
56 font_color_pair *offline; 53 FontColorPair *offline;
57 font_color_pair *message; 54 FontColorPair *message;
58 font_color_pair *status; 55 FontColorPair *status;
59 56
60 } PidginBlistThemePrivate; 57 } PidginBlistThemePrivate;
61 58
62 /****************************************************************************** 59 /******************************************************************************
63 * Globals 60 * Globals
84 PROP_AWAY, 81 PROP_AWAY,
85 PROP_OFFLINE, 82 PROP_OFFLINE,
86 PROP_MESSAGE, 83 PROP_MESSAGE,
87 PROP_STATUS, 84 PROP_STATUS,
88 }; 85 };
86
87 /******************************************************************************
88 * Helpers
89 *****************************************************************************/
90
91 static void
92 free_font_and_color(FontColorPair *pair)
93 {
94 if(pair != NULL){
95 g_free(pair->font);
96 g_free(pair);
97 }
98 }
99
89 /****************************************************************************** 100 /******************************************************************************
90 * GObject Stuff 101 * GObject Stuff
91 *****************************************************************************/ 102 *****************************************************************************/
92 103
93 static void 104 static void
100 111
101 static void 112 static void
102 pidgin_blist_theme_get_property(GObject *obj, guint param_id, GValue *value, 113 pidgin_blist_theme_get_property(GObject *obj, guint param_id, GValue *value,
103 GParamSpec *psec) 114 GParamSpec *psec)
104 { 115 {
105 PidginBlistThemePrivate *priv = PIDGIN_BLIST_THEME_GET_PRIVATE(obj); 116 PidginBlistTheme *theme = PIDGIN_BLIST_THEME(obj);
106 117
107 switch(param_id) { 118 switch(param_id) {
108 case PROP_ICON_THEME: 119 case PROP_ICON_THEME:
109 g_value_set_string(value, priv->icon_theme); 120 g_value_set_string(value, pidgin_blist_theme_get_icon_theme(theme));
110 break; 121 break;
111 case PROP_BACKGROUND_COLOR: 122 case PROP_BACKGROUND_COLOR:
112 g_value_set_pointer(value, priv->bgcolor); 123 g_value_set_pointer(value, pidgin_blist_theme_get_background_color(theme));
113 break; 124 break;
114 case PROP_OPACITY: 125 case PROP_OPACITY:
115 g_value_set_double(value, priv->opacity); 126 g_value_set_double(value, pidgin_blist_theme_get_opacity(theme));
116 break; 127 break;
117 case PROP_LAYOUT: 128 case PROP_LAYOUT:
118 g_value_set_pointer(value, priv->layout); 129 g_value_set_pointer(value, pidgin_blist_theme_get_layout(theme));
119 break; 130 break;
120 case PROP_EXPANDED_COLOR: 131 case PROP_EXPANDED_COLOR:
121 g_value_set_pointer(value, priv->expanded_color); 132 g_value_set_pointer(value, pidgin_blist_theme_get_expanded_background_color(theme));
122 break; 133 break;
123 case PROP_EXPANDED_TEXT: 134 case PROP_EXPANDED_TEXT:
124 g_value_set_pointer(value, priv->expanded); 135 g_value_set_pointer(value, pidgin_blist_theme_get_expanded_text_info(theme));
125 break; 136 break;
126 case PROP_COLLAPSED_COLOR: 137 case PROP_COLLAPSED_COLOR:
127 g_value_set_pointer(value, priv->collapsed_color); 138 g_value_set_pointer(value, pidgin_blist_theme_get_collapsed_background_color(theme));
128 break; 139 break;
129 case PROP_COLLAPSED_TEXT: 140 case PROP_COLLAPSED_TEXT:
130 g_value_set_pointer(value, priv->collapsed); 141 g_value_set_pointer(value, pidgin_blist_theme_get_collapsed_text_info(theme));
131 break; 142 break;
132 case PROP_BGCOLOR1: 143 case PROP_BGCOLOR1:
133 g_value_set_pointer(value, priv->buddy_bgcolor1); 144 g_value_set_pointer(value, pidgin_blist_theme_get_buddy_color_1(theme));
134 break; 145 break;
135 case PROP_BGCOLOR2: 146 case PROP_BGCOLOR2:
136 g_value_set_pointer(value, priv->buddy_bgcolor2); 147 g_value_set_pointer(value, pidgin_blist_theme_get_buddy_color_2(theme));
137 break; 148 break;
138 case PROP_ONLINE: 149 case PROP_ONLINE:
139 g_value_set_pointer(value, priv->online); 150 g_value_set_pointer(value, pidgin_blist_theme_get_online_text_info(theme));
140 break; 151 break;
141 case PROP_AWAY: 152 case PROP_AWAY:
142 g_value_set_pointer(value, priv->away); 153 g_value_set_pointer(value, pidgin_blist_theme_get_away_text_info(theme));
143 break; 154 break;
144 case PROP_OFFLINE: 155 case PROP_OFFLINE:
145 g_value_set_pointer(value, priv->offline); 156 g_value_set_pointer(value, pidgin_blist_theme_get_offline_text_info(theme));
146 break; 157 break;
147 case PROP_MESSAGE: 158 case PROP_MESSAGE:
148 g_value_set_pointer(value, priv->message); 159 g_value_set_pointer(value, pidgin_blist_theme_get_unread_message_text_info(theme));
149 break; 160 break;
150 case PROP_STATUS: 161 case PROP_STATUS:
151 g_value_set_pointer(value, priv->status); 162 g_value_set_pointer(value, pidgin_blist_theme_get_status_text_info(theme));
152 break; 163 break;
153 default: 164 default:
154 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, psec); 165 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, psec);
155 break; 166 break;
156 } 167 }
158 169
159 static void 170 static void
160 pidgin_blist_theme_set_property(GObject *obj, guint param_id, const GValue *value, 171 pidgin_blist_theme_set_property(GObject *obj, guint param_id, const GValue *value,
161 GParamSpec *psec) 172 GParamSpec *psec)
162 { 173 {
163 PidginBlistThemePrivate *priv = PIDGIN_BLIST_THEME_GET_PRIVATE(obj); 174 PidginBlistTheme *theme = PIDGIN_BLIST_THEME(obj);
164 175
165 switch(param_id) { 176 switch(param_id) {
166 case PROP_ICON_THEME: 177 case PROP_ICON_THEME:
167 g_free(priv->icon_theme); 178 pidgin_blist_theme_set_icon_theme(theme, g_value_get_string(value));
168 priv->icon_theme = g_strdup(g_value_get_string(value));
169 break; 179 break;
170 case PROP_BACKGROUND_COLOR: 180 case PROP_BACKGROUND_COLOR:
171 priv->bgcolor = g_value_get_pointer(value); 181 pidgin_blist_theme_set_background_color(theme, g_value_get_pointer(value));
172 break; 182 break;
173 case PROP_OPACITY: 183 case PROP_OPACITY:
174 priv->opacity = g_value_get_double(value); 184 pidgin_blist_theme_set_opacity(theme, g_value_get_double(value));
175 break; 185 break;
176 case PROP_LAYOUT: 186 case PROP_LAYOUT:
177 g_free(priv->layout); 187 pidgin_blist_theme_set_layout(theme, g_value_get_pointer(value));
178 priv->layout = g_value_get_pointer(value);
179 break; 188 break;
180 case PROP_EXPANDED_COLOR: 189 case PROP_EXPANDED_COLOR:
181 priv->expanded_color = g_value_get_pointer(value); 190 pidgin_blist_theme_set_expanded_background_color(theme, g_value_get_pointer(value));
182 break; 191 break;
183 case PROP_EXPANDED_TEXT: 192 case PROP_EXPANDED_TEXT:
184 free_font_and_color(priv->expanded); 193 pidgin_blist_theme_set_expanded_text_info(theme, g_value_get_pointer(value));
185 priv->expanded = g_value_get_pointer(value);
186 break; 194 break;
187 case PROP_COLLAPSED_COLOR: 195 case PROP_COLLAPSED_COLOR:
188 priv->collapsed_color = g_value_get_pointer(value); 196 pidgin_blist_theme_set_collapsed_background_color(theme, g_value_get_pointer(value));
189 break; 197 break;
190 case PROP_COLLAPSED_TEXT: 198 case PROP_COLLAPSED_TEXT:
191 free_font_and_color(priv->collapsed); 199 pidgin_blist_theme_set_collapsed_text_info(theme, g_value_get_pointer(value));
192 priv->collapsed = g_value_get_pointer(value);
193 break; 200 break;
194 case PROP_BGCOLOR1: 201 case PROP_BGCOLOR1:
195 priv->buddy_bgcolor1 = g_value_get_pointer(value); 202 pidgin_blist_theme_set_buddy_color_1(theme, g_value_get_pointer(value));
196 break; 203 break;
197 case PROP_BGCOLOR2: 204 case PROP_BGCOLOR2:
198 priv->buddy_bgcolor2 = g_value_get_pointer(value); 205 pidgin_blist_theme_set_buddy_color_2(theme, g_value_get_pointer(value));
199 break; 206 break;
200 case PROP_ONLINE: 207 case PROP_ONLINE:
201 free_font_and_color(priv->online); 208 pidgin_blist_theme_set_online_text_info(theme, g_value_get_pointer(value));
202 priv->online = g_value_get_pointer(value);
203 break; 209 break;
204 case PROP_AWAY: 210 case PROP_AWAY:
205 free_font_and_color(priv->away); 211 pidgin_blist_theme_set_away_text_info(theme, g_value_get_pointer(value));
206 priv->away = g_value_get_pointer(value);
207 break; 212 break;
208 case PROP_OFFLINE: 213 case PROP_OFFLINE:
209 free_font_and_color(priv->offline); 214 pidgin_blist_theme_set_offline_text_info(theme, g_value_get_pointer(value));
210 priv->offline = g_value_get_pointer(value);
211 break; 215 break;
212 case PROP_MESSAGE: 216 case PROP_MESSAGE:
213 free_font_and_color(priv->message); 217 pidgin_blist_theme_set_unread_message_text_info(theme, g_value_get_pointer(value));
214 priv->message = g_value_get_pointer(value);
215 break; 218 break;
216 case PROP_STATUS: 219 case PROP_STATUS:
217 free_font_and_color(priv->status); 220 pidgin_blist_theme_set_status_text_info(theme, g_value_get_pointer(value));
218 priv->status = g_value_get_pointer(value);
219 break; 221 break;
220 default: 222 default:
221 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, psec); 223 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, psec);
222 break; 224 break;
223 } 225 }
372 374
373 /***************************************************************************** 375 /*****************************************************************************
374 * Public API functions 376 * Public API functions
375 *****************************************************************************/ 377 *****************************************************************************/
376 378
377 const gchar * 379 /* get methods */
380 gchar *
378 pidgin_blist_theme_get_icon_theme(PidginBlistTheme *theme) 381 pidgin_blist_theme_get_icon_theme(PidginBlistTheme *theme)
379 { 382 {
380 PidginBlistThemePrivate *priv; 383 PidginBlistThemePrivate *priv;
381 384
382 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL); 385 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL);
383 386
384 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); 387 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
385 388
386 return priv->icon_theme; 389 return priv->icon_theme;
390 }
391
392 GdkColor *
393 pidgin_blist_theme_get_background_color(PidginBlistTheme *theme)
394 {
395 PidginBlistThemePrivate *priv;
396
397 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL);
398
399 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
400
401 return priv->bgcolor;
387 } 402 }
388 403
389 gdouble 404 gdouble
390 pidgin_blist_theme_get_opacity(PidginBlistTheme *theme) 405 pidgin_blist_theme_get_opacity(PidginBlistTheme *theme)
391 { 406 {
396 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); 411 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
397 412
398 return priv->opacity; 413 return priv->opacity;
399 } 414 }
400 415
401 const blist_layout * 416 PidginBlistLayout *
402 pidgin_blist_theme_get_layout(PidginBlistTheme *theme) 417 pidgin_blist_theme_get_layout(PidginBlistTheme *theme)
403 { 418 {
404 PidginBlistThemePrivate *priv; 419 PidginBlistThemePrivate *priv;
405 420
406 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL); 421 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL);
408 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); 423 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
409 424
410 return priv->layout; 425 return priv->layout;
411 } 426 }
412 427
413 const GdkColor * 428 GdkColor *
414 pidgin_blist_theme_get_expanded_background_color(PidginBlistTheme *theme) 429 pidgin_blist_theme_get_expanded_background_color(PidginBlistTheme *theme)
415 { 430 {
416 PidginBlistThemePrivate *priv; 431 PidginBlistThemePrivate *priv;
417 432
418 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL); 433 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL);
420 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); 435 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
421 436
422 return priv->expanded_color; 437 return priv->expanded_color;
423 } 438 }
424 439
425 const font_color_pair * 440 FontColorPair *
426 pidgin_blist_theme_get_expanded_text_info(PidginBlistTheme *theme) 441 pidgin_blist_theme_get_expanded_text_info(PidginBlistTheme *theme)
427 { 442 {
428 PidginBlistThemePrivate *priv; 443 PidginBlistThemePrivate *priv;
429 444
430 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL); 445 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL);
432 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); 447 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
433 448
434 return priv->expanded; 449 return priv->expanded;
435 } 450 }
436 451
437 const GdkColor * 452 GdkColor *
438 pidgin_blist_theme_get_collapsed_background_color(PidginBlistTheme *theme) 453 pidgin_blist_theme_get_collapsed_background_color(PidginBlistTheme *theme)
439 { 454 {
440 PidginBlistThemePrivate *priv; 455 PidginBlistThemePrivate *priv;
441 456
442 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL); 457 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL);
444 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); 459 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
445 460
446 return priv->collapsed_color; 461 return priv->collapsed_color;
447 } 462 }
448 463
449 const font_color_pair * 464 FontColorPair *
450 pidgin_blist_theme_get_collapsed_text_info(PidginBlistTheme *theme) 465 pidgin_blist_theme_get_collapsed_text_info(PidginBlistTheme *theme)
451 { 466 {
452 PidginBlistThemePrivate *priv; 467 PidginBlistThemePrivate *priv;
453 468
454 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL); 469 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL);
456 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); 471 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
457 472
458 return priv->collapsed; 473 return priv->collapsed;
459 } 474 }
460 475
461 const GdkColor * 476 GdkColor *
462 pidgin_blist_theme_get_buddy_color_1(PidginBlistTheme *theme) 477 pidgin_blist_theme_get_buddy_color_1(PidginBlistTheme *theme)
463 { 478 {
464 PidginBlistThemePrivate *priv; 479 PidginBlistThemePrivate *priv;
465 480
466 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL); 481 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL);
468 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); 483 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
469 484
470 return priv->buddy_bgcolor1; 485 return priv->buddy_bgcolor1;
471 } 486 }
472 487
473 const GdkColor * 488 GdkColor *
474 pidgin_blist_theme_get_buddy_color_2(PidginBlistTheme *theme) 489 pidgin_blist_theme_get_buddy_color_2(PidginBlistTheme *theme)
475 { 490 {
476 PidginBlistThemePrivate *priv; 491 PidginBlistThemePrivate *priv;
477 492
478 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL); 493 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL);
480 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); 495 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
481 496
482 return priv->buddy_bgcolor2; 497 return priv->buddy_bgcolor2;
483 } 498 }
484 499
485 const font_color_pair * 500 FontColorPair *
486 pidgin_blist_theme_get_online_text_info(PidginBlistTheme *theme) 501 pidgin_blist_theme_get_online_text_info(PidginBlistTheme *theme)
487 { 502 {
488 PidginBlistThemePrivate *priv; 503 PidginBlistThemePrivate *priv;
489 504
490 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL); 505 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL);
492 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); 507 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
493 508
494 return priv->online; 509 return priv->online;
495 } 510 }
496 511
497 const font_color_pair * 512 FontColorPair *
498 pidgin_blist_theme_get_away_text_info(PidginBlistTheme *theme) 513 pidgin_blist_theme_get_away_text_info(PidginBlistTheme *theme)
499 { 514 {
500 PidginBlistThemePrivate *priv; 515 PidginBlistThemePrivate *priv;
501 516
502 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL); 517 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL);
504 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); 519 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
505 520
506 return priv->away; 521 return priv->away;
507 } 522 }
508 523
509 const font_color_pair * 524 FontColorPair *
510 pidgin_blist_theme_get_offline_text_info(PidginBlistTheme *theme) 525 pidgin_blist_theme_get_offline_text_info(PidginBlistTheme *theme)
511 { 526 {
512 PidginBlistThemePrivate *priv; 527 PidginBlistThemePrivate *priv;
513 528
514 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL); 529 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL);
516 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); 531 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
517 532
518 return priv->offline; 533 return priv->offline;
519 } 534 }
520 535
521 const font_color_pair * 536 FontColorPair *
522 pidgin_blist_theme_get_unread_message_text_info(PidginBlistTheme *theme) 537 pidgin_blist_theme_get_unread_message_text_info(PidginBlistTheme *theme)
523 { 538 {
524 PidginBlistThemePrivate *priv; 539 PidginBlistThemePrivate *priv;
525 540
526 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL); 541 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL);
528 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); 543 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
529 544
530 return priv->message; 545 return priv->message;
531 } 546 }
532 547
533 const font_color_pair * 548 FontColorPair *
534 pidgin_blist_theme_get_status_text_info(PidginBlistTheme *theme) 549 pidgin_blist_theme_get_status_text_info(PidginBlistTheme *theme)
535 { 550 {
536 PidginBlistThemePrivate *priv; 551 PidginBlistThemePrivate *priv;
537 552
538 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL); 553 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL);
540 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); 555 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
541 556
542 return priv->status; 557 return priv->status;
543 } 558 }
544 559
560 /* Set Methods */
561 void
562 pidgin_blist_theme_set_icon_theme(PidginBlistTheme *theme, const gchar *icon_theme)
563 {
564 PidginBlistThemePrivate *priv;
565
566 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme));
567
568 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
569
570 g_free(priv->icon_theme);
571 priv->icon_theme = g_strdup(icon_theme);
572 }
573
574 void
575 pidgin_blist_theme_set_background_color(PidginBlistTheme *theme, GdkColor *color)
576 {
577 PidginBlistThemePrivate *priv;
578
579 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme));
580
581 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
582
583 g_free(priv->bgcolor);
584 priv->bgcolor = color;
585 }
586
587 void
588 pidgin_blist_theme_set_opacity(PidginBlistTheme *theme, gdouble opacity)
589 {
590 PidginBlistThemePrivate *priv;
591
592 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme) || opacity < 0.0 || opacity > 1.0);
593
594 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
595
596 priv->opacity = opacity;
597 }
598
599 void
600 pidgin_blist_theme_set_layout(PidginBlistTheme *theme, PidginBlistLayout *layout)
601 {
602 PidginBlistThemePrivate *priv;
603
604 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme));
605
606 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
607
608 g_free(priv->layout);
609 priv->layout = layout;
610 }
611
612 void
613 pidgin_blist_theme_set_expanded_background_color(PidginBlistTheme *theme, GdkColor *color)
614 {
615 PidginBlistThemePrivate *priv;
616
617 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme));
618
619 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
620
621 g_free(priv->expanded_color);
622 priv->expanded_color = color;
623 }
624
625 void
626 pidgin_blist_theme_set_expanded_text_info(PidginBlistTheme *theme, FontColorPair *pair)
627 {
628 PidginBlistThemePrivate *priv;
629
630 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme));
631
632 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
633
634 free_font_and_color(priv->expanded);
635 priv->expanded = pair;
636 }
637
638 void
639 pidgin_blist_theme_set_collapsed_background_color(PidginBlistTheme *theme, GdkColor *color)
640 {
641 PidginBlistThemePrivate *priv;
642
643 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme));
644
645 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
646
647 g_free(priv->collapsed_color);
648 priv->collapsed_color = color;
649 }
650
651 void
652 pidgin_blist_theme_set_collapsed_text_info(PidginBlistTheme *theme, FontColorPair *pair)
653 {
654 PidginBlistThemePrivate *priv;
655
656 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme));
657
658 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
659
660 free_font_and_color(priv->collapsed);
661 priv->collapsed = pair;
662 }
663
664 void
665 pidgin_blist_theme_set_buddy_color_1(PidginBlistTheme *theme, GdkColor *color)
666 {
667 PidginBlistThemePrivate *priv;
668
669 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme));
670
671 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
672
673 g_free(priv->buddy_bgcolor1);
674 priv->buddy_bgcolor1 = color;
675 }
676
677 void
678 pidgin_blist_theme_set_buddy_color_2(PidginBlistTheme *theme, GdkColor *color)
679 {
680 PidginBlistThemePrivate *priv;
681
682 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme));
683
684 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
685
686 g_free(priv->buddy_bgcolor2);
687 priv->buddy_bgcolor2 = color;
688 }
689
690 void
691 pidgin_blist_theme_set_online_text_info(PidginBlistTheme *theme, FontColorPair *pair)
692 {
693 PidginBlistThemePrivate *priv;
694
695 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme));
696
697 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
698
699 free_font_and_color(priv->online);
700 priv->online = pair;
701 }
702
703 void
704 pidgin_blist_theme_set_away_text_info(PidginBlistTheme *theme, FontColorPair *pair)
705 {
706 PidginBlistThemePrivate *priv;
707
708 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme));
709
710 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
711
712 free_font_and_color(priv->away);
713 priv->away = pair;
714 }
715
716 void
717 pidgin_blist_theme_set_offline_text_info(PidginBlistTheme *theme, FontColorPair *pair)
718 {
719 PidginBlistThemePrivate *priv;
720
721 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme));
722
723 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
724
725 free_font_and_color(priv->offline);
726 priv->offline = pair;
727 }
728
729 void
730 pidgin_blist_theme_set_unread_message_text_info(PidginBlistTheme *theme, FontColorPair *pair)
731 {
732 PidginBlistThemePrivate *priv;
733
734 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme));
735
736 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
737
738 free_font_and_color(priv->message);
739 priv->message = pair;
740 }
741
742 void
743 pidgin_blist_theme_set_status_text_info(PidginBlistTheme *theme, FontColorPair *pair)
744 {
745 PidginBlistThemePrivate *priv;
746
747 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme));
748
749 priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
750
751 free_font_and_color(priv->status);
752 priv->status = pair;
753 }