Mercurial > pidgin
comparison libpurple/theme.c @ 25080:8f397c8e728a
Added description to theme abstract class
author | Justin Rodriguez <ffdragon@soc.pidgin.im> |
---|---|
date | Wed, 11 Jun 2008 18:32:12 +0000 |
parents | 68b7691aa3ed |
children | 8793058bc318 |
comparison
equal
deleted
inserted
replaced
25079:d5c5512adc69 | 25080:8f397c8e728a |
---|---|
30 /****************************************************************************** | 30 /****************************************************************************** |
31 * Structs | 31 * Structs |
32 *****************************************************************************/ | 32 *****************************************************************************/ |
33 typedef struct { | 33 typedef struct { |
34 gchar *name; | 34 gchar *name; |
35 gchar *description; | |
35 gchar *author; | 36 gchar *author; |
36 gchar *type; | 37 gchar *type; |
37 gchar *dir; | 38 gchar *dir; |
38 PurpleStoredImage *img; | 39 PurpleStoredImage *img; |
39 } PurpleThemePrivate; | 40 } PurpleThemePrivate; |
44 | 45 |
45 /****************************************************************************** | 46 /****************************************************************************** |
46 * Enums | 47 * Enums |
47 *****************************************************************************/ | 48 *****************************************************************************/ |
48 #define PROP_NAME_S "name" | 49 #define PROP_NAME_S "name" |
50 #define PROP_DESCRIPION_S "description" | |
49 #define PROP_AUTHOR_S "author" | 51 #define PROP_AUTHOR_S "author" |
50 #define PROP_TYPE_S "type" | 52 #define PROP_TYPE_S "type" |
51 #define PROP_DIR_S "dir" | 53 #define PROP_DIR_S "dir" |
52 #define PROP_IMAGE_S "image" | 54 #define PROP_IMAGE_S "image" |
53 | 55 |
54 enum { | 56 enum { |
55 PROP_ZERO = 0, | 57 PROP_ZERO = 0, |
56 PROP_NAME, | 58 PROP_NAME, |
59 PROP_DESCRIPION, | |
57 PROP_AUTHOR, | 60 PROP_AUTHOR, |
58 PROP_TYPE, | 61 PROP_TYPE, |
59 PROP_DIR, | 62 PROP_DIR, |
60 PROP_IMAGE | 63 PROP_IMAGE |
61 }; | 64 }; |
73 | 76 |
74 switch(param_id) { | 77 switch(param_id) { |
75 case PROP_NAME: | 78 case PROP_NAME: |
76 g_value_set_string(value, purple_theme_get_name(theme)); | 79 g_value_set_string(value, purple_theme_get_name(theme)); |
77 break; | 80 break; |
81 case PROP_DESCRIPION: | |
82 g_value_set_string(value, purple_theme_get_description(theme)); | |
83 break; | |
78 case PROP_AUTHOR: | 84 case PROP_AUTHOR: |
79 g_value_set_string(value, purple_theme_get_author(theme)); | 85 g_value_set_string(value, purple_theme_get_author(theme)); |
80 break; | 86 break; |
81 case PROP_TYPE: | 87 case PROP_TYPE: |
82 g_value_set_string(value, purple_theme_get_type_string(theme)); | 88 g_value_set_string(value, purple_theme_get_type_string(theme)); |
100 PurpleTheme *theme = PURPLE_THEME(obj); | 106 PurpleTheme *theme = PURPLE_THEME(obj); |
101 | 107 |
102 switch(param_id) { | 108 switch(param_id) { |
103 case PROP_NAME: | 109 case PROP_NAME: |
104 purple_theme_set_name(theme, g_value_get_string(value)); | 110 purple_theme_set_name(theme, g_value_get_string(value)); |
111 break; | |
112 case PROP_DESCRIPION: | |
113 purple_theme_set_description(theme, g_value_get_string(value)); | |
105 break; | 114 break; |
106 case PROP_AUTHOR: | 115 case PROP_AUTHOR: |
107 purple_theme_set_author(theme, g_value_get_string(value)); | 116 purple_theme_set_author(theme, g_value_get_string(value)); |
108 break; | 117 break; |
109 case PROP_DIR: | 118 case PROP_DIR: |
134 pspec = g_param_spec_string(PROP_NAME_S, "Name", | 143 pspec = g_param_spec_string(PROP_NAME_S, "Name", |
135 "The name of the theme", | 144 "The name of the theme", |
136 NULL, | 145 NULL, |
137 G_PARAM_READWRITE | G_PARAM_CONSTRUCT); | 146 G_PARAM_READWRITE | G_PARAM_CONSTRUCT); |
138 g_object_class_install_property(obj_class, PROP_NAME, pspec); | 147 g_object_class_install_property(obj_class, PROP_NAME, pspec); |
148 /* DESCRIPION */ | |
149 pspec = g_param_spec_string(PROP_DESCRIPION_S, "Description", | |
150 "The description of the theme", | |
151 NULL, | |
152 G_PARAM_READWRITE | G_PARAM_CONSTRUCT); | |
153 g_object_class_install_property(obj_class, PROP_DESCRIPION, pspec); | |
139 /* AUTHOR */ | 154 /* AUTHOR */ |
140 pspec = g_param_spec_string(PROP_AUTHOR_S, "Author", | 155 pspec = g_param_spec_string(PROP_AUTHOR_S, "Author", |
141 "The author of the theme", | 156 "The author of the theme", |
142 NULL, | 157 NULL, |
143 G_PARAM_READWRITE | G_PARAM_CONSTRUCT); | 158 G_PARAM_READWRITE | G_PARAM_CONSTRUCT); |
214 g_free(priv->name); | 229 g_free(priv->name); |
215 priv->name = g_strdup (name); | 230 priv->name = g_strdup (name); |
216 } | 231 } |
217 | 232 |
218 gchar * | 233 gchar * |
234 purple_theme_get_description(PurpleTheme *theme) | |
235 { | |
236 PurpleThemePrivate *priv = NULL; | |
237 | |
238 g_return_val_if_fail(PURPLE_IS_THEME(theme), NULL); | |
239 | |
240 priv = PURPLE_THEME_GET_PRIVATE(theme); | |
241 return priv->description; | |
242 } | |
243 | |
244 void | |
245 purple_theme_set_description(PurpleTheme *theme, const gchar *description) | |
246 { | |
247 PurpleThemePrivate *priv = NULL; | |
248 | |
249 g_return_if_fail(PURPLE_IS_THEME(theme)); | |
250 | |
251 priv = PURPLE_THEME_GET_PRIVATE(theme); | |
252 | |
253 g_free(priv->description); | |
254 priv->description = g_strdup (description); | |
255 } | |
256 | |
257 gchar * | |
219 purple_theme_get_author(PurpleTheme *theme) | 258 purple_theme_get_author(PurpleTheme *theme) |
220 { | 259 { |
221 PurpleThemePrivate *priv = NULL; | 260 PurpleThemePrivate *priv = NULL; |
222 | 261 |
223 g_return_val_if_fail(PURPLE_IS_THEME(theme), NULL); | 262 g_return_val_if_fail(PURPLE_IS_THEME(theme), NULL); |