2 * Buddy List Themes for Pidgin
4 * Pidgin is the legal property of its developers, whose names are too numerous
5 * to list here. Please refer to the COPYRIGHT file distributed with this
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
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
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
24 #include "glibcompat.h"
26 #include "gtkblist-theme.h"
28 #define PIDGIN_BLIST_THEME_GET_PRIVATE(Gobject) \
29 (G_TYPE_INSTANCE_GET_PRIVATE((Gobject), PIDGIN_TYPE_BLIST_THEME, PidginBlistThemePrivate))
31 /******************************************************************************
33 *****************************************************************************/
39 PidginBlistLayout
*layout
;
42 GdkRGBA
*expanded_color
;
43 PidginThemeFont
*expanded
;
45 GdkRGBA
*collapsed_color
;
46 PidginThemeFont
*collapsed
;
49 GdkRGBA
*contact_color
;
51 PidginThemeFont
*contact
;
53 PidginThemeFont
*online
;
54 PidginThemeFont
*away
;
55 PidginThemeFont
*offline
;
56 PidginThemeFont
*idle
;
57 PidginThemeFont
*message
;
58 PidginThemeFont
*message_nick_said
;
60 PidginThemeFont
*status
;
62 } PidginBlistThemePrivate
;
64 struct _PidginThemeFont
71 /******************************************************************************
73 *****************************************************************************/
77 PROP_BACKGROUND_COLOR
,
91 PROP_MESSAGE_NICK_SAID
,
96 /******************************************************************************
98 *****************************************************************************/
100 static GObjectClass
*parent_class
= NULL
;
101 static GParamSpec
*properties
[PROP_LAST
];
103 /******************************************************************************
105 *****************************************************************************/
108 pidgin_theme_font_new(const gchar
*face
, GdkRGBA
*color
)
110 PidginThemeFont
*font
= g_new0(PidginThemeFont
, 1);
111 font
->font
= g_strdup(face
);
113 pidgin_theme_font_set_color(font
, color
);
118 pidgin_theme_font_free(PidginThemeFont
*pair
)
123 gdk_rgba_free(pair
->gdkcolor
);
128 static PidginThemeFont
*
129 copy_font_and_color(const PidginThemeFont
*pair
)
131 PidginThemeFont
*copy
;
136 copy
= g_new0(PidginThemeFont
, 1);
137 copy
->font
= g_strdup(pair
->font
);
138 strncpy(copy
->color
, pair
->color
, sizeof(copy
->color
) - 1);
140 copy
->gdkcolor
= pair
->gdkcolor
? gdk_rgba_copy(pair
->gdkcolor
) : NULL
;
145 pidgin_theme_font_set_font_face(PidginThemeFont
*font
, const gchar
*face
)
147 g_return_if_fail(font
);
148 g_return_if_fail(face
);
151 font
->font
= g_strdup(face
);
155 pidgin_theme_font_set_color(PidginThemeFont
*font
, const GdkRGBA
*color
)
157 g_return_if_fail(font
);
160 gdk_rgba_free(font
->gdkcolor
);
162 font
->gdkcolor
= color
? gdk_rgba_copy(color
) : NULL
;
164 g_snprintf(font
->color
, sizeof(font
->color
),
166 (unsigned int)(color
->red
* 255),
167 (unsigned int)(color
->green
* 255),
168 (unsigned int)(color
->blue
* 255));
170 font
->color
[0] = '\0';
174 pidgin_theme_font_get_font_face(PidginThemeFont
*font
)
176 g_return_val_if_fail(font
, NULL
);
181 pidgin_theme_font_get_color(PidginThemeFont
*font
)
183 g_return_val_if_fail(font
, NULL
);
184 return font
->gdkcolor
;
188 pidgin_theme_font_get_color_describe(PidginThemeFont
*font
)
190 g_return_val_if_fail(font
, NULL
);
191 return font
->color
[0] ? font
->color
: NULL
;
194 /******************************************************************************
196 *****************************************************************************/
199 pidgin_blist_theme_get_property(GObject
*obj
, guint param_id
, GValue
*value
,
202 PidginBlistTheme
*theme
= PIDGIN_BLIST_THEME(obj
);
205 case PROP_BACKGROUND_COLOR
:
206 g_value_set_boxed(value
, pidgin_blist_theme_get_background_color(theme
));
209 g_value_set_double(value
, pidgin_blist_theme_get_opacity(theme
));
212 g_value_set_pointer(value
, pidgin_blist_theme_get_layout(theme
));
214 case PROP_EXPANDED_COLOR
:
215 g_value_set_boxed(value
, pidgin_blist_theme_get_expanded_background_color(theme
));
217 case PROP_EXPANDED_TEXT
:
218 g_value_set_pointer(value
, pidgin_blist_theme_get_expanded_text_info(theme
));
220 case PROP_COLLAPSED_COLOR
:
221 g_value_set_boxed(value
, pidgin_blist_theme_get_collapsed_background_color(theme
));
223 case PROP_COLLAPSED_TEXT
:
224 g_value_set_pointer(value
, pidgin_blist_theme_get_collapsed_text_info(theme
));
226 case PROP_CONTACT_COLOR
:
227 g_value_set_boxed(value
, pidgin_blist_theme_get_contact_color(theme
));
230 g_value_set_pointer(value
, pidgin_blist_theme_get_contact_text_info(theme
));
233 g_value_set_pointer(value
, pidgin_blist_theme_get_online_text_info(theme
));
236 g_value_set_pointer(value
, pidgin_blist_theme_get_away_text_info(theme
));
239 g_value_set_pointer(value
, pidgin_blist_theme_get_offline_text_info(theme
));
242 g_value_set_pointer(value
, pidgin_blist_theme_get_idle_text_info(theme
));
245 g_value_set_pointer(value
, pidgin_blist_theme_get_unread_message_text_info(theme
));
247 case PROP_MESSAGE_NICK_SAID
:
248 g_value_set_pointer(value
, pidgin_blist_theme_get_unread_message_nick_said_text_info(theme
));
251 g_value_set_pointer(value
, pidgin_blist_theme_get_status_text_info(theme
));
254 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj
, param_id
, psec
);
260 pidgin_blist_theme_set_property(GObject
*obj
, guint param_id
, const GValue
*value
,
263 PidginBlistTheme
*theme
= PIDGIN_BLIST_THEME(obj
);
266 case PROP_BACKGROUND_COLOR
:
267 pidgin_blist_theme_set_background_color(theme
, g_value_get_boxed(value
));
270 pidgin_blist_theme_set_opacity(theme
, g_value_get_double(value
));
273 pidgin_blist_theme_set_layout(theme
, g_value_get_pointer(value
));
275 case PROP_EXPANDED_COLOR
:
276 pidgin_blist_theme_set_expanded_background_color(theme
, g_value_get_boxed(value
));
278 case PROP_EXPANDED_TEXT
:
279 pidgin_blist_theme_set_expanded_text_info(theme
, g_value_get_pointer(value
));
281 case PROP_COLLAPSED_COLOR
:
282 pidgin_blist_theme_set_collapsed_background_color(theme
, g_value_get_boxed(value
));
284 case PROP_COLLAPSED_TEXT
:
285 pidgin_blist_theme_set_collapsed_text_info(theme
, g_value_get_pointer(value
));
287 case PROP_CONTACT_COLOR
:
288 pidgin_blist_theme_set_contact_color(theme
, g_value_get_boxed(value
));
291 pidgin_blist_theme_set_contact_text_info(theme
, g_value_get_pointer(value
));
294 pidgin_blist_theme_set_online_text_info(theme
, g_value_get_pointer(value
));
297 pidgin_blist_theme_set_away_text_info(theme
, g_value_get_pointer(value
));
300 pidgin_blist_theme_set_offline_text_info(theme
, g_value_get_pointer(value
));
303 pidgin_blist_theme_set_idle_text_info(theme
, g_value_get_pointer(value
));
306 pidgin_blist_theme_set_unread_message_text_info(theme
, g_value_get_pointer(value
));
308 case PROP_MESSAGE_NICK_SAID
:
309 pidgin_blist_theme_set_unread_message_nick_said_text_info(theme
, g_value_get_pointer(value
));
312 pidgin_blist_theme_set_status_text_info(theme
, g_value_get_pointer(value
));
315 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj
, param_id
, psec
);
321 pidgin_blist_theme_finalize(GObject
*obj
)
323 PidginBlistThemePrivate
*priv
;
325 priv
= PIDGIN_BLIST_THEME_GET_PRIVATE(obj
);
329 gdk_rgba_free(priv
->bgcolor
);
330 g_free(priv
->layout
);
333 if (priv
->expanded_color
)
334 gdk_rgba_free(priv
->expanded_color
);
335 pidgin_theme_font_free(priv
->expanded
);
336 if (priv
->collapsed_color
)
337 gdk_rgba_free(priv
->collapsed_color
);
338 pidgin_theme_font_free(priv
->collapsed
);
341 if (priv
->contact_color
)
342 gdk_rgba_free(priv
->contact_color
);
343 pidgin_theme_font_free(priv
->contact
);
344 pidgin_theme_font_free(priv
->online
);
345 pidgin_theme_font_free(priv
->away
);
346 pidgin_theme_font_free(priv
->offline
);
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
);
352 parent_class
->finalize (obj
);
356 pidgin_blist_theme_init(PidginBlistTheme
*theme
)
358 PIDGIN_BLIST_THEME_GET_PRIVATE(theme
)->opacity
= 1.0;
362 pidgin_blist_theme_class_init(PidginBlistThemeClass
*klass
)
364 GObjectClass
*obj_class
= G_OBJECT_CLASS(klass
);
366 parent_class
= g_type_class_peek_parent (klass
);
368 g_type_class_add_private(klass
, sizeof(PidginBlistThemePrivate
));
370 obj_class
->get_property
= pidgin_blist_theme_get_property
;
371 obj_class
->set_property
= pidgin_blist_theme_set_property
;
372 obj_class
->finalize
= pidgin_blist_theme_finalize
;
375 properties
[PROP_BACKGROUND_COLOR
] = g_param_spec_boxed("background-color",
377 "The background color for the buddy list",
378 GDK_TYPE_RGBA
, G_PARAM_READWRITE
| G_PARAM_STATIC_STRINGS
);
380 properties
[PROP_OPACITY
] = g_param_spec_double("opacity", "Opacity",
381 "The opacity of the buddy list",
382 0.0, 1.0, 1.0, G_PARAM_READWRITE
| G_PARAM_STATIC_STRINGS
);
384 properties
[PROP_LAYOUT
] = g_param_spec_pointer("layout", "Layout",
385 "The layout of icons, name, and status of the buddy list",
386 G_PARAM_READWRITE
| G_PARAM_STATIC_STRINGS
);
389 properties
[PROP_EXPANDED_COLOR
] = g_param_spec_boxed("expanded-color",
390 "Expanded Background Color",
391 "The background color of an expanded group",
392 GDK_TYPE_RGBA
, G_PARAM_READWRITE
| G_PARAM_STATIC_STRINGS
);
394 properties
[PROP_EXPANDED_TEXT
] = g_param_spec_pointer("expanded-text",
396 "The text information for when a group is expanded",
397 G_PARAM_READWRITE
| G_PARAM_STATIC_STRINGS
);
399 properties
[PROP_COLLAPSED_COLOR
] = g_param_spec_boxed("collapsed-color",
400 "Collapsed Background Color",
401 "The background color of a collapsed group",
402 GDK_TYPE_RGBA
, G_PARAM_READWRITE
| G_PARAM_STATIC_STRINGS
);
404 properties
[PROP_COLLAPSED_TEXT
] = g_param_spec_pointer("collapsed-text",
406 "The text information for when a group is collapsed",
407 G_PARAM_READWRITE
| G_PARAM_STATIC_STRINGS
);
410 properties
[PROP_CONTACT_COLOR
] = g_param_spec_boxed("contact-color",
411 "Contact/Chat Background Color",
412 "The background color of a contact or chat",
413 GDK_TYPE_RGBA
, G_PARAM_READWRITE
| G_PARAM_STATIC_STRINGS
);
415 properties
[PROP_CONTACT
] = g_param_spec_pointer("contact",
417 "The text information for when a contact is expanded",
418 G_PARAM_READWRITE
| G_PARAM_STATIC_STRINGS
);
420 properties
[PROP_ONLINE
] = g_param_spec_pointer("online",
422 "The text information for when a buddy is online",
423 G_PARAM_READWRITE
| G_PARAM_STATIC_STRINGS
);
425 properties
[PROP_AWAY
] = g_param_spec_pointer("away",
427 "The text information for when a buddy is away",
428 G_PARAM_READWRITE
| G_PARAM_STATIC_STRINGS
);
430 properties
[PROP_OFFLINE
] = g_param_spec_pointer("offline",
432 "The text information for when a buddy is offline",
433 G_PARAM_READWRITE
| G_PARAM_STATIC_STRINGS
);
435 properties
[PROP_IDLE
] = g_param_spec_pointer("idle",
437 "The text information for when a buddy is idle",
438 G_PARAM_READWRITE
| G_PARAM_STATIC_STRINGS
);
440 properties
[PROP_MESSAGE
] = g_param_spec_pointer("message",
442 "The text information for when a buddy has an unread message",
443 G_PARAM_READWRITE
| G_PARAM_STATIC_STRINGS
);
445 properties
[PROP_MESSAGE_NICK_SAID
] = g_param_spec_pointer("message-nick-said",
446 "Message (Nick Said) Text",
447 "The text information for when a chat has an unread message that mentions your nickname",
448 G_PARAM_READWRITE
| G_PARAM_STATIC_STRINGS
);
450 properties
[PROP_STATUS
] = g_param_spec_pointer("status",
452 "The text information for a buddy's status",
453 G_PARAM_READWRITE
| G_PARAM_STATIC_STRINGS
);
455 g_object_class_install_properties(obj_class
, PROP_LAST
, properties
);
459 pidgin_blist_theme_get_type (void)
461 static GType type
= 0;
463 static GTypeInfo info
= {
464 sizeof(PidginBlistThemeClass
),
465 NULL
, /* base_init */
466 NULL
, /* base_finalize */
467 (GClassInitFunc
)pidgin_blist_theme_class_init
, /* class_init */
468 NULL
, /* class_finalize */
469 NULL
, /* class_data */
470 sizeof(PidginBlistTheme
),
472 (GInstanceInitFunc
)pidgin_blist_theme_init
, /* instance_init */
473 NULL
, /* value table */
475 type
= g_type_register_static (PURPLE_TYPE_THEME
,
476 "PidginBlistTheme", &info
, 0);
481 /**************************************************************************
483 **************************************************************************/
485 static PidginThemeFont
*
486 pidgin_theme_font_copy(PidginThemeFont
*font
)
488 g_return_val_if_fail(font
!= NULL
, NULL
);
490 return pidgin_theme_font_new(font
->font
, font
->gdkcolor
);
494 pidgin_theme_font_get_type(void)
496 static GType type
= 0;
499 type
= g_boxed_type_register_static("PidginThemeFont",
500 (GBoxedCopyFunc
)pidgin_theme_font_copy
,
501 (GBoxedFreeFunc
)pidgin_theme_font_free
);
507 static PidginBlistLayout
*
508 pidgin_blist_layout_copy(const PidginBlistLayout
*layout
)
510 g_return_val_if_fail(layout
!= NULL
, NULL
);
512 return g_memdup(layout
, sizeof(PidginBlistLayout
));
516 pidgin_blist_layout_get_type(void)
518 static GType type
= 0;
521 type
= g_boxed_type_register_static("PidginBlistLayout",
522 (GBoxedCopyFunc
)pidgin_blist_layout_copy
,
523 (GBoxedFreeFunc
)g_free
);
530 /*****************************************************************************
531 * Public API functions
532 *****************************************************************************/
537 pidgin_blist_theme_get_background_color(PidginBlistTheme
*theme
)
539 PidginBlistThemePrivate
*priv
;
541 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme
), NULL
);
543 priv
= PIDGIN_BLIST_THEME_GET_PRIVATE(theme
);
545 return priv
->bgcolor
;
549 pidgin_blist_theme_get_opacity(PidginBlistTheme
*theme
)
551 PidginBlistThemePrivate
*priv
;
553 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme
), 1.0);
555 priv
= PIDGIN_BLIST_THEME_GET_PRIVATE(theme
);
557 return priv
->opacity
;
561 pidgin_blist_theme_get_layout(PidginBlistTheme
*theme
)
563 PidginBlistThemePrivate
*priv
;
565 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme
), NULL
);
567 priv
= PIDGIN_BLIST_THEME_GET_PRIVATE(theme
);
573 pidgin_blist_theme_get_expanded_background_color(PidginBlistTheme
*theme
)
575 PidginBlistThemePrivate
*priv
;
577 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme
), NULL
);
579 priv
= PIDGIN_BLIST_THEME_GET_PRIVATE(theme
);
581 return priv
->expanded_color
;
585 pidgin_blist_theme_get_expanded_text_info(PidginBlistTheme
*theme
)
587 PidginBlistThemePrivate
*priv
;
589 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme
), NULL
);
591 priv
= PIDGIN_BLIST_THEME_GET_PRIVATE(theme
);
593 return priv
->expanded
;
597 pidgin_blist_theme_get_collapsed_background_color(PidginBlistTheme
*theme
)
599 PidginBlistThemePrivate
*priv
;
601 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme
), NULL
);
603 priv
= PIDGIN_BLIST_THEME_GET_PRIVATE(theme
);
605 return priv
->collapsed_color
;
609 pidgin_blist_theme_get_collapsed_text_info(PidginBlistTheme
*theme
)
611 PidginBlistThemePrivate
*priv
;
613 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme
), NULL
);
615 priv
= PIDGIN_BLIST_THEME_GET_PRIVATE(theme
);
617 return priv
->collapsed
;
621 pidgin_blist_theme_get_contact_color(PidginBlistTheme
*theme
)
623 PidginBlistThemePrivate
*priv
;
625 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme
), NULL
);
627 priv
= PIDGIN_BLIST_THEME_GET_PRIVATE(theme
);
629 return priv
->contact_color
;
633 pidgin_blist_theme_get_contact_text_info(PidginBlistTheme
*theme
)
635 PidginBlistThemePrivate
*priv
;
637 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme
), NULL
);
639 priv
= PIDGIN_BLIST_THEME_GET_PRIVATE(theme
);
641 return priv
->contact
;
645 pidgin_blist_theme_get_online_text_info(PidginBlistTheme
*theme
)
647 PidginBlistThemePrivate
*priv
;
649 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme
), NULL
);
651 priv
= PIDGIN_BLIST_THEME_GET_PRIVATE(theme
);
657 pidgin_blist_theme_get_away_text_info(PidginBlistTheme
*theme
)
659 PidginBlistThemePrivate
*priv
;
661 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme
), NULL
);
663 priv
= PIDGIN_BLIST_THEME_GET_PRIVATE(theme
);
669 pidgin_blist_theme_get_offline_text_info(PidginBlistTheme
*theme
)
671 PidginBlistThemePrivate
*priv
;
673 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme
), NULL
);
675 priv
= PIDGIN_BLIST_THEME_GET_PRIVATE(theme
);
677 return priv
->offline
;
681 pidgin_blist_theme_get_idle_text_info(PidginBlistTheme
*theme
)
683 PidginBlistThemePrivate
*priv
;
685 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme
), NULL
);
687 priv
= PIDGIN_BLIST_THEME_GET_PRIVATE(theme
);
693 pidgin_blist_theme_get_unread_message_text_info(PidginBlistTheme
*theme
)
695 PidginBlistThemePrivate
*priv
;
697 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme
), NULL
);
699 priv
= PIDGIN_BLIST_THEME_GET_PRIVATE(theme
);
701 return priv
->message
;
705 pidgin_blist_theme_get_unread_message_nick_said_text_info(PidginBlistTheme
*theme
)
707 PidginBlistThemePrivate
*priv
;
709 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme
), NULL
);
711 priv
= PIDGIN_BLIST_THEME_GET_PRIVATE(theme
);
713 return priv
->message_nick_said
;
717 pidgin_blist_theme_get_status_text_info(PidginBlistTheme
*theme
)
719 PidginBlistThemePrivate
*priv
;
721 g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme
), NULL
);
723 priv
= PIDGIN_BLIST_THEME_GET_PRIVATE(theme
);
730 pidgin_blist_theme_set_background_color(PidginBlistTheme
*theme
, const GdkRGBA
*color
)
732 PidginBlistThemePrivate
*priv
;
734 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme
));
736 priv
= PIDGIN_BLIST_THEME_GET_PRIVATE(theme
);
739 gdk_rgba_free(priv
->bgcolor
);
740 priv
->bgcolor
= color
? gdk_rgba_copy(color
) : NULL
;
742 g_object_notify_by_pspec(G_OBJECT(theme
), properties
[PROP_BACKGROUND_COLOR
]);
746 pidgin_blist_theme_set_opacity(PidginBlistTheme
*theme
, gdouble opacity
)
748 PidginBlistThemePrivate
*priv
;
750 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme
) || opacity
< 0.0 || opacity
> 1.0);
752 priv
= PIDGIN_BLIST_THEME_GET_PRIVATE(theme
);
754 priv
->opacity
= opacity
;
756 g_object_notify_by_pspec(G_OBJECT(theme
), properties
[PROP_OPACITY
]);
760 pidgin_blist_theme_set_layout(PidginBlistTheme
*theme
, const PidginBlistLayout
*layout
)
762 PidginBlistThemePrivate
*priv
;
764 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme
));
766 priv
= PIDGIN_BLIST_THEME_GET_PRIVATE(theme
);
768 g_free(priv
->layout
);
769 priv
->layout
= pidgin_blist_layout_copy(layout
);
771 g_object_notify_by_pspec(G_OBJECT(theme
), properties
[PROP_LAYOUT
]);
775 pidgin_blist_theme_set_expanded_background_color(PidginBlistTheme
*theme
, const GdkRGBA
*color
)
777 PidginBlistThemePrivate
*priv
;
779 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme
));
781 priv
= PIDGIN_BLIST_THEME_GET_PRIVATE(theme
);
783 if (priv
->expanded_color
)
784 gdk_rgba_free(priv
->expanded_color
);
785 priv
->expanded_color
= color
? gdk_rgba_copy(color
) : NULL
;
787 g_object_notify_by_pspec(G_OBJECT(theme
), properties
[PROP_EXPANDED_COLOR
]);
791 pidgin_blist_theme_set_expanded_text_info(PidginBlistTheme
*theme
, const PidginThemeFont
*pair
)
793 PidginBlistThemePrivate
*priv
;
795 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme
));
797 priv
= PIDGIN_BLIST_THEME_GET_PRIVATE(theme
);
799 pidgin_theme_font_free(priv
->expanded
);
800 priv
->expanded
= copy_font_and_color(pair
);
802 g_object_notify_by_pspec(G_OBJECT(theme
), properties
[PROP_EXPANDED_TEXT
]);
806 pidgin_blist_theme_set_collapsed_background_color(PidginBlistTheme
*theme
, const GdkRGBA
*color
)
808 PidginBlistThemePrivate
*priv
;
810 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme
));
812 priv
= PIDGIN_BLIST_THEME_GET_PRIVATE(theme
);
814 if (priv
->collapsed_color
)
815 gdk_rgba_free(priv
->collapsed_color
);
816 priv
->collapsed_color
= color
? gdk_rgba_copy(color
) : NULL
;
818 g_object_notify_by_pspec(G_OBJECT(theme
), properties
[PROP_COLLAPSED_COLOR
]);
822 pidgin_blist_theme_set_collapsed_text_info(PidginBlistTheme
*theme
, const PidginThemeFont
*pair
)
824 PidginBlistThemePrivate
*priv
;
826 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme
));
828 priv
= PIDGIN_BLIST_THEME_GET_PRIVATE(theme
);
830 pidgin_theme_font_free(priv
->collapsed
);
831 priv
->collapsed
= copy_font_and_color(pair
);
833 g_object_notify_by_pspec(G_OBJECT(theme
), properties
[PROP_COLLAPSED_TEXT
]);
837 pidgin_blist_theme_set_contact_color(PidginBlistTheme
*theme
, const GdkRGBA
*color
)
839 PidginBlistThemePrivate
*priv
;
841 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme
));
843 priv
= PIDGIN_BLIST_THEME_GET_PRIVATE(theme
);
845 if (priv
->contact_color
)
846 gdk_rgba_free(priv
->contact_color
);
847 priv
->contact_color
= color
? gdk_rgba_copy(color
) : NULL
;
849 g_object_notify_by_pspec(G_OBJECT(theme
), properties
[PROP_CONTACT_COLOR
]);
853 pidgin_blist_theme_set_contact_text_info(PidginBlistTheme
*theme
, const PidginThemeFont
*pair
)
855 PidginBlistThemePrivate
*priv
;
857 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme
));
859 priv
= PIDGIN_BLIST_THEME_GET_PRIVATE(theme
);
861 pidgin_theme_font_free(priv
->contact
);
862 priv
->contact
= copy_font_and_color(pair
);
864 g_object_notify_by_pspec(G_OBJECT(theme
), properties
[PROP_CONTACT
]);
868 pidgin_blist_theme_set_online_text_info(PidginBlistTheme
*theme
, const PidginThemeFont
*pair
)
870 PidginBlistThemePrivate
*priv
;
872 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme
));
874 priv
= PIDGIN_BLIST_THEME_GET_PRIVATE(theme
);
876 pidgin_theme_font_free(priv
->online
);
877 priv
->online
= copy_font_and_color(pair
);
879 g_object_notify_by_pspec(G_OBJECT(theme
), properties
[PROP_ONLINE
]);
883 pidgin_blist_theme_set_away_text_info(PidginBlistTheme
*theme
, const PidginThemeFont
*pair
)
885 PidginBlistThemePrivate
*priv
;
887 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme
));
889 priv
= PIDGIN_BLIST_THEME_GET_PRIVATE(theme
);
891 pidgin_theme_font_free(priv
->away
);
892 priv
->away
= copy_font_and_color(pair
);
894 g_object_notify_by_pspec(G_OBJECT(theme
), properties
[PROP_AWAY
]);
898 pidgin_blist_theme_set_offline_text_info(PidginBlistTheme
*theme
, const PidginThemeFont
*pair
)
900 PidginBlistThemePrivate
*priv
;
902 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme
));
904 priv
= PIDGIN_BLIST_THEME_GET_PRIVATE(theme
);
906 pidgin_theme_font_free(priv
->offline
);
907 priv
->offline
= copy_font_and_color(pair
);
909 g_object_notify_by_pspec(G_OBJECT(theme
), properties
[PROP_OFFLINE
]);
913 pidgin_blist_theme_set_idle_text_info(PidginBlistTheme
*theme
, const PidginThemeFont
*pair
)
915 PidginBlistThemePrivate
*priv
;
917 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme
));
919 priv
= PIDGIN_BLIST_THEME_GET_PRIVATE(theme
);
921 pidgin_theme_font_free(priv
->idle
);
922 priv
->idle
= copy_font_and_color(pair
);
924 g_object_notify_by_pspec(G_OBJECT(theme
), properties
[PROP_IDLE
]);
928 pidgin_blist_theme_set_unread_message_text_info(PidginBlistTheme
*theme
, const PidginThemeFont
*pair
)
930 PidginBlistThemePrivate
*priv
;
932 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme
));
934 priv
= PIDGIN_BLIST_THEME_GET_PRIVATE(theme
);
936 pidgin_theme_font_free(priv
->message
);
937 priv
->message
= copy_font_and_color(pair
);
939 g_object_notify_by_pspec(G_OBJECT(theme
), properties
[PROP_MESSAGE
]);
943 pidgin_blist_theme_set_unread_message_nick_said_text_info(PidginBlistTheme
*theme
, const PidginThemeFont
*pair
)
945 PidginBlistThemePrivate
*priv
;
947 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme
));
949 priv
= PIDGIN_BLIST_THEME_GET_PRIVATE(theme
);
951 pidgin_theme_font_free(priv
->message_nick_said
);
952 priv
->message_nick_said
= copy_font_and_color(pair
);
954 g_object_notify_by_pspec(G_OBJECT(theme
), properties
[PROP_MESSAGE_NICK_SAID
]);
958 pidgin_blist_theme_set_status_text_info(PidginBlistTheme
*theme
, const PidginThemeFont
*pair
)
960 PidginBlistThemePrivate
*priv
;
962 g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme
));
964 priv
= PIDGIN_BLIST_THEME_GET_PRIVATE(theme
);
966 pidgin_theme_font_free(priv
->status
);
967 priv
->status
= copy_font_and_color(pair
);
969 g_object_notify_by_pspec(G_OBJECT(theme
), properties
[PROP_STATUS
]);