libpurple/sound-theme.c

Fri, 14 Feb 2020 01:49:34 -0600

author
Gary Kramlich <grim@reaperworld.com>
date
Fri, 14 Feb 2020 01:49:34 -0600
branch
use-after-free
changeset 40286
ca45e74fb1ee
parent 39547
5c68828a566a
permissions
-rw-r--r--

closing merged branch

23639
c59dd2e328c3 Added minimal sound theme class (only get/set api)
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: 25010
diff changeset
2 * Sound Themes for libpurple
23639
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
25010
57a841ca2450 Fix win32 build. I haven't actually tested any of the functionality, but it
Daniel Atallah <datallah@pidgin.im>
parents: 24931
diff changeset
23 #include "internal.h"
23639
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 /******************************************************************************
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
27 * Structs
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
28 *****************************************************************************/
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25010
diff changeset
29
39547
5c68828a566a Use G_DECLARE* in themes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39364
diff changeset
30 /**
5c68828a566a Use G_DECLARE* in themes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39364
diff changeset
31 * PurpleSoundTheme:
5c68828a566a Use G_DECLARE* in themes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39364
diff changeset
32 *
5c68828a566a Use G_DECLARE* in themes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39364
diff changeset
33 * A purple sound theme.
5c68828a566a Use G_DECLARE* in themes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39364
diff changeset
34 * This is an object for Purple to represent a sound theme.
5c68828a566a Use G_DECLARE* in themes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39364
diff changeset
35 */
5c68828a566a Use G_DECLARE* in themes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39364
diff changeset
36 struct _PurpleSoundTheme
5c68828a566a Use G_DECLARE* in themes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39364
diff changeset
37 {
5c68828a566a Use G_DECLARE* in themes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39364
diff changeset
38 /*< private >*/
5c68828a566a Use G_DECLARE* in themes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39364
diff changeset
39 PurpleTheme parent;
5c68828a566a Use G_DECLARE* in themes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39364
diff changeset
40 };
5c68828a566a Use G_DECLARE* in themes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39364
diff changeset
41
23639
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
42 typedef struct {
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
43 /* 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
44 GHashTable *sound_files;
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
45 } PurpleSoundThemePrivate;
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 * Globals
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
49 *****************************************************************************/
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
50
39364
54439db24429 libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 32438
diff changeset
51 G_DEFINE_TYPE_WITH_PRIVATE(PurpleSoundTheme, purple_sound_theme,
54439db24429 libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 32438
diff changeset
52 PURPLE_TYPE_THEME);
23642
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23639
diff changeset
53
23639
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
54 /******************************************************************************
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
55 * Enums
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
56 *****************************************************************************/
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
57
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
58 /******************************************************************************
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25010
diff changeset
59 * GObject Stuff
23639
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
60 *****************************************************************************/
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
61
23642
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23639
diff changeset
62 static void
39364
54439db24429 libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 32438
diff changeset
63 purple_sound_theme_init(PurpleSoundTheme *theme)
23642
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23639
diff changeset
64 {
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23639
diff changeset
65 PurpleSoundThemePrivate *priv;
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23639
diff changeset
66
39364
54439db24429 libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 32438
diff changeset
67 priv = purple_sound_theme_get_instance_private(theme);
23642
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23639
diff changeset
68
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25010
diff changeset
69 priv->sound_files = g_hash_table_new_full(g_str_hash,
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25010
diff changeset
70 g_str_equal, g_free, g_free);
23642
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23639
diff changeset
71 }
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23639
diff changeset
72
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25010
diff changeset
73 static void
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25010
diff changeset
74 purple_sound_theme_finalize(GObject *obj)
23639
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
75 {
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
76 PurpleSoundThemePrivate *priv;
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
77
39364
54439db24429 libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 32438
diff changeset
78 priv = purple_sound_theme_get_instance_private(PURPLE_SOUND_THEME(obj));
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25010
diff changeset
79
23639
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
80 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
81
39364
54439db24429 libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 32438
diff changeset
82 G_OBJECT_CLASS(purple_sound_theme_parent_class)->finalize(obj);
23639
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
83 }
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
84
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
85 static void
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25010
diff changeset
86 purple_sound_theme_class_init(PurpleSoundThemeClass *klass)
23639
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
87 {
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
88 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
89
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25010
diff changeset
90 obj_class->finalize = purple_sound_theme_finalize;
23639
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
91 }
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 /*****************************************************************************
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25010
diff changeset
94 * Public API functions
23639
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
95 *****************************************************************************/
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
96
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
97 const gchar *
23639
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
98 purple_sound_theme_get_file(PurpleSoundTheme *theme,
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25010
diff changeset
99 const gchar *event)
23639
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
100 {
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
101 PurpleSoundThemePrivate *priv;
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
102
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
103 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
104
39364
54439db24429 libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 32438
diff changeset
105 priv = purple_sound_theme_get_instance_private(theme);
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25010
diff changeset
106
23639
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
107 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
108 }
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
109
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
110 gchar *
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
111 purple_sound_theme_get_file_full(PurpleSoundTheme *theme,
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25010
diff changeset
112 const gchar *event)
23639
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
113 {
24931
7cfa9bde653b Fix a compiler warning.
Richard Laager <rlaager@pidgin.im>
parents: 23653
diff changeset
114 const gchar *filename;
23639
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 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
117
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
118 filename = purple_sound_theme_get_file(theme, event);
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25010
diff changeset
119
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
120 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
121
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
122 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
123 }
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
124
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25010
diff changeset
125 void
23639
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
126 purple_sound_theme_set_file(PurpleSoundTheme *theme,
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25010
diff changeset
127 const gchar *event,
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25010
diff changeset
128 const gchar *filename)
23639
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
129 {
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
130 PurpleSoundThemePrivate *priv;
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
131 g_return_if_fail(PURPLE_IS_SOUND_THEME(theme));
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25010
diff changeset
132
39364
54439db24429 libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 32438
diff changeset
133 priv = purple_sound_theme_get_instance_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
134
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25010
diff changeset
135 if (filename != NULL)
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25010
diff changeset
136 g_hash_table_replace(priv->sound_files,
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25010
diff changeset
137 g_strdup(event), g_strdup(filename));
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25010
diff changeset
138 else
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25010
diff changeset
139 g_hash_table_remove(priv->sound_files, event);
23639
c59dd2e328c3 Added minimal sound theme class (only get/set api)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
140 }

mercurial