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