annotate libpurple/theme.c @ 25362:65cfc59858cf

propagate from branch 'im.pidgin.pidgin' (head d5bb29138cbe033bbfd8ec689203d73818765327) to branch 'im.pidgin.pidgin.next.minor' (head 35ee8e40db640867e5b9239030cdc326e7f0a005)
author Gary Kramlich <grim@reaperworld.com>
date Sat, 13 Dec 2008 05:45:27 +0000
parents 1eacf60a73dd
children 0c7b74fc558e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
1 /*
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
2 * Themes for LibPurple
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
3 *
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
4 * Pidgin is the legal property of its developers, whose names are too numerous
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
5 * to list here. Please refer to the COPYRIGHT file distributed with this
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
6 * source distribution.
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
7 *
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
11 * (at your option) any later version.
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
12 *
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
16 * GNU General Public License for more details.
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
17 *
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
21 *
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
22 */
25349
1eacf60a73dd Fix some theme manager assertion failures.
Richard Laager <rlaager@wiktel.com>
parents: 23699
diff changeset
23 #include <glib.h>
1eacf60a73dd Fix some theme manager assertion failures.
Richard Laager <rlaager@wiktel.com>
parents: 23699
diff changeset
24 #include <string.h>
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
25
25349
1eacf60a73dd Fix some theme manager assertion failures.
Richard Laager <rlaager@wiktel.com>
parents: 23699
diff changeset
26 #include "internal.h"
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
27 #include "theme.h"
23699
fc8047e1fa39 fixed some leaks and made theme loading safer
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23483
diff changeset
28 #include "util.h"
fc8047e1fa39 fixed some leaks and made theme loading safer
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23483
diff changeset
29
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
30 #define PURPLE_THEME_GET_PRIVATE(PurpleTheme) \
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
31 ((PurpleThemePrivate *) ((PurpleTheme)->priv))
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
32
23461
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23457
diff changeset
33 void purple_theme_set_type_string(PurpleTheme *theme, const gchar *type);
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
34
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
35 /******************************************************************************
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
36 * Structs
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
37 *****************************************************************************/
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
38 typedef struct {
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
39 gchar *name;
23456
8f397c8e728a Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23452
diff changeset
40 gchar *description;
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
41 gchar *author;
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
42 gchar *type;
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
43 gchar *dir;
23472
fbf72bbd1084 Fixed up a few typos, readability, leaks, and bugs, all minor and mostly in theme and theme loader classes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23466
diff changeset
44 gchar *img;
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
45 } PurpleThemePrivate;
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
46
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
47 /******************************************************************************
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
48 * Globals
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
49 *****************************************************************************/
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
50
23461
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23457
diff changeset
51 static GObjectClass *parent_class = NULL;
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23457
diff changeset
52
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
53 /******************************************************************************
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
54 * Enums
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
55 *****************************************************************************/
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
56
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
57 enum {
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
58 PROP_ZERO = 0,
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
59 PROP_NAME,
23483
748308865dbf Changed how the prefs handle themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23472
diff changeset
60 PROP_DESCRIPTION,
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
61 PROP_AUTHOR,
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
62 PROP_TYPE,
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
63 PROP_DIR,
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
64 PROP_IMAGE
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
65 };
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
66
23452
68b7691aa3ed Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23451
diff changeset
67 /******************************************************************************
68b7691aa3ed Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23451
diff changeset
68 * GObject Stuff *
68b7691aa3ed Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23451
diff changeset
69 *****************************************************************************/
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
70
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
71 static void
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
72 purple_theme_get_property(GObject *obj, guint param_id, GValue *value,
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
73 GParamSpec *psec)
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
74 {
23451
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23450
diff changeset
75 PurpleTheme *theme = PURPLE_THEME(obj);
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
76
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
77 switch(param_id) {
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
78 case PROP_NAME:
23451
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23450
diff changeset
79 g_value_set_string(value, purple_theme_get_name(theme));
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
80 break;
23483
748308865dbf Changed how the prefs handle themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23472
diff changeset
81 case PROP_DESCRIPTION:
23456
8f397c8e728a Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23452
diff changeset
82 g_value_set_string(value, purple_theme_get_description(theme));
8f397c8e728a Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23452
diff changeset
83 break;
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
84 case PROP_AUTHOR:
23451
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23450
diff changeset
85 g_value_set_string(value, purple_theme_get_author(theme));
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
86 break;
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
87 case PROP_TYPE:
23451
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23450
diff changeset
88 g_value_set_string(value, purple_theme_get_type_string(theme));
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
89 break;
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
90 case PROP_DIR:
23451
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23450
diff changeset
91 g_value_set_string(value, purple_theme_get_dir(theme));
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
92 break;
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
93 case PROP_IMAGE:
23472
fbf72bbd1084 Fixed up a few typos, readability, leaks, and bugs, all minor and mostly in theme and theme loader classes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23466
diff changeset
94 g_value_set_string(value, purple_theme_get_image(theme));
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
95 break;
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
96 default:
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
97 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, psec);
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
98 break;
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
99 }
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
100 }
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
101
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
102 static void
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
103 purple_theme_set_property(GObject *obj, guint param_id, const GValue *value,
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
104 GParamSpec *psec)
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
105 {
23451
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23450
diff changeset
106 PurpleTheme *theme = PURPLE_THEME(obj);
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
107
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
108 switch(param_id) {
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
109 case PROP_NAME:
23451
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23450
diff changeset
110 purple_theme_set_name(theme, g_value_get_string(value));
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
111 break;
23483
748308865dbf Changed how the prefs handle themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23472
diff changeset
112 case PROP_DESCRIPTION:
23456
8f397c8e728a Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23452
diff changeset
113 purple_theme_set_description(theme, g_value_get_string(value));
8f397c8e728a Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23452
diff changeset
114 break;
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
115 case PROP_AUTHOR:
23451
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23450
diff changeset
116 purple_theme_set_author(theme, g_value_get_string(value));
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
117 break;
23461
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23457
diff changeset
118 case PROP_TYPE:
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23457
diff changeset
119 purple_theme_set_type_string(theme, g_value_get_string(value));
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23457
diff changeset
120 break;
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
121 case PROP_DIR:
23451
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23450
diff changeset
122 purple_theme_set_dir(theme, g_value_get_string(value));
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
123 break;
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
124 case PROP_IMAGE:
23472
fbf72bbd1084 Fixed up a few typos, readability, leaks, and bugs, all minor and mostly in theme and theme loader classes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23466
diff changeset
125 purple_theme_set_image(theme, g_value_get_string(value));
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
126 break;
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
127 default:
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
128 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, psec);
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
129 break;
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
130 }
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
131 }
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
132
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
133 static void
23466
5a02912e0bac more gobject fixed
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23465
diff changeset
134 purple_theme_init(GTypeInstance *instance,
5a02912e0bac more gobject fixed
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23465
diff changeset
135 gpointer klass)
5a02912e0bac more gobject fixed
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23465
diff changeset
136 {
23472
fbf72bbd1084 Fixed up a few typos, readability, leaks, and bugs, all minor and mostly in theme and theme loader classes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23466
diff changeset
137 PurpleTheme *theme = PURPLE_THEME(instance);
fbf72bbd1084 Fixed up a few typos, readability, leaks, and bugs, all minor and mostly in theme and theme loader classes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23466
diff changeset
138 theme->priv = g_new0(PurpleThemePrivate, 1);
23466
5a02912e0bac more gobject fixed
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23465
diff changeset
139 }
5a02912e0bac more gobject fixed
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23465
diff changeset
140
5a02912e0bac more gobject fixed
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23465
diff changeset
141 static void
23461
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23457
diff changeset
142 purple_theme_finalize(GObject *obj)
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23457
diff changeset
143 {
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23457
diff changeset
144 PurpleTheme *theme = PURPLE_THEME(obj);
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23457
diff changeset
145 PurpleThemePrivate *priv = PURPLE_THEME_GET_PRIVATE(theme);
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23457
diff changeset
146
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23457
diff changeset
147 g_free(priv->name);
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23457
diff changeset
148 g_free(priv->description);
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23457
diff changeset
149 g_free(priv->author);
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23457
diff changeset
150 g_free(priv->type);
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23457
diff changeset
151 g_free(priv->dir);
23472
fbf72bbd1084 Fixed up a few typos, readability, leaks, and bugs, all minor and mostly in theme and theme loader classes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23466
diff changeset
152 g_free(priv->img);
23461
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23457
diff changeset
153
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23457
diff changeset
154 G_OBJECT_CLASS (parent_class)->finalize (obj);
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23457
diff changeset
155 }
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23457
diff changeset
156
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23457
diff changeset
157 static void
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
158 purple_theme_class_init (PurpleThemeClass *klass)
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
159 {
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
160 GObjectClass *obj_class = G_OBJECT_CLASS(klass);
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
161 GParamSpec *pspec;
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
162
23461
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23457
diff changeset
163 parent_class = g_type_class_peek_parent(klass);
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
164
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
165 obj_class->get_property = purple_theme_get_property;
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
166 obj_class->set_property = purple_theme_set_property;
23461
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23457
diff changeset
167 obj_class->finalize = purple_theme_finalize;
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
168
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
169 /* NAME */
23466
5a02912e0bac more gobject fixed
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23465
diff changeset
170 pspec = g_param_spec_string("name", "Name",
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
171 "The name of the theme",
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
172 NULL,
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
173 G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
174 g_object_class_install_property(obj_class, PROP_NAME, pspec);
23483
748308865dbf Changed how the prefs handle themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23472
diff changeset
175
748308865dbf Changed how the prefs handle themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23472
diff changeset
176 /* DESCRIPTION */
23466
5a02912e0bac more gobject fixed
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23465
diff changeset
177 pspec = g_param_spec_string("description", "Description",
23456
8f397c8e728a Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23452
diff changeset
178 "The description of the theme",
8f397c8e728a Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23452
diff changeset
179 NULL,
8f397c8e728a Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23452
diff changeset
180 G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
23483
748308865dbf Changed how the prefs handle themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23472
diff changeset
181 g_object_class_install_property(obj_class, PROP_DESCRIPTION, pspec);
748308865dbf Changed how the prefs handle themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23472
diff changeset
182
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
183 /* AUTHOR */
23466
5a02912e0bac more gobject fixed
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23465
diff changeset
184 pspec = g_param_spec_string("author", "Author",
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
185 "The author of the theme",
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
186 NULL,
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
187 G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
188 g_object_class_install_property(obj_class, PROP_AUTHOR, pspec);
23483
748308865dbf Changed how the prefs handle themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23472
diff changeset
189
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
190 /* TYPE STRING (read only) */
23466
5a02912e0bac more gobject fixed
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23465
diff changeset
191 pspec = g_param_spec_string("type", "Type",
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
192 "The string represtenting the type of the theme",
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
193 NULL,
23466
5a02912e0bac more gobject fixed
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23465
diff changeset
194 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
195 g_object_class_install_property(obj_class, PROP_TYPE, pspec);
23483
748308865dbf Changed how the prefs handle themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23472
diff changeset
196
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
197 /* DIRECTORY */
23466
5a02912e0bac more gobject fixed
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23465
diff changeset
198 pspec = g_param_spec_string("directory", "Directory",
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
199 "The directory that contains the theme and all its files",
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
200 NULL,
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
201 G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
202 g_object_class_install_property(obj_class, PROP_DIR, pspec);
23483
748308865dbf Changed how the prefs handle themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23472
diff changeset
203
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
204 /* PREVIEW IMAGE */
23472
fbf72bbd1084 Fixed up a few typos, readability, leaks, and bugs, all minor and mostly in theme and theme loader classes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23466
diff changeset
205 pspec = g_param_spec_string("image", "Image",
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
206 "A preview image of the theme",
23472
fbf72bbd1084 Fixed up a few typos, readability, leaks, and bugs, all minor and mostly in theme and theme loader classes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23466
diff changeset
207 NULL,
23465
d60c3d1c6966 fixed some gobject stuff
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23461
diff changeset
208 G_PARAM_READWRITE);
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
209 g_object_class_install_property(obj_class, PROP_IMAGE, pspec);
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
210 }
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
211
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
212
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
213 GType
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
214 purple_theme_get_type (void)
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
215 {
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
216 static GType type = 0;
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
217 if (type == 0) {
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
218 static const GTypeInfo info = {
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
219 sizeof (PurpleThemeClass),
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
220 NULL, /* base_init */
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
221 NULL, /* base_finalize */
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
222 (GClassInitFunc)purple_theme_class_init, /* class_init */
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
223 NULL, /* class_finalize */
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
224 NULL, /* class_data */
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
225 sizeof (PurpleTheme),
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
226 0, /* n_preallocs */
23466
5a02912e0bac more gobject fixed
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23465
diff changeset
227 purple_theme_init, /* instance_init */
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
228 NULL, /* value table */
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
229 };
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
230 type = g_type_register_static (G_TYPE_OBJECT,
23465
d60c3d1c6966 fixed some gobject stuff
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23461
diff changeset
231 "PurpleTheme",
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
232 &info, G_TYPE_FLAG_ABSTRACT);
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
233 }
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
234 return type;
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
235 }
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
236
23699
fc8047e1fa39 fixed some leaks and made theme loading safer
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23483
diff changeset
237 /******************************************************************************
fc8047e1fa39 fixed some leaks and made theme loading safer
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23483
diff changeset
238 * Helper Functions
fc8047e1fa39 fixed some leaks and made theme loading safer
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23483
diff changeset
239 *****************************************************************************/
fc8047e1fa39 fixed some leaks and made theme loading safer
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23483
diff changeset
240
fc8047e1fa39 fixed some leaks and made theme loading safer
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23483
diff changeset
241 static gchar*
fc8047e1fa39 fixed some leaks and made theme loading safer
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23483
diff changeset
242 theme_clean_text(const gchar *text)
fc8047e1fa39 fixed some leaks and made theme loading safer
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23483
diff changeset
243 {
fc8047e1fa39 fixed some leaks and made theme loading safer
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23483
diff changeset
244 gchar *clean_text = g_markup_escape_text(text, strlen(text));
fc8047e1fa39 fixed some leaks and made theme loading safer
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23483
diff changeset
245 g_strdelimit(clean_text, "\n", ' ');
fc8047e1fa39 fixed some leaks and made theme loading safer
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23483
diff changeset
246 purple_str_strip_char(clean_text, '\r');
fc8047e1fa39 fixed some leaks and made theme loading safer
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23483
diff changeset
247 return clean_text;
fc8047e1fa39 fixed some leaks and made theme loading safer
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23483
diff changeset
248 }
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
249
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
250 /*****************************************************************************
23699
fc8047e1fa39 fixed some leaks and made theme loading safer
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23483
diff changeset
251 * Public API functions
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
252 *****************************************************************************/
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
253
23472
fbf72bbd1084 Fixed up a few typos, readability, leaks, and bugs, all minor and mostly in theme and theme loader classes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23466
diff changeset
254 const gchar *
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
255 purple_theme_get_name(PurpleTheme *theme)
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
256 {
23457
8793058bc318 changed the purple theme formatting a bit (minor)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23456
diff changeset
257 PurpleThemePrivate *priv;
23451
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23450
diff changeset
258
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
259 g_return_val_if_fail(PURPLE_IS_THEME(theme), NULL);
23451
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23450
diff changeset
260
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
261 priv = PURPLE_THEME_GET_PRIVATE(theme);
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
262 return priv->name;
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
263 }
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
264
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
265 void
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
266 purple_theme_set_name(PurpleTheme *theme, const gchar *name)
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
267 {
23457
8793058bc318 changed the purple theme formatting a bit (minor)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23456
diff changeset
268 PurpleThemePrivate *priv;
23451
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23450
diff changeset
269
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
270 g_return_if_fail(PURPLE_IS_THEME(theme));
23451
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23450
diff changeset
271
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
272 priv = PURPLE_THEME_GET_PRIVATE(theme);
23451
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23450
diff changeset
273
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23450
diff changeset
274 g_free(priv->name);
23699
fc8047e1fa39 fixed some leaks and made theme loading safer
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23483
diff changeset
275 priv->name = theme_clean_text(name);
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
276 }
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
277
23472
fbf72bbd1084 Fixed up a few typos, readability, leaks, and bugs, all minor and mostly in theme and theme loader classes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23466
diff changeset
278 const gchar *
23456
8f397c8e728a Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23452
diff changeset
279 purple_theme_get_description(PurpleTheme *theme)
8f397c8e728a Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23452
diff changeset
280 {
23457
8793058bc318 changed the purple theme formatting a bit (minor)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23456
diff changeset
281 PurpleThemePrivate *priv;
23456
8f397c8e728a Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23452
diff changeset
282
8f397c8e728a Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23452
diff changeset
283 g_return_val_if_fail(PURPLE_IS_THEME(theme), NULL);
8f397c8e728a Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23452
diff changeset
284
8f397c8e728a Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23452
diff changeset
285 priv = PURPLE_THEME_GET_PRIVATE(theme);
8f397c8e728a Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23452
diff changeset
286 return priv->description;
8f397c8e728a Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23452
diff changeset
287 }
8f397c8e728a Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23452
diff changeset
288
8f397c8e728a Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23452
diff changeset
289 void
8f397c8e728a Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23452
diff changeset
290 purple_theme_set_description(PurpleTheme *theme, const gchar *description)
8f397c8e728a Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23452
diff changeset
291 {
23457
8793058bc318 changed the purple theme formatting a bit (minor)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23456
diff changeset
292 PurpleThemePrivate *priv;
23456
8f397c8e728a Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23452
diff changeset
293
8f397c8e728a Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23452
diff changeset
294 g_return_if_fail(PURPLE_IS_THEME(theme));
8f397c8e728a Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23452
diff changeset
295
8f397c8e728a Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23452
diff changeset
296 priv = PURPLE_THEME_GET_PRIVATE(theme);
8f397c8e728a Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23452
diff changeset
297
8f397c8e728a Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23452
diff changeset
298 g_free(priv->description);
23699
fc8047e1fa39 fixed some leaks and made theme loading safer
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23483
diff changeset
299 priv->description = theme_clean_text(description);
23456
8f397c8e728a Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23452
diff changeset
300 }
8f397c8e728a Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23452
diff changeset
301
23472
fbf72bbd1084 Fixed up a few typos, readability, leaks, and bugs, all minor and mostly in theme and theme loader classes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23466
diff changeset
302 const gchar *
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
303 purple_theme_get_author(PurpleTheme *theme)
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
304 {
23457
8793058bc318 changed the purple theme formatting a bit (minor)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23456
diff changeset
305 PurpleThemePrivate *priv;
23451
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23450
diff changeset
306
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
307 g_return_val_if_fail(PURPLE_IS_THEME(theme), NULL);
23451
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23450
diff changeset
308
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
309 priv = PURPLE_THEME_GET_PRIVATE(theme);
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
310 return priv->author;
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
311 }
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
312
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
313 void
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
314 purple_theme_set_author(PurpleTheme *theme, const gchar *author)
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
315 {
23457
8793058bc318 changed the purple theme formatting a bit (minor)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23456
diff changeset
316 PurpleThemePrivate *priv;
23451
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23450
diff changeset
317
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
318 g_return_if_fail(PURPLE_IS_THEME(theme));
23451
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23450
diff changeset
319
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
320 priv = PURPLE_THEME_GET_PRIVATE(theme);
23451
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23450
diff changeset
321
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23450
diff changeset
322 g_free(priv->author);
23699
fc8047e1fa39 fixed some leaks and made theme loading safer
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23483
diff changeset
323 priv->author = theme_clean_text(author);
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
324 }
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
325
23472
fbf72bbd1084 Fixed up a few typos, readability, leaks, and bugs, all minor and mostly in theme and theme loader classes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23466
diff changeset
326 const gchar *
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
327 purple_theme_get_type_string(PurpleTheme *theme)
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
328 {
23457
8793058bc318 changed the purple theme formatting a bit (minor)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23456
diff changeset
329 PurpleThemePrivate *priv;
23451
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23450
diff changeset
330
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
331 g_return_val_if_fail(PURPLE_IS_THEME(theme), NULL);
23451
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23450
diff changeset
332
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
333 priv = PURPLE_THEME_GET_PRIVATE(theme);
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
334 return priv->type;
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
335 }
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
336
23461
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23457
diff changeset
337 /* < private > */
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23457
diff changeset
338 void
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23457
diff changeset
339 purple_theme_set_type_string(PurpleTheme *theme, const gchar *type)
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23457
diff changeset
340 {
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23457
diff changeset
341 PurpleThemePrivate *priv;
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23457
diff changeset
342
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23457
diff changeset
343 g_return_if_fail(PURPLE_IS_THEME(theme));
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23457
diff changeset
344
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23457
diff changeset
345 priv = PURPLE_THEME_GET_PRIVATE(theme);
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23457
diff changeset
346
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23457
diff changeset
347 g_free(priv->type);
23472
fbf72bbd1084 Fixed up a few typos, readability, leaks, and bugs, all minor and mostly in theme and theme loader classes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23466
diff changeset
348 priv->type = g_strdup(type);
23461
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23457
diff changeset
349 }
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23457
diff changeset
350
23472
fbf72bbd1084 Fixed up a few typos, readability, leaks, and bugs, all minor and mostly in theme and theme loader classes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23466
diff changeset
351 const gchar *
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
352 purple_theme_get_dir(PurpleTheme *theme)
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
353 {
23457
8793058bc318 changed the purple theme formatting a bit (minor)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23456
diff changeset
354 PurpleThemePrivate *priv;
23451
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23450
diff changeset
355
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
356 g_return_val_if_fail(PURPLE_IS_THEME(theme), NULL);
23451
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23450
diff changeset
357
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
358 priv = PURPLE_THEME_GET_PRIVATE(theme);
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
359 return priv->dir;
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
360 }
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
361
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
362 void
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
363 purple_theme_set_dir(PurpleTheme *theme, const gchar *dir)
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
364 {
23457
8793058bc318 changed the purple theme formatting a bit (minor)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23456
diff changeset
365 PurpleThemePrivate *priv;
23451
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23450
diff changeset
366
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
367 g_return_if_fail(PURPLE_IS_THEME(theme));
23451
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23450
diff changeset
368
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
369 priv = PURPLE_THEME_GET_PRIVATE(theme);
23451
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23450
diff changeset
370
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23450
diff changeset
371 g_free(priv->dir);
23472
fbf72bbd1084 Fixed up a few typos, readability, leaks, and bugs, all minor and mostly in theme and theme loader classes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23466
diff changeset
372 priv->dir = g_strdup(dir);
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
373 }
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
374
23472
fbf72bbd1084 Fixed up a few typos, readability, leaks, and bugs, all minor and mostly in theme and theme loader classes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23466
diff changeset
375 const gchar *
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
376 purple_theme_get_image(PurpleTheme *theme)
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
377 {
23457
8793058bc318 changed the purple theme formatting a bit (minor)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23456
diff changeset
378 PurpleThemePrivate *priv;
23451
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23450
diff changeset
379
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
380 g_return_val_if_fail(PURPLE_IS_THEME(theme), NULL);
23451
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23450
diff changeset
381
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
382 priv = PURPLE_THEME_GET_PRIVATE(theme);
23451
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23450
diff changeset
383
23472
fbf72bbd1084 Fixed up a few typos, readability, leaks, and bugs, all minor and mostly in theme and theme loader classes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23466
diff changeset
384 return priv->img;
fbf72bbd1084 Fixed up a few typos, readability, leaks, and bugs, all minor and mostly in theme and theme loader classes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23466
diff changeset
385 }
fbf72bbd1084 Fixed up a few typos, readability, leaks, and bugs, all minor and mostly in theme and theme loader classes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23466
diff changeset
386
fbf72bbd1084 Fixed up a few typos, readability, leaks, and bugs, all minor and mostly in theme and theme loader classes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23466
diff changeset
387 gchar *
fbf72bbd1084 Fixed up a few typos, readability, leaks, and bugs, all minor and mostly in theme and theme loader classes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23466
diff changeset
388 purple_theme_get_image_full(PurpleTheme *theme)
fbf72bbd1084 Fixed up a few typos, readability, leaks, and bugs, all minor and mostly in theme and theme loader classes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23466
diff changeset
389 {
fbf72bbd1084 Fixed up a few typos, readability, leaks, and bugs, all minor and mostly in theme and theme loader classes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23466
diff changeset
390 const gchar *filename = purple_theme_get_image(theme);
fbf72bbd1084 Fixed up a few typos, readability, leaks, and bugs, all minor and mostly in theme and theme loader classes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23466
diff changeset
391
fbf72bbd1084 Fixed up a few typos, readability, leaks, and bugs, all minor and mostly in theme and theme loader classes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23466
diff changeset
392 g_return_val_if_fail(filename, NULL);
fbf72bbd1084 Fixed up a few typos, readability, leaks, and bugs, all minor and mostly in theme and theme loader classes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23466
diff changeset
393
fbf72bbd1084 Fixed up a few typos, readability, leaks, and bugs, all minor and mostly in theme and theme loader classes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23466
diff changeset
394 return g_build_filename(purple_theme_get_dir(PURPLE_THEME(theme)), filename, NULL);
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
395 }
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
396
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
397 void
23472
fbf72bbd1084 Fixed up a few typos, readability, leaks, and bugs, all minor and mostly in theme and theme loader classes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23466
diff changeset
398 purple_theme_set_image(PurpleTheme *theme, const gchar *img)
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
399 {
23457
8793058bc318 changed the purple theme formatting a bit (minor)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23456
diff changeset
400 PurpleThemePrivate *priv;
23451
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23450
diff changeset
401
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
402 g_return_if_fail(PURPLE_IS_THEME(theme));
23451
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23450
diff changeset
403
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
404 priv = PURPLE_THEME_GET_PRIVATE(theme);
23451
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23450
diff changeset
405
23472
fbf72bbd1084 Fixed up a few typos, readability, leaks, and bugs, all minor and mostly in theme and theme loader classes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23466
diff changeset
406 g_free(priv->img);
fbf72bbd1084 Fixed up a few typos, readability, leaks, and bugs, all minor and mostly in theme and theme loader classes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23466
diff changeset
407 priv->img = g_strdup(img);
23450
de8f7e6a707a Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
408 }