[gnome-control-center/gnome-3-14] sound: Fix "format not a string literal" error
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/gnome-3-14] sound: Fix "format not a string literal" error
- Date: Tue, 26 Apr 2016 11:02:59 +0000 (UTC)
commit 3ec6eb488942e5dc083c125607c1a7f5d3f4b24f
Author: Bastien Nocera <hadess hadess net>
Date: Thu Apr 7 14:22:34 2016 +0200
sound: Fix "format not a string literal" error
https://bugzilla.gnome.org/show_bug.cgi?id=764727
panels/sound/sound-theme-file-utils.c | 26 ++++++++++++++++++++------
1 files changed, 20 insertions(+), 6 deletions(-)
---
diff --git a/panels/sound/sound-theme-file-utils.c b/panels/sound/sound-theme-file-utils.c
index f124135..ef80ec9 100644
--- a/panels/sound/sound-theme-file-utils.c
+++ b/panels/sound/sound-theme-file-utils.c
@@ -182,13 +182,28 @@ custom_theme_dir_is_empty (void)
return is_empty;
}
+typedef enum {
+ SOUND_TYPE_OGG,
+ SOUND_TYPE_DISABLED
+} SoundType;
+
static void
-delete_one_file (const char *sound_name, const char *pattern)
+delete_one_file (const char *sound_name, SoundType sound_type)
{
GFile *file;
char *name, *filename;
- name = g_strdup_printf (pattern, sound_name);
+ switch (sound_type) {
+ case SOUND_TYPE_OGG:
+ name = g_strdup_printf ("%s.ogg", sound_name);
+ break;
+ case SOUND_TYPE_DISABLED:
+ name = g_strdup_printf ("%s.disabled", sound_name);
+ break;
+ default:
+ g_assert_not_reached ();
+ }
+
filename = custom_theme_dir_path (name);
g_free (name);
file = g_file_new_for_path (filename);
@@ -202,9 +217,8 @@ delete_old_files (const char **sounds)
{
guint i;
- for (i = 0; sounds[i] != NULL; i++) {
- delete_one_file (sounds[i], "%s.ogg");
- }
+ for (i = 0; sounds[i] != NULL; i++)
+ delete_one_file (sounds[i], SOUND_TYPE_OGG);
}
void
@@ -213,7 +227,7 @@ delete_disabled_files (const char **sounds)
guint i;
for (i = 0; sounds[i] != NULL; i++)
- delete_one_file (sounds[i], "%s.disabled");
+ delete_one_file (sounds[i], SOUND_TYPE_DISABLED);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]