comparison libpurple/theme-loader.c @ 25911:0c7b74fc558e

Lots of minor whitespace and comment changes: * Removed stray whitespace * Changed a few places that used space indentation to use tabs * Changed some places that used tabs for alignment in the middle of a line of code to use spaces * Use two tabs to indent code that spans more than one line instead of a few tabs and a few spaces in an effort to align the subsequent lines with the initial one * Changed "#ifdef _BLAH_H" to "#ifdef BLAH_H" because an underscore followed by a capital letter is reserved for use by the compiler and system libraries. I also changed the path to the sound theme.xml file from root_node = xmlnode_from_file(dir, "theme.xml", "sound themes", "sound-loader"); to root_node = xmlnode_from_file(dir, "theme.xml", "sound themes", "sound-theme-loader");
author Mark Doliner <mark@kingant.net>
date Sun, 25 Jan 2009 22:55:23 +0000
parents 1eacf60a73dd
children a444fe876e52
comparison
equal deleted inserted replaced
25910:3d8c53f3108e 25911:0c7b74fc558e
1 /* 1 /*
2 * ThemeLoaders for LibPurple 2 * ThemeLoaders for libpurple
3 * 3 *
4 * Pidgin is the legal property of its developers, whose names are too numerous 4 * Pidgin is the legal property of its developers, whose names are too numerous
5 * to list here. Please refer to the COPYRIGHT file distributed with this 5 * to list here. Please refer to the COPYRIGHT file distributed with this
6 * source distribution. 6 * source distribution.
7 * 7 *
16 * GNU General Public License for more details. 16 * GNU General Public License for more details.
17 * 17 *
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 *
22 */ 21 */
22
23 #include "internal.h" 23 #include "internal.h"
24 #include "theme-loader.h" 24 #include "theme-loader.h"
25 25
26 #define PURPLE_THEME_LOADER_GET_PRIVATE(PurpleThemeLoader) \ 26 #define PURPLE_THEME_LOADER_GET_PRIVATE(PurpleThemeLoader) \
27 ((PurpleThemeLoaderPrivate *) ((PurpleThemeLoader)->priv)) 27 ((PurpleThemeLoaderPrivate *) ((PurpleThemeLoader)->priv))
28 28
29 void purple_theme_loader_set_type_string(PurpleThemeLoader *loader, const gchar *type); 29 void purple_theme_loader_set_type_string(PurpleThemeLoader *loader, const gchar *type);
30
30 /****************************************************************************** 31 /******************************************************************************
31 * Structs 32 * Structs
32 *****************************************************************************/ 33 *****************************************************************************/
33 typedef struct { 34 typedef struct {
34 gchar *type; 35 gchar *type;
57 purple_theme_loader_get_property(GObject *obj, guint param_id, GValue *value, 58 purple_theme_loader_get_property(GObject *obj, guint param_id, GValue *value,
58 GParamSpec *psec) 59 GParamSpec *psec)
59 { 60 {
60 PurpleThemeLoader *theme_loader = PURPLE_THEME_LOADER(obj); 61 PurpleThemeLoader *theme_loader = PURPLE_THEME_LOADER(obj);
61 62
62 switch(param_id) { 63 switch (param_id) {
63 case PROP_TYPE: 64 case PROP_TYPE:
64 g_value_set_string(value, purple_theme_loader_get_type_string(theme_loader)); 65 g_value_set_string(value, purple_theme_loader_get_type_string(theme_loader));
65 default: 66 default:
66 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, psec); 67 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, psec);
67 break; 68 break;
72 purple_theme_loader_set_property(GObject *obj, guint param_id, const GValue *value, 73 purple_theme_loader_set_property(GObject *obj, guint param_id, const GValue *value,
73 GParamSpec *psec) 74 GParamSpec *psec)
74 { 75 {
75 PurpleThemeLoader *loader = PURPLE_THEME_LOADER(obj); 76 PurpleThemeLoader *loader = PURPLE_THEME_LOADER(obj);
76 77
77 switch(param_id) { 78 switch (param_id) {
78 case PROP_TYPE: 79 case PROP_TYPE:
79 purple_theme_loader_set_type_string(loader, g_value_get_string(value)); 80 purple_theme_loader_set_type_string(loader, g_value_get_string(value));
80 break; 81 break;
81 default: 82 default:
82 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, psec); 83 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, psec);
93 } 94 }
94 95
95 static void 96 static void
96 purple_theme_loader_finalize(GObject *obj) 97 purple_theme_loader_finalize(GObject *obj)
97 { 98 {
98 PurpleThemeLoader *loader = PURPLE_THEME_LOADER(obj); 99 PurpleThemeLoader *loader = PURPLE_THEME_LOADER(obj);
99 PurpleThemeLoaderPrivate *priv = PURPLE_THEME_LOADER_GET_PRIVATE(loader); 100 PurpleThemeLoaderPrivate *priv = PURPLE_THEME_LOADER_GET_PRIVATE(loader);
100 101
101 g_free(priv->type); 102 g_free(priv->type);
102 103
103 parent_class->finalize (obj); 104 parent_class->finalize(obj);
104 } 105 }
105 106
106 static void 107 static void
107 purple_theme_loader_class_init (PurpleThemeLoaderClass *klass) 108 purple_theme_loader_class_init(PurpleThemeLoaderClass *klass)
108 { 109 {
109 GObjectClass *obj_class = G_OBJECT_CLASS(klass); 110 GObjectClass *obj_class = G_OBJECT_CLASS(klass);
110 GParamSpec *pspec; 111 GParamSpec *pspec;
111 112
112 parent_class = g_type_class_peek_parent (klass); 113 parent_class = g_type_class_peek_parent(klass);
113 114
114 obj_class->get_property = purple_theme_loader_get_property; 115 obj_class->get_property = purple_theme_loader_get_property;
115 obj_class->set_property = purple_theme_loader_set_property; 116 obj_class->set_property = purple_theme_loader_set_property;
116 obj_class->finalize = purple_theme_loader_finalize; 117 obj_class->finalize = purple_theme_loader_finalize;
117 118
121 NULL, 122 NULL,
122 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY); 123 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
123 g_object_class_install_property(obj_class, PROP_TYPE, pspec); 124 g_object_class_install_property(obj_class, PROP_TYPE, pspec);
124 } 125 }
125 126
126 127 GType
127 GType 128 purple_theme_loader_get_type(void)
128 purple_theme_loader_get_type (void)
129 { 129 {
130 static GType type = 0; 130 static GType type = 0;
131 if (type == 0) { 131 if (type == 0) {
132 static const GTypeInfo info = { 132 static const GTypeInfo info = {
133 sizeof (PurpleThemeLoaderClass), 133 sizeof(PurpleThemeLoaderClass),
134 NULL, /* base_init */ 134 NULL, /* base_init */
135 NULL, /* base_finalize */ 135 NULL, /* base_finalize */
136 (GClassInitFunc)purple_theme_loader_class_init, /* class_init */ 136 (GClassInitFunc)purple_theme_loader_class_init, /* class_init */
137 NULL, /* class_finalize */ 137 NULL, /* class_finalize */
138 NULL, /* class_data */ 138 NULL, /* class_data */
139 sizeof (PurpleThemeLoader), 139 sizeof(PurpleThemeLoader),
140 0, /* n_preallocs */ 140 0, /* n_preallocs */
141 purple_theme_loader_init, /* instance_init */ 141 purple_theme_loader_init, /* instance_init */
142 NULL, /* value table */ 142 NULL, /* value table */
143 }; 143 };
144 type = g_type_register_static (G_TYPE_OBJECT, 144 type = g_type_register_static(G_TYPE_OBJECT,
145 "PurpleThemeLoader", 145 "PurpleThemeLoader", &info, G_TYPE_FLAG_ABSTRACT);
146 &info, G_TYPE_FLAG_ABSTRACT); 146 }
147 } 147 return type;
148 return type;
149 } 148 }
150 149
151
152 /***************************************************************************** 150 /*****************************************************************************
153 * Public API functions 151 * Public API functions
154 *****************************************************************************/ 152 *****************************************************************************/
155 153
156
157 const gchar * 154 const gchar *
158 purple_theme_loader_get_type_string (PurpleThemeLoader *theme_loader) 155 purple_theme_loader_get_type_string(PurpleThemeLoader *theme_loader)
159 { 156 {
160 PurpleThemeLoaderPrivate *priv = NULL; 157 PurpleThemeLoaderPrivate *priv = NULL;
161 158
162 g_return_val_if_fail(PURPLE_IS_THEME_LOADER(theme_loader), NULL); 159 g_return_val_if_fail(PURPLE_IS_THEME_LOADER(theme_loader), NULL);
163 160