libpurple/theme.c

Thu, 01 Nov 2018 15:45:13 -0500

author
Mike Ruprecht <cmaiku@gmail.com>
date
Thu, 01 Nov 2018 15:45:13 -0500
changeset 39364
54439db24429
parent 35085
abab0adfa0ec
child 40195
fb4b0ae193c0
permissions
-rw-r--r--

libpurple: Port self-contained code from g_type_class_add_private()

This patch ports the self-contained libpurple GObjects away from the
deprecated g_type_class_add_private() function in favor of the
G_DEFINE_TYPE_WITH_PRIVATE() macro.

23631
d545d296d62c 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 /*
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25005
diff changeset
2 * Themes for libpurple
23631
d545d296d62c 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 *
d545d296d62c 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
d545d296d62c 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
d545d296d62c 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.
d545d296d62c 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 *
d545d296d62c 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
d545d296d62c 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
d545d296d62c 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
d545d296d62c 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.
d545d296d62c 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 *
d545d296d62c 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,
d545d296d62c 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
d545d296d62c 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
d545d296d62c 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.
d545d296d62c 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 *
d545d296d62c 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
d545d296d62c 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
d545d296d62c 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
d545d296d62c 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 */
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25005
diff changeset
22
25005
e86ff053dd10 Fix some theme manager assertion failures.
Richard Laager <rlaager@pidgin.im>
parents: 23969
diff changeset
23 #include "internal.h"
35078
9e2aff0b8476 libpurple: started changing g_object_notify to g_object_notify_by_pspec
Ankit Vani <a@nevitus.org>
parents: 35065
diff changeset
24 #include "glibcompat.h"
23631
d545d296d62c 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 #include "theme.h"
23969
0c3fe3967b97 fixed some leaks and made theme loading safer
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
26 #include "util.h"
0c3fe3967b97 fixed some leaks and made theme loading safer
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
27
23642
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23638
diff changeset
28 void purple_theme_set_type_string(PurpleTheme *theme, const gchar *type);
23631
d545d296d62c 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
d545d296d62c 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 /******************************************************************************
d545d296d62c 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 * Structs
d545d296d62c 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 *****************************************************************************/
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25005
diff changeset
33
23631
d545d296d62c 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 typedef struct {
d545d296d62c 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 gchar *name;
23637
808f8f699af0 Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23633
diff changeset
36 gchar *description;
23631
d545d296d62c 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 *author;
d545d296d62c 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 gchar *type;
d545d296d62c 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 *dir;
23653
79934bf9a349 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: 23647
diff changeset
40 gchar *img;
23631
d545d296d62c 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 } PurpleThemePrivate;
d545d296d62c 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
d545d296d62c 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 /******************************************************************************
d545d296d62c 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 * Enums
d545d296d62c 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 *****************************************************************************/
d545d296d62c 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
d545d296d62c 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 enum {
d545d296d62c 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 PROP_ZERO = 0,
d545d296d62c 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 PROP_NAME,
23664
cf938922baa5 Changed how the prefs handle themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23653
diff changeset
50 PROP_DESCRIPTION,
23631
d545d296d62c 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 PROP_AUTHOR,
d545d296d62c 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 PROP_TYPE,
d545d296d62c 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 PROP_DIR,
35078
9e2aff0b8476 libpurple: started changing g_object_notify to g_object_notify_by_pspec
Ankit Vani <a@nevitus.org>
parents: 35065
diff changeset
54 PROP_IMAGE,
9e2aff0b8476 libpurple: started changing g_object_notify to g_object_notify_by_pspec
Ankit Vani <a@nevitus.org>
parents: 35065
diff changeset
55 PROP_LAST
23631
d545d296d62c 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 };
d545d296d62c 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
23633
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23632
diff changeset
58 /******************************************************************************
35078
9e2aff0b8476 libpurple: started changing g_object_notify to g_object_notify_by_pspec
Ankit Vani <a@nevitus.org>
parents: 35065
diff changeset
59 * Globals
9e2aff0b8476 libpurple: started changing g_object_notify to g_object_notify_by_pspec
Ankit Vani <a@nevitus.org>
parents: 35065
diff changeset
60 *****************************************************************************/
9e2aff0b8476 libpurple: started changing g_object_notify to g_object_notify_by_pspec
Ankit Vani <a@nevitus.org>
parents: 35065
diff changeset
61
9e2aff0b8476 libpurple: started changing g_object_notify to g_object_notify_by_pspec
Ankit Vani <a@nevitus.org>
parents: 35065
diff changeset
62 static GParamSpec *properties[PROP_LAST];
9e2aff0b8476 libpurple: started changing g_object_notify to g_object_notify_by_pspec
Ankit Vani <a@nevitus.org>
parents: 35065
diff changeset
63
39364
54439db24429 libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 35085
diff changeset
64 G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(PurpleTheme, purple_theme, G_TYPE_OBJECT);
54439db24429 libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 35085
diff changeset
65
35078
9e2aff0b8476 libpurple: started changing g_object_notify to g_object_notify_by_pspec
Ankit Vani <a@nevitus.org>
parents: 35065
diff changeset
66 /******************************************************************************
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25005
diff changeset
67 * GObject Stuff
23633
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23632
diff changeset
68 *****************************************************************************/
23631
d545d296d62c 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
d545d296d62c 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 static void
d545d296d62c 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 purple_theme_get_property(GObject *obj, guint param_id, GValue *value,
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25005
diff changeset
72 GParamSpec *psec)
23631
d545d296d62c 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 {
23632
d0470bcd0b7e fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23631
diff changeset
74 PurpleTheme *theme = PURPLE_THEME(obj);
23631
d545d296d62c Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
75
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25005
diff changeset
76 switch (param_id) {
23631
d545d296d62c 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 case PROP_NAME:
23632
d0470bcd0b7e fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23631
diff changeset
78 g_value_set_string(value, purple_theme_get_name(theme));
23631
d545d296d62c Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
79 break;
23664
cf938922baa5 Changed how the prefs handle themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23653
diff changeset
80 case PROP_DESCRIPTION:
23637
808f8f699af0 Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23633
diff changeset
81 g_value_set_string(value, purple_theme_get_description(theme));
808f8f699af0 Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23633
diff changeset
82 break;
23631
d545d296d62c Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
83 case PROP_AUTHOR:
23632
d0470bcd0b7e fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23631
diff changeset
84 g_value_set_string(value, purple_theme_get_author(theme));
23631
d545d296d62c 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 break;
d545d296d62c 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 case PROP_TYPE:
23632
d0470bcd0b7e fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23631
diff changeset
87 g_value_set_string(value, purple_theme_get_type_string(theme));
23631
d545d296d62c 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 break;
d545d296d62c 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 case PROP_DIR:
23632
d0470bcd0b7e fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23631
diff changeset
90 g_value_set_string(value, purple_theme_get_dir(theme));
23631
d545d296d62c 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 break;
d545d296d62c 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 case PROP_IMAGE:
23653
79934bf9a349 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: 23647
diff changeset
93 g_value_set_string(value, purple_theme_get_image(theme));
23631
d545d296d62c 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 break;
d545d296d62c 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 default:
d545d296d62c 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 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, psec);
d545d296d62c 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 break;
d545d296d62c 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 }
d545d296d62c 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 }
d545d296d62c 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
d545d296d62c 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 static void
d545d296d62c 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 purple_theme_set_property(GObject *obj, guint param_id, const GValue *value,
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25005
diff changeset
103 GParamSpec *psec)
23631
d545d296d62c 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 {
23632
d0470bcd0b7e fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23631
diff changeset
105 PurpleTheme *theme = PURPLE_THEME(obj);
23631
d545d296d62c Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
106
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25005
diff changeset
107 switch (param_id) {
23631
d545d296d62c 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 case PROP_NAME:
23632
d0470bcd0b7e fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23631
diff changeset
109 purple_theme_set_name(theme, g_value_get_string(value));
23631
d545d296d62c Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
110 break;
23664
cf938922baa5 Changed how the prefs handle themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23653
diff changeset
111 case PROP_DESCRIPTION:
23637
808f8f699af0 Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23633
diff changeset
112 purple_theme_set_description(theme, g_value_get_string(value));
808f8f699af0 Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23633
diff changeset
113 break;
23631
d545d296d62c Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
114 case PROP_AUTHOR:
23632
d0470bcd0b7e fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23631
diff changeset
115 purple_theme_set_author(theme, g_value_get_string(value));
23631
d545d296d62c Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
116 break;
23642
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23638
diff changeset
117 case PROP_TYPE:
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23638
diff changeset
118 purple_theme_set_type_string(theme, g_value_get_string(value));
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23638
diff changeset
119 break;
23631
d545d296d62c Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
120 case PROP_DIR:
23632
d0470bcd0b7e fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23631
diff changeset
121 purple_theme_set_dir(theme, g_value_get_string(value));
23631
d545d296d62c 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 break;
d545d296d62c 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 case PROP_IMAGE:
23653
79934bf9a349 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: 23647
diff changeset
124 purple_theme_set_image(theme, g_value_get_string(value));
23631
d545d296d62c 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 break;
d545d296d62c 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 default:
d545d296d62c 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 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, psec);
d545d296d62c 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 break;
d545d296d62c 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 }
d545d296d62c 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 }
d545d296d62c 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
d545d296d62c 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 static void
39364
54439db24429 libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 35085
diff changeset
133 purple_theme_init(PurpleTheme *theme)
54439db24429 libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 35085
diff changeset
134 {
54439db24429 libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 35085
diff changeset
135 }
54439db24429 libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 35085
diff changeset
136
54439db24429 libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 35085
diff changeset
137 static void
23642
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23638
diff changeset
138 purple_theme_finalize(GObject *obj)
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23638
diff changeset
139 {
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25005
diff changeset
140 PurpleTheme *theme = PURPLE_THEME(obj);
39364
54439db24429 libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 35085
diff changeset
141 PurpleThemePrivate *priv = purple_theme_get_instance_private(theme);
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25005
diff changeset
142
23642
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23638
diff changeset
143 g_free(priv->name);
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23638
diff changeset
144 g_free(priv->description);
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23638
diff changeset
145 g_free(priv->author);
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23638
diff changeset
146 g_free(priv->type);
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23638
diff changeset
147 g_free(priv->dir);
23653
79934bf9a349 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: 23647
diff changeset
148 g_free(priv->img);
23642
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23638
diff changeset
149
39364
54439db24429 libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 35085
diff changeset
150 G_OBJECT_CLASS(purple_theme_parent_class)->finalize(obj);
23642
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23638
diff changeset
151 }
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23638
diff changeset
152
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23638
diff changeset
153 static void
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25005
diff changeset
154 purple_theme_class_init(PurpleThemeClass *klass)
23631
d545d296d62c Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
155 {
d545d296d62c Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
156 GObjectClass *obj_class = G_OBJECT_CLASS(klass);
d545d296d62c 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
d545d296d62c 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->get_property = purple_theme_get_property;
d545d296d62c 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 obj_class->set_property = purple_theme_set_property;
23642
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23638
diff changeset
160 obj_class->finalize = purple_theme_finalize;
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25005
diff changeset
161
23631
d545d296d62c 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 /* NAME */
35078
9e2aff0b8476 libpurple: started changing g_object_notify to g_object_notify_by_pspec
Ankit Vani <a@nevitus.org>
parents: 35065
diff changeset
163 properties[PROP_NAME] = g_param_spec_string("name", "Name",
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25005
diff changeset
164 "The name of the theme",
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25005
diff changeset
165 NULL,
35065
2fe1b3f20c3c Added a few missing G_PARAM_STATIC_STRINGS and g_object_notify
Ankit Vani <a@nevitus.org>
parents: 32438
diff changeset
166 G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS);
23664
cf938922baa5 Changed how the prefs handle themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23653
diff changeset
167
cf938922baa5 Changed how the prefs handle themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23653
diff changeset
168 /* DESCRIPTION */
35078
9e2aff0b8476 libpurple: started changing g_object_notify to g_object_notify_by_pspec
Ankit Vani <a@nevitus.org>
parents: 35065
diff changeset
169 properties[PROP_DESCRIPTION] = g_param_spec_string("description",
9e2aff0b8476 libpurple: started changing g_object_notify to g_object_notify_by_pspec
Ankit Vani <a@nevitus.org>
parents: 35065
diff changeset
170 "Description",
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25005
diff changeset
171 "The description of the theme",
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25005
diff changeset
172 NULL,
35065
2fe1b3f20c3c Added a few missing G_PARAM_STATIC_STRINGS and g_object_notify
Ankit Vani <a@nevitus.org>
parents: 32438
diff changeset
173 G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS);
23664
cf938922baa5 Changed how the prefs handle themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23653
diff changeset
174
23631
d545d296d62c 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 */
35078
9e2aff0b8476 libpurple: started changing g_object_notify to g_object_notify_by_pspec
Ankit Vani <a@nevitus.org>
parents: 35065
diff changeset
176 properties[PROP_AUTHOR] = g_param_spec_string("author", "Author",
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25005
diff changeset
177 "The author of the theme",
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25005
diff changeset
178 NULL,
35065
2fe1b3f20c3c Added a few missing G_PARAM_STATIC_STRINGS and g_object_notify
Ankit Vani <a@nevitus.org>
parents: 32438
diff changeset
179 G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS);
23664
cf938922baa5 Changed how the prefs handle themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23653
diff changeset
180
23631
d545d296d62c Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
181 /* TYPE STRING (read only) */
35078
9e2aff0b8476 libpurple: started changing g_object_notify to g_object_notify_by_pspec
Ankit Vani <a@nevitus.org>
parents: 35065
diff changeset
182 properties[PROP_TYPE] = g_param_spec_string("type", "Type",
28448
c5ca106a9c74 Fix some typos.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27266
diff changeset
183 "The string representing the type of the theme",
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25005
diff changeset
184 NULL,
35065
2fe1b3f20c3c Added a few missing G_PARAM_STATIC_STRINGS and g_object_notify
Ankit Vani <a@nevitus.org>
parents: 32438
diff changeset
185 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
2fe1b3f20c3c Added a few missing G_PARAM_STATIC_STRINGS and g_object_notify
Ankit Vani <a@nevitus.org>
parents: 32438
diff changeset
186 G_PARAM_STATIC_STRINGS);
23664
cf938922baa5 Changed how the prefs handle themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23653
diff changeset
187
23631
d545d296d62c 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 /* DIRECTORY */
35078
9e2aff0b8476 libpurple: started changing g_object_notify to g_object_notify_by_pspec
Ankit Vani <a@nevitus.org>
parents: 35065
diff changeset
189 properties[PROP_DIR] = g_param_spec_string("directory", "Directory",
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25005
diff changeset
190 "The directory that contains the theme and all its files",
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25005
diff changeset
191 NULL,
35065
2fe1b3f20c3c Added a few missing G_PARAM_STATIC_STRINGS and g_object_notify
Ankit Vani <a@nevitus.org>
parents: 32438
diff changeset
192 G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS);
23664
cf938922baa5 Changed how the prefs handle themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23653
diff changeset
193
23631
d545d296d62c 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 /* PREVIEW IMAGE */
35078
9e2aff0b8476 libpurple: started changing g_object_notify to g_object_notify_by_pspec
Ankit Vani <a@nevitus.org>
parents: 35065
diff changeset
195 properties[PROP_IMAGE] = g_param_spec_string("image", "Image",
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25005
diff changeset
196 "A preview image of the theme",
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25005
diff changeset
197 NULL,
35065
2fe1b3f20c3c Added a few missing G_PARAM_STATIC_STRINGS and g_object_notify
Ankit Vani <a@nevitus.org>
parents: 32438
diff changeset
198 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
35085
abab0adfa0ec libpurple: use g_object_class_install_properties instead of repeated g_object_class_install_property
Ankit Vani <a@nevitus.org>
parents: 35078
diff changeset
199
abab0adfa0ec libpurple: use g_object_class_install_properties instead of repeated g_object_class_install_property
Ankit Vani <a@nevitus.org>
parents: 35078
diff changeset
200 g_object_class_install_properties(obj_class, PROP_LAST, properties);
23631
d545d296d62c 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 }
d545d296d62c 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
23969
0c3fe3967b97 fixed some leaks and made theme loading safer
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
203 /******************************************************************************
0c3fe3967b97 fixed some leaks and made theme loading safer
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
204 * Helper Functions
0c3fe3967b97 fixed some leaks and made theme loading safer
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
205 *****************************************************************************/
0c3fe3967b97 fixed some leaks and made theme loading safer
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
206
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25005
diff changeset
207 static gchar *
23969
0c3fe3967b97 fixed some leaks and made theme loading safer
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
208 theme_clean_text(const gchar *text)
0c3fe3967b97 fixed some leaks and made theme loading safer
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
209 {
27266
934b87e749ab Reduce the number of g_return_val_if_fail calls for NULL input since that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25875
diff changeset
210 gchar *clean_text = NULL;
934b87e749ab Reduce the number of g_return_val_if_fail calls for NULL input since that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25875
diff changeset
211 if (text != NULL) {
934b87e749ab Reduce the number of g_return_val_if_fail calls for NULL input since that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25875
diff changeset
212 clean_text = g_markup_escape_text(text, -1);
934b87e749ab Reduce the number of g_return_val_if_fail calls for NULL input since that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25875
diff changeset
213 g_strdelimit(clean_text, "\n", ' ');
934b87e749ab Reduce the number of g_return_val_if_fail calls for NULL input since that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25875
diff changeset
214 purple_str_strip_char(clean_text, '\r');
934b87e749ab Reduce the number of g_return_val_if_fail calls for NULL input since that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25875
diff changeset
215 }
23969
0c3fe3967b97 fixed some leaks and made theme loading safer
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
216 return clean_text;
0c3fe3967b97 fixed some leaks and made theme loading safer
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
217 }
23631
d545d296d62c 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
d545d296d62c 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 /*****************************************************************************
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25005
diff changeset
220 * Public API function
23631
d545d296d62c 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 *****************************************************************************/
d545d296d62c 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
23653
79934bf9a349 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: 23647
diff changeset
223 const gchar *
23631
d545d296d62c 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 purple_theme_get_name(PurpleTheme *theme)
d545d296d62c 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 {
23638
c3e616f3abb0 changed the purple theme formatting a bit (minor)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23637
diff changeset
226 PurpleThemePrivate *priv;
23632
d0470bcd0b7e fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23631
diff changeset
227
23631
d545d296d62c 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 g_return_val_if_fail(PURPLE_IS_THEME(theme), NULL);
23632
d0470bcd0b7e fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23631
diff changeset
229
39364
54439db24429 libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 35085
diff changeset
230 priv = purple_theme_get_instance_private(theme);
23631
d545d296d62c Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
231 return priv->name;
d545d296d62c 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 }
d545d296d62c 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
d545d296d62c 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 void
d545d296d62c 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 purple_theme_set_name(PurpleTheme *theme, const gchar *name)
d545d296d62c 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 {
23638
c3e616f3abb0 changed the purple theme formatting a bit (minor)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23637
diff changeset
237 PurpleThemePrivate *priv;
23632
d0470bcd0b7e fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23631
diff changeset
238
23631
d545d296d62c Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
239 g_return_if_fail(PURPLE_IS_THEME(theme));
23632
d0470bcd0b7e fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23631
diff changeset
240
39364
54439db24429 libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 35085
diff changeset
241 priv = purple_theme_get_instance_private(theme);
23632
d0470bcd0b7e fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23631
diff changeset
242
d0470bcd0b7e fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23631
diff changeset
243 g_free(priv->name);
23969
0c3fe3967b97 fixed some leaks and made theme loading safer
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
244 priv->name = theme_clean_text(name);
35065
2fe1b3f20c3c Added a few missing G_PARAM_STATIC_STRINGS and g_object_notify
Ankit Vani <a@nevitus.org>
parents: 32438
diff changeset
245
35078
9e2aff0b8476 libpurple: started changing g_object_notify to g_object_notify_by_pspec
Ankit Vani <a@nevitus.org>
parents: 35065
diff changeset
246 g_object_notify_by_pspec(G_OBJECT(theme), properties[PROP_NAME]);
23631
d545d296d62c 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 }
d545d296d62c Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
248
23653
79934bf9a349 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: 23647
diff changeset
249 const gchar *
23637
808f8f699af0 Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23633
diff changeset
250 purple_theme_get_description(PurpleTheme *theme)
808f8f699af0 Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23633
diff changeset
251 {
23638
c3e616f3abb0 changed the purple theme formatting a bit (minor)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23637
diff changeset
252 PurpleThemePrivate *priv;
23637
808f8f699af0 Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23633
diff changeset
253
808f8f699af0 Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23633
diff changeset
254 g_return_val_if_fail(PURPLE_IS_THEME(theme), NULL);
808f8f699af0 Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23633
diff changeset
255
39364
54439db24429 libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 35085
diff changeset
256 priv = purple_theme_get_instance_private(theme);
23637
808f8f699af0 Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23633
diff changeset
257 return priv->description;
808f8f699af0 Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23633
diff changeset
258 }
808f8f699af0 Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23633
diff changeset
259
808f8f699af0 Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23633
diff changeset
260 void
808f8f699af0 Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23633
diff changeset
261 purple_theme_set_description(PurpleTheme *theme, const gchar *description)
808f8f699af0 Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23633
diff changeset
262 {
23638
c3e616f3abb0 changed the purple theme formatting a bit (minor)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23637
diff changeset
263 PurpleThemePrivate *priv;
23637
808f8f699af0 Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23633
diff changeset
264
808f8f699af0 Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23633
diff changeset
265 g_return_if_fail(PURPLE_IS_THEME(theme));
808f8f699af0 Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23633
diff changeset
266
39364
54439db24429 libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 35085
diff changeset
267 priv = purple_theme_get_instance_private(theme);
23637
808f8f699af0 Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23633
diff changeset
268
808f8f699af0 Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23633
diff changeset
269 g_free(priv->description);
23969
0c3fe3967b97 fixed some leaks and made theme loading safer
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
270 priv->description = theme_clean_text(description);
35065
2fe1b3f20c3c Added a few missing G_PARAM_STATIC_STRINGS and g_object_notify
Ankit Vani <a@nevitus.org>
parents: 32438
diff changeset
271
35078
9e2aff0b8476 libpurple: started changing g_object_notify to g_object_notify_by_pspec
Ankit Vani <a@nevitus.org>
parents: 35065
diff changeset
272 g_object_notify_by_pspec(G_OBJECT(theme), properties[PROP_DESCRIPTION]);
23637
808f8f699af0 Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23633
diff changeset
273 }
808f8f699af0 Added description to theme abstract class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23633
diff changeset
274
23653
79934bf9a349 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: 23647
diff changeset
275 const gchar *
23631
d545d296d62c 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 purple_theme_get_author(PurpleTheme *theme)
d545d296d62c 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 {
23638
c3e616f3abb0 changed the purple theme formatting a bit (minor)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23637
diff changeset
278 PurpleThemePrivate *priv;
23632
d0470bcd0b7e fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23631
diff changeset
279
23631
d545d296d62c Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
280 g_return_val_if_fail(PURPLE_IS_THEME(theme), NULL);
23632
d0470bcd0b7e fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23631
diff changeset
281
39364
54439db24429 libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 35085
diff changeset
282 priv = purple_theme_get_instance_private(theme);
23631
d545d296d62c Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
283 return priv->author;
d545d296d62c Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
284 }
d545d296d62c Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
285
d545d296d62c Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
286 void
d545d296d62c Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
287 purple_theme_set_author(PurpleTheme *theme, const gchar *author)
d545d296d62c Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
288 {
23638
c3e616f3abb0 changed the purple theme formatting a bit (minor)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23637
diff changeset
289 PurpleThemePrivate *priv;
23632
d0470bcd0b7e fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23631
diff changeset
290
23631
d545d296d62c Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
291 g_return_if_fail(PURPLE_IS_THEME(theme));
23632
d0470bcd0b7e fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23631
diff changeset
292
39364
54439db24429 libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 35085
diff changeset
293 priv = purple_theme_get_instance_private(theme);
23632
d0470bcd0b7e fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23631
diff changeset
294
d0470bcd0b7e fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23631
diff changeset
295 g_free(priv->author);
23969
0c3fe3967b97 fixed some leaks and made theme loading safer
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
296 priv->author = theme_clean_text(author);
35065
2fe1b3f20c3c Added a few missing G_PARAM_STATIC_STRINGS and g_object_notify
Ankit Vani <a@nevitus.org>
parents: 32438
diff changeset
297
35078
9e2aff0b8476 libpurple: started changing g_object_notify to g_object_notify_by_pspec
Ankit Vani <a@nevitus.org>
parents: 35065
diff changeset
298 g_object_notify_by_pspec(G_OBJECT(theme), properties[PROP_AUTHOR]);
23631
d545d296d62c Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
299 }
d545d296d62c Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
300
23653
79934bf9a349 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: 23647
diff changeset
301 const gchar *
23631
d545d296d62c Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
302 purple_theme_get_type_string(PurpleTheme *theme)
d545d296d62c 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 {
23638
c3e616f3abb0 changed the purple theme formatting a bit (minor)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23637
diff changeset
304 PurpleThemePrivate *priv;
23632
d0470bcd0b7e fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23631
diff changeset
305
23631
d545d296d62c 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 g_return_val_if_fail(PURPLE_IS_THEME(theme), NULL);
23632
d0470bcd0b7e fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23631
diff changeset
307
39364
54439db24429 libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 35085
diff changeset
308 priv = purple_theme_get_instance_private(theme);
23631
d545d296d62c 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 return priv->type;
d545d296d62c 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 }
d545d296d62c 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
23642
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23638
diff changeset
312 /* < private > */
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23638
diff changeset
313 void
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23638
diff changeset
314 purple_theme_set_type_string(PurpleTheme *theme, const gchar *type)
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23638
diff changeset
315 {
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23638
diff changeset
316 PurpleThemePrivate *priv;
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23638
diff changeset
317
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23638
diff changeset
318 g_return_if_fail(PURPLE_IS_THEME(theme));
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23638
diff changeset
319
39364
54439db24429 libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 35085
diff changeset
320 priv = purple_theme_get_instance_private(theme);
23642
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23638
diff changeset
321
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23638
diff changeset
322 g_free(priv->type);
23653
79934bf9a349 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: 23647
diff changeset
323 priv->type = g_strdup(type);
35065
2fe1b3f20c3c Added a few missing G_PARAM_STATIC_STRINGS and g_object_notify
Ankit Vani <a@nevitus.org>
parents: 32438
diff changeset
324
35078
9e2aff0b8476 libpurple: started changing g_object_notify to g_object_notify_by_pspec
Ankit Vani <a@nevitus.org>
parents: 35065
diff changeset
325 g_object_notify_by_pspec(G_OBJECT(theme), properties[PROP_TYPE]);
23642
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23638
diff changeset
326 }
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23638
diff changeset
327
23653
79934bf9a349 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: 23647
diff changeset
328 const gchar *
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25005
diff changeset
329 purple_theme_get_dir(PurpleTheme *theme)
23631
d545d296d62c 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 {
23638
c3e616f3abb0 changed the purple theme formatting a bit (minor)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23637
diff changeset
331 PurpleThemePrivate *priv;
23632
d0470bcd0b7e fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23631
diff changeset
332
23631
d545d296d62c 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 g_return_val_if_fail(PURPLE_IS_THEME(theme), NULL);
23632
d0470bcd0b7e fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23631
diff changeset
334
39364
54439db24429 libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 35085
diff changeset
335 priv = purple_theme_get_instance_private(theme);
23631
d545d296d62c 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 return priv->dir;
d545d296d62c Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
337 }
d545d296d62c Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
338
d545d296d62c Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
339 void
d545d296d62c Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
340 purple_theme_set_dir(PurpleTheme *theme, const gchar *dir)
d545d296d62c Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
341 {
23638
c3e616f3abb0 changed the purple theme formatting a bit (minor)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23637
diff changeset
342 PurpleThemePrivate *priv;
23632
d0470bcd0b7e fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23631
diff changeset
343
23631
d545d296d62c Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
344 g_return_if_fail(PURPLE_IS_THEME(theme));
23632
d0470bcd0b7e fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23631
diff changeset
345
39364
54439db24429 libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 35085
diff changeset
346 priv = purple_theme_get_instance_private(theme);
23632
d0470bcd0b7e fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23631
diff changeset
347
d0470bcd0b7e fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23631
diff changeset
348 g_free(priv->dir);
23653
79934bf9a349 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: 23647
diff changeset
349 priv->dir = g_strdup(dir);
35065
2fe1b3f20c3c Added a few missing G_PARAM_STATIC_STRINGS and g_object_notify
Ankit Vani <a@nevitus.org>
parents: 32438
diff changeset
350
35078
9e2aff0b8476 libpurple: started changing g_object_notify to g_object_notify_by_pspec
Ankit Vani <a@nevitus.org>
parents: 35065
diff changeset
351 g_object_notify_by_pspec(G_OBJECT(theme), properties[PROP_DIR]);
23631
d545d296d62c 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 }
d545d296d62c 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
23653
79934bf9a349 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: 23647
diff changeset
354 const gchar *
23631
d545d296d62c 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 purple_theme_get_image(PurpleTheme *theme)
d545d296d62c 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 {
23638
c3e616f3abb0 changed the purple theme formatting a bit (minor)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23637
diff changeset
357 PurpleThemePrivate *priv;
23632
d0470bcd0b7e fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23631
diff changeset
358
23631
d545d296d62c 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 g_return_val_if_fail(PURPLE_IS_THEME(theme), NULL);
23632
d0470bcd0b7e fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23631
diff changeset
360
39364
54439db24429 libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 35085
diff changeset
361 priv = purple_theme_get_instance_private(theme);
23632
d0470bcd0b7e fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23631
diff changeset
362
23653
79934bf9a349 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: 23647
diff changeset
363 return priv->img;
79934bf9a349 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: 23647
diff changeset
364 }
79934bf9a349 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: 23647
diff changeset
365
79934bf9a349 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: 23647
diff changeset
366 gchar *
79934bf9a349 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: 23647
diff changeset
367 purple_theme_get_image_full(PurpleTheme *theme)
79934bf9a349 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: 23647
diff changeset
368 {
79934bf9a349 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: 23647
diff changeset
369 const gchar *filename = purple_theme_get_image(theme);
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25005
diff changeset
370
27266
934b87e749ab Reduce the number of g_return_val_if_fail calls for NULL input since that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25875
diff changeset
371 if (filename)
934b87e749ab Reduce the number of g_return_val_if_fail calls for NULL input since that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25875
diff changeset
372 return g_build_filename(purple_theme_get_dir(PURPLE_THEME(theme)), filename, NULL);
934b87e749ab Reduce the number of g_return_val_if_fail calls for NULL input since that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25875
diff changeset
373 else
934b87e749ab Reduce the number of g_return_val_if_fail calls for NULL input since that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25875
diff changeset
374 return NULL;
23631
d545d296d62c Added basic theme for libpurple to be used by theme manager and loaders (abstract gobject)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
375 }
d545d296d62c 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
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25005
diff changeset
377 void
23653
79934bf9a349 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: 23647
diff changeset
378 purple_theme_set_image(PurpleTheme *theme, const gchar *img)
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25005
diff changeset
379 {
23638
c3e616f3abb0 changed the purple theme formatting a bit (minor)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23637
diff changeset
380 PurpleThemePrivate *priv;
23632
d0470bcd0b7e fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23631
diff changeset
381
23631
d545d296d62c 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 g_return_if_fail(PURPLE_IS_THEME(theme));
23632
d0470bcd0b7e fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23631
diff changeset
383
39364
54439db24429 libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 35085
diff changeset
384 priv = purple_theme_get_instance_private(theme);
23632
d0470bcd0b7e fixed formatting and get/set properties
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23631
diff changeset
385
23653
79934bf9a349 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: 23647
diff changeset
386 g_free(priv->img);
79934bf9a349 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: 23647
diff changeset
387 priv->img = g_strdup(img);
35065
2fe1b3f20c3c Added a few missing G_PARAM_STATIC_STRINGS and g_object_notify
Ankit Vani <a@nevitus.org>
parents: 32438
diff changeset
388
35078
9e2aff0b8476 libpurple: started changing g_object_notify to g_object_notify_by_pspec
Ankit Vani <a@nevitus.org>
parents: 35065
diff changeset
389 g_object_notify_by_pspec(G_OBJECT(theme), properties[PROP_IMAGE]);
23631
d545d296d62c 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 }

mercurial