From: Michael Dominic Kostrzewa Date: Thu, 14 Dec 2006 16:45:32 +0000 (+0000) Subject: Cleaning up. X-Git-Tag: 2.1.66-1~1034 X-Git-Url: https://vcs.maemo.org/git/?a=commitdiff_plain;h=df49f08b9002299e92ab9f101216085c0de37375;p=hildon Cleaning up. --- diff --git a/ChangeLog b/ChangeLog index 29a52b8..3e01ec5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2006-12-14 Michael Dominic Kostrzewa + * src/hildon-sound.c: + * src/hildon-sound.h: Cleaning up. + +2006-12-14 Michael Dominic Kostrzewa + * TODO: Removing. * src/hildon-volumebar-range.c: diff --git a/src/hildon-sound.c b/src/hildon-sound.c index e02a6f2..18d6e54 100644 --- a/src/hildon-sound.c +++ b/src/hildon-sound.c @@ -28,13 +28,13 @@ * */ -#include -#include "hildon-sound.h" -#include -#include -#include +#include "hildon-sound.h" +#include +#include +#include -#define ALARM_GCONF_PATH "/apps/osso/sound/system_alert_volume" +#define ALARM_GCONF_PATH \ + "/apps/osso/sound/system_alert_volume" /** * hildon_play_system_sound: @@ -43,51 +43,52 @@ * Plays the given sample using esd sound daemon. * Volume level is received from gconf. */ -void hildon_play_system_sound(const gchar *sample) +void +hildon_play_system_sound (const gchar *sample) { - GConfClient *client; - GConfValue *value; - gint volume, scale, sock, sample_id; + GConfClient *client; + GConfValue *value; + gint volume, scale, sock, sample_id; - client = gconf_client_get_default(); - value = gconf_client_get(client, ALARM_GCONF_PATH, NULL); + client = gconf_client_get_default (); + value = gconf_client_get (client, ALARM_GCONF_PATH, NULL); - /* We want error cases to match full volume, not silence, so - we do not want to use gconf_client_get_int */ - if (!value || value->type != GCONF_VALUE_INT) - volume = 2; - else - volume = gconf_value_get_int(value); + /* We want error cases to match full volume, not silence, so + we do not want to use gconf_client_get_int */ + if (!value || value->type != GCONF_VALUE_INT) + volume = 2; + else + volume = gconf_value_get_int(value); - if (value) - gconf_value_free(value); - g_object_unref(client); + if (value) + gconf_value_free(value); + g_object_unref (client); - switch (volume) - { - case 0: - return; - case 1: - scale = 0x80; - break; - case 2: - default: - scale = 0xff; - break; - }; - - sock = esd_open_sound(NULL); - if (sock <= 0) - return; + switch (volume) + { + case 0: + return; + case 1: + scale = 0x80; + break; + case 2: + default: + scale = 0xff; + break; + }; - sample_id = esd_file_cache(sock, g_get_prgname(), sample); - if (sample_id < 0) { - close(sock); - return; - } - - esd_set_default_sample_pan(sock, sample_id, scale, scale); - esd_sample_play(sock, sample_id); - esd_sample_free(sock, sample_id); - close(sock); + sock = esd_open_sound (NULL); + if (sock <= 0) + return; + + sample_id = esd_file_cache (sock, g_get_prgname(), sample); + if (sample_id < 0) { + close(sock); + return; + } + + esd_set_default_sample_pan (sock, sample_id, scale, scale); + esd_sample_play(sock, sample_id); + esd_sample_free(sock, sample_id); + close (sock); } diff --git a/src/hildon-sound.h b/src/hildon-sound.h index bd47155..c66ff98 100644 --- a/src/hildon-sound.h +++ b/src/hildon-sound.h @@ -21,14 +21,17 @@ * 02110-1301 USA * */ -#ifndef __HILDON_SOUND_H__ -#define __HILDON_SOUND_H__ -#include +#ifndef __HILDON_SOUND_H__ +#define __HILDON_SOUND_H__ + +#include G_BEGIN_DECLS -void hildon_play_system_sound(const gchar *sample); +void +hildon_play_system_sound (const gchar *sample); G_END_DECLS -#endif /* __HILDON_SYSTEM_SOUND_H__ */ + +#endif /* __HILDON_SOUND_H__ */