Mercurial > pidgin.yaz
annotate libpurple/sound-theme.c @ 31047:809dac0c47ce
Add missing headers to fix distcheck
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Mon, 18 Oct 2010 23:47:32 +0000 |
parents | 0c7b74fc558e |
children | 4d92a431d0a1 |
rev | line source |
---|---|
23458
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
1 /* |
25402
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25354
diff
changeset
|
2 * Sound Themes for libpurple |
23458
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
3 * |
1cf10adc9b32
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 |
1cf10adc9b32
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 |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
6 * source distribution. |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
7 * |
1cf10adc9b32
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 |
1cf10adc9b32
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 |
1cf10adc9b32
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 |
1cf10adc9b32
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. |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
12 * |
1cf10adc9b32
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, |
1cf10adc9b32
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 |
1cf10adc9b32
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 |
1cf10adc9b32
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. |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
17 * |
1cf10adc9b32
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 |
1cf10adc9b32
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 |
1cf10adc9b32
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 |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
21 */ |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
22 |
25354
d5852f7208fa
Fix win32 build. I haven't actually tested any of the functionality, but it
Daniel Atallah <daniel.atallah@gmail.com>
parents:
25275
diff
changeset
|
23 #include "internal.h" |
23458
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
24 #include "sound-theme.h" |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
25 |
1cf10adc9b32
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) \ |
1cf10adc9b32
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)) |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
28 |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
29 /****************************************************************************** |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
30 * Structs |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
31 *****************************************************************************/ |
25402
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25354
diff
changeset
|
32 |
23458
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
33 typedef struct { |
1cf10adc9b32
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 */ |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
35 GHashTable *sound_files; |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
36 } PurpleSoundThemePrivate; |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
37 |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
38 /****************************************************************************** |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
39 * Globals |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
40 *****************************************************************************/ |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
41 |
23461
fecc8e2612c4
Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23458
diff
changeset
|
42 static GObjectClass *parent_class = NULL; |
fecc8e2612c4
Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23458
diff
changeset
|
43 |
23458
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
44 /****************************************************************************** |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
45 * Enums |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
46 *****************************************************************************/ |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
47 |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
48 /****************************************************************************** |
25402
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25354
diff
changeset
|
49 * GObject Stuff |
23458
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
50 *****************************************************************************/ |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
51 |
23461
fecc8e2612c4
Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23458
diff
changeset
|
52 static void |
fecc8e2612c4
Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23458
diff
changeset
|
53 purple_sound_theme_init(GTypeInstance *instance, |
25402
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25354
diff
changeset
|
54 gpointer klass) |
23461
fecc8e2612c4
Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23458
diff
changeset
|
55 { |
fecc8e2612c4
Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23458
diff
changeset
|
56 PurpleSoundThemePrivate *priv; |
fecc8e2612c4
Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23458
diff
changeset
|
57 |
23466
5a02912e0bac
more gobject fixed
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23465
diff
changeset
|
58 (PURPLE_SOUND_THEME(instance))->priv = g_new0(PurpleSoundThemePrivate, 1); |
5a02912e0bac
more gobject fixed
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23465
diff
changeset
|
59 |
5a02912e0bac
more gobject fixed
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23465
diff
changeset
|
60 priv = PURPLE_SOUND_THEME_GET_PRIVATE(instance); |
23461
fecc8e2612c4
Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23458
diff
changeset
|
61 |
25402
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25354
diff
changeset
|
62 priv->sound_files = g_hash_table_new_full(g_str_hash, |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25354
diff
changeset
|
63 g_str_equal, g_free, g_free); |
23461
fecc8e2612c4
Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23458
diff
changeset
|
64 } |
fecc8e2612c4
Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23458
diff
changeset
|
65 |
25402
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25354
diff
changeset
|
66 static void |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25354
diff
changeset
|
67 purple_sound_theme_finalize(GObject *obj) |
23458
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
68 { |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
69 PurpleSoundThemePrivate *priv; |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
70 |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
71 priv = PURPLE_SOUND_THEME_GET_PRIVATE(obj); |
25402
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25354
diff
changeset
|
72 |
23458
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
73 g_hash_table_destroy(priv->sound_files); |
23461
fecc8e2612c4
Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23458
diff
changeset
|
74 |
25402
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25354
diff
changeset
|
75 parent_class->finalize(obj); |
23458
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
76 } |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
77 |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
78 static void |
25402
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25354
diff
changeset
|
79 purple_sound_theme_class_init(PurpleSoundThemeClass *klass) |
23458
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
80 { |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
81 GObjectClass *obj_class = G_OBJECT_CLASS(klass); |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
82 |
25402
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25354
diff
changeset
|
83 parent_class = g_type_class_peek_parent(klass); |
23461
fecc8e2612c4
Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23458
diff
changeset
|
84 |
25402
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25354
diff
changeset
|
85 obj_class->finalize = purple_sound_theme_finalize; |
23458
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
86 } |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
87 |
25402
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25354
diff
changeset
|
88 GType |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25354
diff
changeset
|
89 purple_sound_theme_get_type(void) |
23458
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
90 { |
25402
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25354
diff
changeset
|
91 static GType type = 0; |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25354
diff
changeset
|
92 if (type == 0) { |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25354
diff
changeset
|
93 static const GTypeInfo info = { |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25354
diff
changeset
|
94 sizeof(PurpleSoundThemeClass), |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25354
diff
changeset
|
95 NULL, /* base_init */ |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25354
diff
changeset
|
96 NULL, /* base_finalize */ |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25354
diff
changeset
|
97 (GClassInitFunc)purple_sound_theme_class_init, /* class_init */ |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25354
diff
changeset
|
98 NULL, /* class_finalize */ |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25354
diff
changeset
|
99 NULL, /* class_data */ |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25354
diff
changeset
|
100 sizeof(PurpleSoundTheme), |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25354
diff
changeset
|
101 0, /* n_preallocs */ |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25354
diff
changeset
|
102 purple_sound_theme_init, /* instance_init */ |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25354
diff
changeset
|
103 NULL, /* value table */ |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25354
diff
changeset
|
104 }; |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25354
diff
changeset
|
105 type = g_type_register_static(PURPLE_TYPE_THEME, |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25354
diff
changeset
|
106 "PurpleSoundTheme", &info, 0); |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25354
diff
changeset
|
107 } |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25354
diff
changeset
|
108 return type; |
23458
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
109 } |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
110 |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
111 /***************************************************************************** |
25402
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25354
diff
changeset
|
112 * Public API functions |
23458
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
113 *****************************************************************************/ |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
114 |
23472
fbf72bbd1084
Fixed up a few typos, readability, leaks, and bugs, all minor and mostly in theme and theme loader classes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23470
diff
changeset
|
115 const gchar * |
23458
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
116 purple_sound_theme_get_file(PurpleSoundTheme *theme, |
25402
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25354
diff
changeset
|
117 const gchar *event) |
23458
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
118 { |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
119 PurpleSoundThemePrivate *priv; |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
120 |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
121 g_return_val_if_fail(PURPLE_IS_SOUND_THEME(theme), NULL); |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
122 |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
123 priv = PURPLE_SOUND_THEME_GET_PRIVATE(theme); |
25402
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25354
diff
changeset
|
124 |
23458
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
125 return g_hash_table_lookup(priv->sound_files, event); |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
126 } |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
127 |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
128 gchar * |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
129 purple_sound_theme_get_file_full(PurpleSoundTheme *theme, |
25402
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25354
diff
changeset
|
130 const gchar *event) |
23458
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
131 { |
25275
ef196295985e
Fix a compiler warning.
Richard Laager <rlaager@wiktel.com>
parents:
23472
diff
changeset
|
132 const gchar *filename; |
23458
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
133 |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
134 g_return_val_if_fail(PURPLE_IS_SOUND_THEME(theme), NULL); |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
135 |
23468
cf7625d4d7e0
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:
23466
diff
changeset
|
136 filename = purple_sound_theme_get_file(theme, event); |
25402
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25354
diff
changeset
|
137 |
23468
cf7625d4d7e0
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:
23466
diff
changeset
|
138 g_return_val_if_fail(filename, NULL); |
cf7625d4d7e0
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:
23466
diff
changeset
|
139 |
23472
fbf72bbd1084
Fixed up a few typos, readability, leaks, and bugs, all minor and mostly in theme and theme loader classes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23470
diff
changeset
|
140 return g_build_filename(purple_theme_get_dir(PURPLE_THEME(theme)), filename, NULL); |
23458
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
141 } |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
142 |
25402
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25354
diff
changeset
|
143 void |
23458
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
144 purple_sound_theme_set_file(PurpleSoundTheme *theme, |
25402
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25354
diff
changeset
|
145 const gchar *event, |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25354
diff
changeset
|
146 const gchar *filename) |
23458
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
147 { |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
148 PurpleSoundThemePrivate *priv; |
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
149 g_return_if_fail(PURPLE_IS_SOUND_THEME(theme)); |
25402
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25354
diff
changeset
|
150 |
23458
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
151 priv = PURPLE_SOUND_THEME_GET_PRIVATE(theme); |
23470
c32dd71d0658
Fixed a few small problems with the sound loader and sound theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23468
diff
changeset
|
152 |
25402
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25354
diff
changeset
|
153 if (filename != NULL) |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25354
diff
changeset
|
154 g_hash_table_replace(priv->sound_files, |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25354
diff
changeset
|
155 g_strdup(event), g_strdup(filename)); |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25354
diff
changeset
|
156 else |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25354
diff
changeset
|
157 g_hash_table_remove(priv->sound_files, event); |
23458
1cf10adc9b32
Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
158 } |