Mercurial > pidgin
comparison libpurple/sound-theme-loader.c @ 32730:f7be1e356a23
Change theme loaders to use the correct subdirectory now that the
theme manager only gives them the root directory.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sat, 03 Mar 2012 08:19:33 +0000 |
parents | 9ad4b5200f24 |
children |
comparison
equal
deleted
inserted
replaced
32729:b276701931d9 | 32730:f7be1e356a23 |
---|---|
30 /***************************************************************************** | 30 /***************************************************************************** |
31 * Sound Theme Builder | 31 * Sound Theme Builder |
32 *****************************************************************************/ | 32 *****************************************************************************/ |
33 | 33 |
34 static PurpleTheme * | 34 static PurpleTheme * |
35 purple_sound_loader_build(const gchar *dir) | 35 purple_sound_loader_build(const gchar *theme_dir) |
36 { | 36 { |
37 xmlnode *root_node = NULL, *sub_node; | 37 xmlnode *root_node = NULL, *sub_node; |
38 gchar *filename_full, *data = NULL; | 38 gchar *dir, *filename_full, *data = NULL; |
39 PurpleSoundTheme *theme = NULL; | 39 PurpleSoundTheme *theme = NULL; |
40 const gchar *name; | 40 const gchar *name; |
41 | 41 |
42 /* Find the theme file */ | 42 /* Find the theme file */ |
43 g_return_val_if_fail(dir != NULL, NULL); | 43 g_return_val_if_fail(theme_dir != NULL, NULL); |
44 dir = g_build_filename(theme_dir, "purple", "sound", NULL); | |
44 filename_full = g_build_filename(dir, "theme.xml", NULL); | 45 filename_full = g_build_filename(dir, "theme.xml", NULL); |
45 | 46 |
46 if (g_file_test(filename_full, G_FILE_TEST_IS_REGULAR)) | 47 if (g_file_test(filename_full, G_FILE_TEST_IS_REGULAR)) |
47 root_node = xmlnode_from_file(dir, "theme.xml", "sound themes", "sound-theme-loader"); | 48 root_node = xmlnode_from_file(dir, "theme.xml", "sound themes", "sound-theme-loader"); |
48 | 49 |
49 g_free(filename_full); | 50 g_free(filename_full); |
50 if (root_node == NULL) | 51 if (root_node == NULL) { |
52 g_free(dir); | |
51 return NULL; | 53 return NULL; |
54 } | |
52 | 55 |
53 name = xmlnode_get_attrib(root_node, "name"); | 56 name = xmlnode_get_attrib(root_node, "name"); |
54 | 57 |
55 if (name && purple_strequal(xmlnode_get_attrib(root_node, "type"), "sound")) { | 58 if (name && purple_strequal(xmlnode_get_attrib(root_node, "type"), "sound")) { |
56 /* Parse the tree */ | 59 /* Parse the tree */ |
77 } | 80 } |
78 } else purple_debug_warning("sound-theme-loader", "Missing attribute or problem with the root element\n"); | 81 } else purple_debug_warning("sound-theme-loader", "Missing attribute or problem with the root element\n"); |
79 | 82 |
80 xmlnode_free(root_node); | 83 xmlnode_free(root_node); |
81 g_free(data); | 84 g_free(data); |
85 g_free(dir); | |
82 return PURPLE_THEME(theme); | 86 return PURPLE_THEME(theme); |
83 } | 87 } |
84 | 88 |
85 /****************************************************************************** | 89 /****************************************************************************** |
86 * GObject Stuff | 90 * GObject Stuff |