annotate libpurple/theme.c @ 32813:b31f7945d9b6

Use 'div's for indent which allows WebKit to do better word-wrapping.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Thu, 31 May 2012 06:09:59 +0000
parents 4d92a431d0a1
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
25074
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 /*
25911
0c7b74fc558e Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents: 25858
diff changeset
2 * Themes for libpurple
25074
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 */
25911
0c7b74fc558e Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents: 25858
diff changeset
22
25858
1eacf60a73dd Fix some theme manager assertion failures.
Richard Laager <rlaager@wiktel.com>
parents: 25119
diff changeset
23 #include "internal.h"
25074
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
24 #include "theme.h"
25119
fc8047e1fa39 fixed some leaks and made theme loading safer
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25107
diff changeset
25 #include "util.h"
fc8047e1fa39 fixed some leaks and made theme loading safer
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25107
diff changeset
26
25074
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 #define PURPLE_THEME_GET_PRIVATE(PurpleTheme) \
32157
4d92a431d0a1 Use GObject's instance private data for all the theme GObjects.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28647
diff changeset
28 (G_TYPE_INSTANCE_GET_PRIVATE((PurpleTheme), PURPLE_TYPE_THEME, PurpleThemePrivate))
25074
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
29
25085
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25081
diff changeset
30 void purple_theme_set_type_string(PurpleTheme *theme, const gchar *type);
25074
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
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 /******************************************************************************
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
33 * 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
34 *****************************************************************************/
25911
0c7b74fc558e Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents: 25858
diff changeset
35
25074
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 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
37 gchar *name;
25080
8f397c8e728a Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25076
diff changeset
38 gchar *description;
25074
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 *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
40 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
41 gchar *dir;
25096
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: 25090
diff changeset
42 gchar *img;
25074
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 } 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
44
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 /******************************************************************************
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 * 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
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
25085
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25081
diff changeset
49 static GObjectClass *parent_class = NULL;
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25081
diff changeset
50
25074
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
51 /******************************************************************************
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
52 * 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
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
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 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
56 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
57 PROP_NAME,
25107
748308865dbf Changed how the prefs handle themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25096
diff changeset
58 PROP_DESCRIPTION,
25074
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_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
60 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
61 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
62 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
63 };
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
25076
68b7691aa3ed Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25075
diff changeset
65 /******************************************************************************
25911
0c7b74fc558e Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents: 25858
diff changeset
66 * GObject Stuff
25076
68b7691aa3ed Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25075
diff changeset
67 *****************************************************************************/
25074
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
68
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
69 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
70 purple_theme_get_property(GObject *obj, guint param_id, GValue *value,
25911
0c7b74fc558e Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents: 25858
diff changeset
71 GParamSpec *psec)
25074
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 {
25075
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25074
diff changeset
73 PurpleTheme *theme = PURPLE_THEME(obj);
25074
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
25911
0c7b74fc558e Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents: 25858
diff changeset
75 switch (param_id) {
25074
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 case PROP_NAME:
25075
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25074
diff changeset
77 g_value_set_string(value, purple_theme_get_name(theme));
25074
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 break;
25107
748308865dbf Changed how the prefs handle themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25096
diff changeset
79 case PROP_DESCRIPTION:
25080
8f397c8e728a Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25076
diff changeset
80 g_value_set_string(value, purple_theme_get_description(theme));
8f397c8e728a Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25076
diff changeset
81 break;
25074
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
82 case PROP_AUTHOR:
25075
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25074
diff changeset
83 g_value_set_string(value, purple_theme_get_author(theme));
25074
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 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
85 case PROP_TYPE:
25075
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25074
diff changeset
86 g_value_set_string(value, purple_theme_get_type_string(theme));
25074
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 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
88 case PROP_DIR:
25075
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25074
diff changeset
89 g_value_set_string(value, purple_theme_get_dir(theme));
25074
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 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
91 case PROP_IMAGE:
25096
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: 25090
diff changeset
92 g_value_set_string(value, purple_theme_get_image(theme));
25074
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 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
94 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
95 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
96 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
97 }
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 }
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 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
101 purple_theme_set_property(GObject *obj, guint param_id, const GValue *value,
25911
0c7b74fc558e Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents: 25858
diff changeset
102 GParamSpec *psec)
25074
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 {
25075
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25074
diff changeset
104 PurpleTheme *theme = PURPLE_THEME(obj);
25074
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
25911
0c7b74fc558e Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents: 25858
diff changeset
106 switch (param_id) {
25074
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 case PROP_NAME:
25075
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25074
diff changeset
108 purple_theme_set_name(theme, g_value_get_string(value));
25074
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 break;
25107
748308865dbf Changed how the prefs handle themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25096
diff changeset
110 case PROP_DESCRIPTION:
25080
8f397c8e728a Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25076
diff changeset
111 purple_theme_set_description(theme, g_value_get_string(value));
8f397c8e728a Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25076
diff changeset
112 break;
25074
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
113 case PROP_AUTHOR:
25075
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25074
diff changeset
114 purple_theme_set_author(theme, g_value_get_string(value));
25074
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 break;
25085
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25081
diff changeset
116 case PROP_TYPE:
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25081
diff changeset
117 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: 25081
diff changeset
118 break;
25074
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
119 case PROP_DIR:
25075
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25074
diff changeset
120 purple_theme_set_dir(theme, g_value_get_string(value));
25074
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 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
122 case PROP_IMAGE:
25096
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: 25090
diff changeset
123 purple_theme_set_image(theme, g_value_get_string(value));
25074
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 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
125 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
126 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
127 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
128 }
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 }
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 static void
25085
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25081
diff changeset
132 purple_theme_finalize(GObject *obj)
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25081
diff changeset
133 {
25911
0c7b74fc558e Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents: 25858
diff changeset
134 PurpleTheme *theme = PURPLE_THEME(obj);
25085
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25081
diff changeset
135 PurpleThemePrivate *priv = PURPLE_THEME_GET_PRIVATE(theme);
25911
0c7b74fc558e Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents: 25858
diff changeset
136
25085
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25081
diff changeset
137 g_free(priv->name);
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25081
diff changeset
138 g_free(priv->description);
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25081
diff changeset
139 g_free(priv->author);
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25081
diff changeset
140 g_free(priv->type);
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25081
diff changeset
141 g_free(priv->dir);
25096
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: 25090
diff changeset
142 g_free(priv->img);
25085
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25081
diff changeset
143
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25081
diff changeset
144 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: 25081
diff changeset
145 }
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25081
diff changeset
146
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25081
diff changeset
147 static void
25911
0c7b74fc558e Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents: 25858
diff changeset
148 purple_theme_class_init(PurpleThemeClass *klass)
25074
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
149 {
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
150 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
151 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
152
25085
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25081
diff changeset
153 parent_class = g_type_class_peek_parent(klass);
25074
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
154
32157
4d92a431d0a1 Use GObject's instance private data for all the theme GObjects.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28647
diff changeset
155 g_type_class_add_private(klass, sizeof(PurpleThemePrivate));
4d92a431d0a1 Use GObject's instance private data for all the theme GObjects.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28647
diff changeset
156
25074
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
157 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
158 obj_class->set_property = purple_theme_set_property;
25085
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25081
diff changeset
159 obj_class->finalize = purple_theme_finalize;
25911
0c7b74fc558e Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents: 25858
diff changeset
160
25074
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 /* NAME */
25090
5a02912e0bac more gobject fixed
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25089
diff changeset
162 pspec = g_param_spec_string("name", "Name",
25911
0c7b74fc558e Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents: 25858
diff changeset
163 "The name of the theme",
0c7b74fc558e Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents: 25858
diff changeset
164 NULL,
0c7b74fc558e Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents: 25858
diff changeset
165 G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
25074
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 g_object_class_install_property(obj_class, PROP_NAME, pspec);
25107
748308865dbf Changed how the prefs handle themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25096
diff changeset
167
748308865dbf Changed how the prefs handle themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25096
diff changeset
168 /* DESCRIPTION */
25090
5a02912e0bac more gobject fixed
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25089
diff changeset
169 pspec = g_param_spec_string("description", "Description",
25911
0c7b74fc558e Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents: 25858
diff changeset
170 "The description of the theme",
0c7b74fc558e Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents: 25858
diff changeset
171 NULL,
0c7b74fc558e Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents: 25858
diff changeset
172 G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
25107
748308865dbf Changed how the prefs handle themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25096
diff changeset
173 g_object_class_install_property(obj_class, PROP_DESCRIPTION, pspec);
748308865dbf Changed how the prefs handle themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25096
diff changeset
174
25074
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
175 /* AUTHOR */
25090
5a02912e0bac more gobject fixed
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25089
diff changeset
176 pspec = g_param_spec_string("author", "Author",
25911
0c7b74fc558e Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents: 25858
diff changeset
177 "The author of the theme",
0c7b74fc558e Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents: 25858
diff changeset
178 NULL,
0c7b74fc558e Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents: 25858
diff changeset
179 G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
25074
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
180 g_object_class_install_property(obj_class, PROP_AUTHOR, pspec);
25107
748308865dbf Changed how the prefs handle themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25096
diff changeset
181
25074
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
182 /* TYPE STRING (read only) */
25090
5a02912e0bac more gobject fixed
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25089
diff changeset
183 pspec = g_param_spec_string("type", "Type",
28163
a444fe876e52 Fix some typos.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27047
diff changeset
184 "The string representing the type of the theme",
25911
0c7b74fc558e Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents: 25858
diff changeset
185 NULL,
0c7b74fc558e Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents: 25858
diff changeset
186 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
25074
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_object_class_install_property(obj_class, PROP_TYPE, pspec);
25107
748308865dbf Changed how the prefs handle themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25096
diff changeset
188
25074
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
189 /* DIRECTORY */
25090
5a02912e0bac more gobject fixed
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25089
diff changeset
190 pspec = g_param_spec_string("directory", "Directory",
25911
0c7b74fc558e Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents: 25858
diff changeset
191 "The directory that contains the theme and all its files",
0c7b74fc558e Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents: 25858
diff changeset
192 NULL,
0c7b74fc558e Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents: 25858
diff changeset
193 G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
25074
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
194 g_object_class_install_property(obj_class, PROP_DIR, pspec);
25107
748308865dbf Changed how the prefs handle themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25096
diff changeset
195
25074
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
196 /* PREVIEW IMAGE */
25096
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: 25090
diff changeset
197 pspec = g_param_spec_string("image", "Image",
25911
0c7b74fc558e Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents: 25858
diff changeset
198 "A preview image of the theme",
0c7b74fc558e Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents: 25858
diff changeset
199 NULL,
0c7b74fc558e Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents: 25858
diff changeset
200 G_PARAM_READWRITE);
25074
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_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
202 }
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
203
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
25911
0c7b74fc558e Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents: 25858
diff changeset
205 GType
0c7b74fc558e Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents: 25858
diff changeset
206 purple_theme_get_type(void)
25074
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
207 {
25911
0c7b74fc558e Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents: 25858
diff changeset
208 static GType type = 0;
0c7b74fc558e Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents: 25858
diff changeset
209 if (type == 0) {
0c7b74fc558e Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents: 25858
diff changeset
210 static const GTypeInfo info = {
0c7b74fc558e Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents: 25858
diff changeset
211 sizeof(PurpleThemeClass),
0c7b74fc558e Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents: 25858
diff changeset
212 NULL, /* base_init */
0c7b74fc558e Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents: 25858
diff changeset
213 NULL, /* base_finalize */
0c7b74fc558e Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents: 25858
diff changeset
214 (GClassInitFunc)purple_theme_class_init, /* class_init */
0c7b74fc558e Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents: 25858
diff changeset
215 NULL, /* class_finalize */
0c7b74fc558e Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents: 25858
diff changeset
216 NULL, /* class_data */
0c7b74fc558e Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents: 25858
diff changeset
217 sizeof(PurpleTheme),
0c7b74fc558e Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents: 25858
diff changeset
218 0, /* n_preallocs */
32157
4d92a431d0a1 Use GObject's instance private data for all the theme GObjects.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28647
diff changeset
219 NULL, /* instance_init */
25911
0c7b74fc558e Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents: 25858
diff changeset
220 NULL, /* value table */
0c7b74fc558e Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents: 25858
diff changeset
221 };
0c7b74fc558e Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents: 25858
diff changeset
222 type = g_type_register_static (G_TYPE_OBJECT,
0c7b74fc558e Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents: 25858
diff changeset
223 "PurpleTheme", &info, G_TYPE_FLAG_ABSTRACT);
0c7b74fc558e Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents: 25858
diff changeset
224 }
0c7b74fc558e Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents: 25858
diff changeset
225 return type;
25074
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 }
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
227
25119
fc8047e1fa39 fixed some leaks and made theme loading safer
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25107
diff changeset
228 /******************************************************************************
fc8047e1fa39 fixed some leaks and made theme loading safer
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25107
diff changeset
229 * Helper Functions
fc8047e1fa39 fixed some leaks and made theme loading safer
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25107
diff changeset
230 *****************************************************************************/
fc8047e1fa39 fixed some leaks and made theme loading safer
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25107
diff changeset
231
25911
0c7b74fc558e Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents: 25858
diff changeset
232 static gchar *
25119
fc8047e1fa39 fixed some leaks and made theme loading safer
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25107
diff changeset
233 theme_clean_text(const gchar *text)
fc8047e1fa39 fixed some leaks and made theme loading safer
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25107
diff changeset
234 {
27047
f70e86aec7d0 Reduce the number of g_return_val_if_fail calls for NULL input since that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25911
diff changeset
235 gchar *clean_text = NULL;
f70e86aec7d0 Reduce the number of g_return_val_if_fail calls for NULL input since that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25911
diff changeset
236 if (text != NULL) {
f70e86aec7d0 Reduce the number of g_return_val_if_fail calls for NULL input since that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25911
diff changeset
237 clean_text = g_markup_escape_text(text, -1);
f70e86aec7d0 Reduce the number of g_return_val_if_fail calls for NULL input since that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25911
diff changeset
238 g_strdelimit(clean_text, "\n", ' ');
f70e86aec7d0 Reduce the number of g_return_val_if_fail calls for NULL input since that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25911
diff changeset
239 purple_str_strip_char(clean_text, '\r');
f70e86aec7d0 Reduce the number of g_return_val_if_fail calls for NULL input since that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25911
diff changeset
240 }
25119
fc8047e1fa39 fixed some leaks and made theme loading safer
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25107
diff changeset
241 return clean_text;
fc8047e1fa39 fixed some leaks and made theme loading safer
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25107
diff changeset
242 }
25074
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
243
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
244 /*****************************************************************************
25911
0c7b74fc558e Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents: 25858
diff changeset
245 * Public API function
25074
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
246 *****************************************************************************/
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
247
25096
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: 25090
diff changeset
248 const gchar *
25074
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 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
250 {
25081
8793058bc318 changed the purple theme formatting a bit (minor)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25080
diff changeset
251 PurpleThemePrivate *priv;
25075
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25074
diff changeset
252
25074
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 g_return_val_if_fail(PURPLE_IS_THEME(theme), NULL);
25075
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25074
diff changeset
254
25074
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 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
256 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
257 }
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
258
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 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
260 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
261 {
25081
8793058bc318 changed the purple theme formatting a bit (minor)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25080
diff changeset
262 PurpleThemePrivate *priv;
25075
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25074
diff changeset
263
25074
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 g_return_if_fail(PURPLE_IS_THEME(theme));
25075
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25074
diff changeset
265
25074
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 priv = PURPLE_THEME_GET_PRIVATE(theme);
25075
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25074
diff changeset
267
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25074
diff changeset
268 g_free(priv->name);
25119
fc8047e1fa39 fixed some leaks and made theme loading safer
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25107
diff changeset
269 priv->name = theme_clean_text(name);
25074
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 }
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
271
25096
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: 25090
diff changeset
272 const gchar *
25080
8f397c8e728a Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25076
diff changeset
273 purple_theme_get_description(PurpleTheme *theme)
8f397c8e728a Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25076
diff changeset
274 {
25081
8793058bc318 changed the purple theme formatting a bit (minor)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25080
diff changeset
275 PurpleThemePrivate *priv;
25080
8f397c8e728a Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25076
diff changeset
276
8f397c8e728a Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25076
diff changeset
277 g_return_val_if_fail(PURPLE_IS_THEME(theme), NULL);
8f397c8e728a Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25076
diff changeset
278
8f397c8e728a Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25076
diff changeset
279 priv = PURPLE_THEME_GET_PRIVATE(theme);
8f397c8e728a Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25076
diff changeset
280 return priv->description;
8f397c8e728a Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25076
diff changeset
281 }
8f397c8e728a Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25076
diff changeset
282
8f397c8e728a Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25076
diff changeset
283 void
8f397c8e728a Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25076
diff changeset
284 purple_theme_set_description(PurpleTheme *theme, const gchar *description)
8f397c8e728a Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25076
diff changeset
285 {
25081
8793058bc318 changed the purple theme formatting a bit (minor)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25080
diff changeset
286 PurpleThemePrivate *priv;
25080
8f397c8e728a Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25076
diff changeset
287
8f397c8e728a Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25076
diff changeset
288 g_return_if_fail(PURPLE_IS_THEME(theme));
8f397c8e728a Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25076
diff changeset
289
8f397c8e728a Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25076
diff changeset
290 priv = PURPLE_THEME_GET_PRIVATE(theme);
8f397c8e728a Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25076
diff changeset
291
8f397c8e728a Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25076
diff changeset
292 g_free(priv->description);
25119
fc8047e1fa39 fixed some leaks and made theme loading safer
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25107
diff changeset
293 priv->description = theme_clean_text(description);
25080
8f397c8e728a Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25076
diff changeset
294 }
8f397c8e728a Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25076
diff changeset
295
25096
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: 25090
diff changeset
296 const gchar *
25074
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
297 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
298 {
25081
8793058bc318 changed the purple theme formatting a bit (minor)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25080
diff changeset
299 PurpleThemePrivate *priv;
25075
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25074
diff changeset
300
25074
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
301 g_return_val_if_fail(PURPLE_IS_THEME(theme), NULL);
25075
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25074
diff changeset
302
25074
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 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
304 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
305 }
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
306
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 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
308 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
309 {
25081
8793058bc318 changed the purple theme formatting a bit (minor)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25080
diff changeset
310 PurpleThemePrivate *priv;
25075
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25074
diff changeset
311
25074
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 g_return_if_fail(PURPLE_IS_THEME(theme));
25075
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25074
diff changeset
313
25074
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 priv = PURPLE_THEME_GET_PRIVATE(theme);
25075
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25074
diff changeset
315
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25074
diff changeset
316 g_free(priv->author);
25119
fc8047e1fa39 fixed some leaks and made theme loading safer
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25107
diff changeset
317 priv->author = theme_clean_text(author);
25074
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 }
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
319
25096
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: 25090
diff changeset
320 const gchar *
25074
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
321 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
322 {
25081
8793058bc318 changed the purple theme formatting a bit (minor)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25080
diff changeset
323 PurpleThemePrivate *priv;
25075
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25074
diff changeset
324
25074
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 g_return_val_if_fail(PURPLE_IS_THEME(theme), NULL);
25075
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25074
diff changeset
326
25074
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 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
328 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
329 }
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
330
25085
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25081
diff changeset
331 /* < private > */
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25081
diff changeset
332 void
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25081
diff changeset
333 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: 25081
diff changeset
334 {
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25081
diff changeset
335 PurpleThemePrivate *priv;
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25081
diff changeset
336
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25081
diff changeset
337 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: 25081
diff changeset
338
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25081
diff changeset
339 priv = PURPLE_THEME_GET_PRIVATE(theme);
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25081
diff changeset
340
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25081
diff changeset
341 g_free(priv->type);
25096
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: 25090
diff changeset
342 priv->type = g_strdup(type);
25085
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25081
diff changeset
343 }
fecc8e2612c4 Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25081
diff changeset
344
25096
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: 25090
diff changeset
345 const gchar *
25911
0c7b74fc558e Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents: 25858
diff changeset
346 purple_theme_get_dir(PurpleTheme *theme)
25074
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
347 {
25081
8793058bc318 changed the purple theme formatting a bit (minor)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25080
diff changeset
348 PurpleThemePrivate *priv;
25075
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25074
diff changeset
349
25074
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
350 g_return_val_if_fail(PURPLE_IS_THEME(theme), NULL);
25075
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25074
diff changeset
351
25074
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 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
353 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
354 }
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
355
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 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
357 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
358 {
25081
8793058bc318 changed the purple theme formatting a bit (minor)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25080
diff changeset
359 PurpleThemePrivate *priv;
25075
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25074
diff changeset
360
25074
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 g_return_if_fail(PURPLE_IS_THEME(theme));
25075
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25074
diff changeset
362
25074
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 priv = PURPLE_THEME_GET_PRIVATE(theme);
25075
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25074
diff changeset
364
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25074
diff changeset
365 g_free(priv->dir);
25096
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: 25090
diff changeset
366 priv->dir = g_strdup(dir);
25074
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 }
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
368
25096
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: 25090
diff changeset
369 const gchar *
25074
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
370 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
371 {
25081
8793058bc318 changed the purple theme formatting a bit (minor)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25080
diff changeset
372 PurpleThemePrivate *priv;
25075
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25074
diff changeset
373
25074
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 g_return_val_if_fail(PURPLE_IS_THEME(theme), NULL);
25075
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25074
diff changeset
375
25074
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 priv = PURPLE_THEME_GET_PRIVATE(theme);
25075
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25074
diff changeset
377
25096
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: 25090
diff changeset
378 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: 25090
diff changeset
379 }
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: 25090
diff changeset
380
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: 25090
diff changeset
381 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: 25090
diff changeset
382 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: 25090
diff changeset
383 {
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: 25090
diff changeset
384 const gchar *filename = purple_theme_get_image(theme);
25911
0c7b74fc558e Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents: 25858
diff changeset
385
27047
f70e86aec7d0 Reduce the number of g_return_val_if_fail calls for NULL input since that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25911
diff changeset
386 if (filename)
f70e86aec7d0 Reduce the number of g_return_val_if_fail calls for NULL input since that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25911
diff changeset
387 return g_build_filename(purple_theme_get_dir(PURPLE_THEME(theme)), filename, NULL);
f70e86aec7d0 Reduce the number of g_return_val_if_fail calls for NULL input since that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25911
diff changeset
388 else
f70e86aec7d0 Reduce the number of g_return_val_if_fail calls for NULL input since that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25911
diff changeset
389 return NULL;
25074
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
390 }
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
391
25911
0c7b74fc558e Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents: 25858
diff changeset
392 void
25096
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: 25090
diff changeset
393 purple_theme_set_image(PurpleTheme *theme, const gchar *img)
25911
0c7b74fc558e Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents: 25858
diff changeset
394 {
25081
8793058bc318 changed the purple theme formatting a bit (minor)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25080
diff changeset
395 PurpleThemePrivate *priv;
25075
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25074
diff changeset
396
25074
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 g_return_if_fail(PURPLE_IS_THEME(theme));
25075
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25074
diff changeset
398
25074
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 priv = PURPLE_THEME_GET_PRIVATE(theme);
25075
52a1f5950f46 fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 25074
diff changeset
400
25096
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: 25090
diff changeset
401 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: 25090
diff changeset
402 priv->img = g_strdup(img);
25074
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
403 }