2008-02-21 01:52:50 +01:00
|
|
|
Index: gnome-session/gsm-sound.c
|
|
|
|
===================================================================
|
|
|
|
--- gnome-session/gsm-sound.c.orig
|
2007-09-10 12:19:33 +02:00
|
|
|
+++ gnome-session/gsm-sound.c
|
2008-02-21 01:52:50 +01:00
|
|
|
@@ -10,6 +10,8 @@
|
|
|
|
#include "util.h"
|
2007-09-10 12:19:33 +02:00
|
|
|
|
2008-02-21 01:52:50 +01:00
|
|
|
#include <libgnome/libgnome.h>
|
2007-09-10 12:19:33 +02:00
|
|
|
+#include <libgnome/gnome-util.h>
|
|
|
|
+#include <libgnome/gnome-config.h>
|
|
|
|
|
|
|
|
#define ENABLE_SOUND_KEY "/desktop/gnome/sound/enable_esd"
|
|
|
|
#define ENABLE_EVENT_SOUNDS_KEY "/desktop/gnome/sound/event_sounds"
|
2008-02-21 01:52:50 +01:00
|
|
|
@@ -69,7 +71,7 @@ reset_esd_pid (GPid pid,
|
2007-09-10 12:19:33 +02:00
|
|
|
static void
|
|
|
|
start_esd (void)
|
|
|
|
{
|
|
|
|
- gchar *argv[] = {ESD_SERVER, "-nobeeps", NULL};
|
|
|
|
+ gchar *argv[] = {ESD_SERVER, "-terminate", "-nobeeps", NULL};
|
|
|
|
GError *err = NULL;
|
|
|
|
time_t starttime;
|
|
|
|
|
2008-02-21 01:52:50 +01:00
|
|
|
@@ -93,6 +95,81 @@ start_esd (void)
|
2007-09-10 12:19:33 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+static gboolean
|
|
|
|
+load_login_sample_from (const char *file,
|
|
|
|
+ gboolean *isset)
|
|
|
|
+{
|
|
|
|
+ char *key;
|
|
|
|
+ char *sample_file;
|
|
|
|
+ int sample_id;
|
|
|
|
+
|
|
|
|
+ if (!file)
|
|
|
|
+ return FALSE;
|
|
|
|
+
|
|
|
|
+ key = g_strconcat ("=", file, "=login/file", NULL);
|
|
|
|
+ sample_file = gnome_config_get_string (key);
|
|
|
|
+ g_free (key);
|
|
|
|
+
|
|
|
|
+ if (sample_file && isset)
|
|
|
|
+ *isset = TRUE;
|
|
|
|
+ else if (isset)
|
|
|
|
+ *isset = FALSE;
|
|
|
|
+
|
|
|
|
+ if (sample_file && *sample_file && *sample_file != '/')
|
|
|
|
+ {
|
|
|
|
+ char *tmp_sample_file;
|
|
|
|
+ tmp_sample_file = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_SOUND, sample_file, TRUE, NULL);
|
|
|
|
+ g_free (sample_file);
|
|
|
|
+ sample_file = tmp_sample_file;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!(sample_file && *sample_file))
|
|
|
|
+ {
|
|
|
|
+ g_free (sample_file);
|
|
|
|
+ return FALSE;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ sample_id = esd_sample_getid (gnome_sound_connection_get (), "gnome-2/login");
|
|
|
|
+ if (sample_id >= 0)
|
|
|
|
+ esd_sample_free (gnome_sound_connection_get (), sample_id);
|
|
|
|
+
|
|
|
|
+ sample_id = gnome_sound_sample_load ("gnome-2/login", sample_file);
|
|
|
|
+
|
|
|
|
+ if (sample_id < 0)
|
|
|
|
+ {
|
|
|
|
+ g_warning ("Couldn't load sound file %s\n", sample_file);
|
|
|
|
+ return FALSE;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ g_free (sample_file);
|
|
|
|
+
|
|
|
|
+ return TRUE;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+#define SOUND_EVENT_FILE "sound/events/gnome-2.soundlist"
|
|
|
|
+ static gboolean
|
|
|
|
+load_login_sample (void)
|
|
|
|
+{
|
|
|
|
+ char *s;
|
|
|
|
+ gboolean loaded;
|
|
|
|
+ gboolean isset;
|
|
|
|
+
|
|
|
|
+ s = gnome_util_home_file (SOUND_EVENT_FILE);
|
|
|
|
+ loaded = load_login_sample_from (s, &isset);
|
|
|
|
+ g_free (s);
|
|
|
|
+
|
|
|
|
+ if (isset)
|
|
|
|
+ return loaded;
|
|
|
|
+
|
|
|
|
+ s = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_CONFIG, SOUND_EVENT_FILE, TRUE, NULL);
|
|
|
|
+ loaded = load_login_sample_from (s, NULL);
|
|
|
|
+ g_free (s);
|
|
|
|
+
|
|
|
|
+ return loaded;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
static void
|
|
|
|
stop_esd (void)
|
|
|
|
{
|
2008-02-21 01:52:50 +01:00
|
|
|
@@ -126,7 +203,7 @@ sound_init (void)
|
2007-09-10 12:19:33 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
- return TRUE;
|
|
|
|
+ return load_login_sample();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2008-02-21 01:52:50 +01:00
|
|
|
@@ -229,6 +306,4 @@ gsm_sound_logout (void)
|
2007-09-10 12:19:33 +02:00
|
|
|
{
|
|
|
|
if (sound_events_enabled ())
|
|
|
|
play_sound_event ("logout");
|
|
|
|
-
|
|
|
|
- sound_shutdown ();
|
|
|
|
}
|