libpurple/sound-theme.c

Mon, 30 Jun 2008 03:50:35 +0000

author
Justin Rodriguez <ffdragon@soc.pidgin.im>
date
Mon, 30 Jun 2008 03:50:35 +0000
branch
soc.2008.themes
changeset 23653
79934bf9a349
parent 23651
2c04a707246d
child 24931
7cfa9bde653b
permissions
-rw-r--r--

Fixed up a few typos, readability, leaks, and bugs, all minor and mostly in theme and theme loader classes

23639
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
1 /*
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
2 * Sound Themes for LibPurple
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
3 *
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
4 * Pidgin is the legal property of its developers, whose names are too numerous
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
5 * to list here. Please refer to the COPYRIGHT file distributed with this
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
6 * source distribution.
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
7 *
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
11 * (at your option) any later version.
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
12 *
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
16 * GNU General Public License for more details.
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
17 *
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
21 *
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
22 */
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
23
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
24 #include "sound-theme.h"
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
25
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
26 #define PURPLE_SOUND_THEME_GET_PRIVATE(Gobject) \
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
27 ((PurpleSoundThemePrivate *) ((PURPLE_SOUND_THEME(Gobject))->priv))
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
28
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
29
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
30 /******************************************************************************
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
31 * Structs
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
32 *****************************************************************************/
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
33 typedef struct {
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
34 /* used to store filenames of diffrent sounds */
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
35 GHashTable *sound_files;
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
36 } PurpleSoundThemePrivate;
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
37
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
38 /******************************************************************************
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
39 * Globals
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
40 *****************************************************************************/
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
41
23642
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23639
diff changeset
42 static GObjectClass *parent_class = NULL;
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23639
diff changeset
43
23639
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
44 /******************************************************************************
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
45 * Enums
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
46 *****************************************************************************/
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
47
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
48 /******************************************************************************
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
49 * GObject Stuff
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
50 *****************************************************************************/
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
51
23642
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23639
diff changeset
52 static void
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23639
diff changeset
53 purple_sound_theme_init(GTypeInstance *instance,
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23639
diff changeset
54 gpointer klass)
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23639
diff changeset
55 {
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23639
diff changeset
56 PurpleSoundThemePrivate *priv;
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23639
diff changeset
57
23647
b856721ba8dd more gobject fixed
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23646
diff changeset
58 (PURPLE_SOUND_THEME(instance))->priv = g_new0(PurpleSoundThemePrivate, 1);
b856721ba8dd more gobject fixed
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23646
diff changeset
59
b856721ba8dd more gobject fixed
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23646
diff changeset
60 priv = PURPLE_SOUND_THEME_GET_PRIVATE(instance);
23642
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23639
diff changeset
61
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23639
diff changeset
62 priv->sound_files = g_hash_table_new_full (g_str_hash,
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23639
diff changeset
63 g_str_equal,
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23639
diff changeset
64 g_free,
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23639
diff changeset
65 g_free);
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23639
diff changeset
66 }
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23639
diff changeset
67
23639
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
68 static void
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
69 purple_sound_theme_finalize (GObject *obj)
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
70 {
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
71 PurpleSoundThemePrivate *priv;
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
72
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
73 priv = PURPLE_SOUND_THEME_GET_PRIVATE(obj);
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
74
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
75 g_hash_table_destroy(priv->sound_files);
23642
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23639
diff changeset
76
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23639
diff changeset
77 parent_class->finalize (obj);
23639
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
78 }
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
79
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
80 static void
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
81 purple_sound_theme_class_init (PurpleSoundThemeClass *klass)
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
82 {
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
83 GObjectClass *obj_class = G_OBJECT_CLASS(klass);
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
84
23642
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23639
diff changeset
85 parent_class = g_type_class_peek_parent (klass);
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23639
diff changeset
86
23639
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
87 obj_class->finalize = purple_sound_theme_finalize;
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
88 }
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
89
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
90 GType
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
91 purple_sound_theme_get_type (void)
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
92 {
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
93 static GType type = 0;
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
94 if (type == 0) {
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
95 static const GTypeInfo info = {
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
96 sizeof (PurpleSoundThemeClass),
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
97 NULL, /* base_init */
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
98 NULL, /* base_finalize */
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
99 (GClassInitFunc)purple_sound_theme_class_init, /* class_init */
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
100 NULL, /* class_finalize */
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
101 NULL, /* class_data */
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
102 sizeof (PurpleSoundTheme),
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
103 0, /* n_preallocs */
23642
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23639
diff changeset
104 purple_sound_theme_init, /* instance_init */
23639
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
105 NULL, /* value table */
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
106 };
23646
ec4f4e6508b1 fixed some gobject stuff
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23642
diff changeset
107 type = g_type_register_static (PURPLE_TYPE_THEME,
ec4f4e6508b1 fixed some gobject stuff
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23642
diff changeset
108 "PurpleSoundTheme",
23639
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
109 &info, 0);
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
110 }
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
111 return type;
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
112 }
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
113
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
114
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
115 /*****************************************************************************
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
116 * Public API functions
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
117 *****************************************************************************/
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
118
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: 23651
diff changeset
119 const gchar *
23639
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
120 purple_sound_theme_get_file(PurpleSoundTheme *theme,
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
121 const gchar *event)
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
122 {
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
123 PurpleSoundThemePrivate *priv;
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
124
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
125 g_return_val_if_fail(PURPLE_IS_SOUND_THEME(theme), NULL);
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
126
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
127 priv = PURPLE_SOUND_THEME_GET_PRIVATE(theme);
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
128
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
129 return g_hash_table_lookup(priv->sound_files, event);
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
130 }
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
131
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
132 gchar *
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
133 purple_sound_theme_get_file_full(PurpleSoundTheme *theme,
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
134 const gchar *event)
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
135 {
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: 23651
diff changeset
136 gchar *filename;
23639
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
137
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
138 g_return_val_if_fail(PURPLE_IS_SOUND_THEME(theme), NULL);
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
139
23649
5da5fe967d10 Working sound themes (option 1) theme is saved in prefs and there is no seperate custom theme, everything
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23647
diff changeset
140 filename = purple_sound_theme_get_file(theme, event);
5da5fe967d10 Working sound themes (option 1) theme is saved in prefs and there is no seperate custom theme, everything
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23647
diff changeset
141
5da5fe967d10 Working sound themes (option 1) theme is saved in prefs and there is no seperate custom theme, everything
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23647
diff changeset
142 g_return_val_if_fail(filename, NULL);
5da5fe967d10 Working sound themes (option 1) theme is saved in prefs and there is no seperate custom theme, everything
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23647
diff changeset
143
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: 23651
diff changeset
144 return g_build_filename(purple_theme_get_dir(PURPLE_THEME(theme)), filename, NULL);
23639
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
145 }
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
146
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
147 void
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
148 purple_sound_theme_set_file(PurpleSoundTheme *theme,
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
149 const gchar *event,
23649
5da5fe967d10 Working sound themes (option 1) theme is saved in prefs and there is no seperate custom theme, everything
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23647
diff changeset
150 const gchar *filename)
23639
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
151 {
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
152 PurpleSoundThemePrivate *priv;
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
153 g_return_if_fail(PURPLE_IS_SOUND_THEME(theme));
23651
2c04a707246d Fixed a few small problems with the sound loader and sound theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23649
diff changeset
154
23639
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
155 priv = PURPLE_SOUND_THEME_GET_PRIVATE(theme);
23651
2c04a707246d Fixed a few small problems with the sound loader and sound theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23649
diff changeset
156
2c04a707246d Fixed a few small problems with the sound loader and sound theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23649
diff changeset
157 if (filename != NULL)g_hash_table_replace(priv->sound_files,
23639
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
158 g_strdup(event),
23649
5da5fe967d10 Working sound themes (option 1) theme is saved in prefs and there is no seperate custom theme, everything
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23647
diff changeset
159 g_strdup(filename));
23639
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
160 else g_hash_table_remove(priv->sound_files, event);
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
161 }
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
162
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
163

mercurial