gnome-session r4585 - in trunk: . gnome-session
- From: hadess svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-session r4585 - in trunk: . gnome-session
- Date: Thu, 28 Feb 2008 17:57:51 +0000 (GMT)
Author: hadess
Date: Thu Feb 28 17:57:51 2008
New Revision: 4585
URL: http://svn.gnome.org/viewvc/gnome-session?rev=4585&view=rev
Log:
2008-02-28 Bastien Nocera <hadess hadess net>
* configure.in: Remove hard requirement on esound,
as we use the gnome-sound APIs, and let the
gnome-settings-daemon launch the sound server
2008-02-28 Bastien Nocera <hadess hadess net>
* Makefile.am: Remove unneeded definition
* gsm-gsd.c (plugin_activated), (gsm_gsd_start): when the sound server
starts, play back the login sound if it's used
* gsm-sound.c (sound_init), (play_sound_event), (gsm_sound_logout):
* main.c (main): Let gnome-settings-daemon launch the sound server,
and as the sample are not loaded when we play back the login sound,
remove our own loading code and use libgnome sound APIs
(Closes: #466458)
Modified:
trunk/ChangeLog
trunk/configure.in
trunk/gnome-session/ChangeLog
trunk/gnome-session/Makefile.am
trunk/gnome-session/gsm-gsd.c
trunk/gnome-session/gsm-sound.c
trunk/gnome-session/main.c
Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in (original)
+++ trunk/configure.in Thu Feb 28 17:57:51 2008
@@ -51,7 +51,6 @@
AC_SUBST([DISABLE_DEPRECATED_CFLAGS])
fi
-ESOUND_REQUIRED=0.2.26
GLIB_REQUIRED=2.13.0
LIBGNOMEUI_REQUIRED=2.2.0
GTK_REQUIRED=2.11.1
@@ -62,40 +61,7 @@
PKG_PROG_PKG_CONFIG()
-dnl We first check for esound and audiofile (which has conditional
-dnl support built in)
-
-AC_MSG_CHECKING([whether ESounD support is requested])
-AC_ARG_ENABLE([esd],
- AS_HELP_STRING([--enable-esd],[Enable ESounD (default=yes)]),
- [enable_esd=$enableval],
- [enable_esd=yes])
-AC_MSG_RESULT([$enable_esd])
-
-if test x$enable_esd = xyes; then
- ESOUND_MODULE="esound >= $ESOUND_REQUIRED"
- PKG_CHECK_MODULES(ESOUND, $ESOUND_MODULE)
- AC_DEFINE(HAVE_ESD, 1, [Define if you have the ESound Daemon])
-
- ESDSERVERDIR=`$PKG_CONFIG --variable=esd_serverdir esound`
- old_path=$PATH
- if test x"$ESDSERVERDIR" != x; then
- PATH=$ESDSERVERDIR:$PATH
- fi
-
- AC_PATH_PROG(ESD_SERVER, esd, no)
- if test x"$ESD_SERVER" = xno; then
- AC_MSG_ERROR([esd executable not found in your path - should be installed with ESound])
- fi
-
- AC_SUBST(ESD_SERVER)
- PATH=$old_path
-
-else
- ESOUND_MODULE=""
-fi
-
-PKG_CHECK_MODULES(GNOME_SESSION, glib-2.0 >= $GLIB_REQUIRED gtk+-2.0 >= $GTK_REQUIRED libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED $ESOUND_MODULE dbus-glib-1 >= $DBUS_GLIB_REQUIRED gnome-settings-daemon gnome-keyring-1 >= $GNOME_KEYRING_REQUIRED)
+PKG_CHECK_MODULES(GNOME_SESSION, glib-2.0 >= $GLIB_REQUIRED gtk+-2.0 >= $GTK_REQUIRED libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED dbus-glib-1 >= $DBUS_GLIB_REQUIRED gnome-settings-daemon gnome-keyring-1 >= $GNOME_KEYRING_REQUIRED)
dnl Check if libnotify is present
Modified: trunk/gnome-session/Makefile.am
==============================================================================
--- trunk/gnome-session/Makefile.am (original)
+++ trunk/gnome-session/Makefile.am Thu Feb 28 17:57:51 2008
@@ -14,7 +14,6 @@
-DRSH_COMMAND=\""$(RSH_COMMAND)\"" \
-DGCONFTOOL_CMD=\""$(GCONFTOOL)\"" \
-DDEFAULTDIR="\"$(defaultdir)\"" \
- -DESD_SERVER="\"$(ESD_SERVER)\"" \
-DAT_SPI_REGISTRYD_DIR="\"$(AT_SPI_REGISTRYD_DIR)\"" \
-DTIME_UTILITY="\"$(TIME_UTILITY)\"" \
-DSYSCONFDIR=\""$(sysconfdir)"\"
Modified: trunk/gnome-session/gsm-gsd.c
==============================================================================
--- trunk/gnome-session/gsm-gsd.c (original)
+++ trunk/gnome-session/gsm-gsd.c Thu Feb 28 17:57:51 2008
@@ -1,9 +1,11 @@
#include <config.h>
#include "gsm-gsd.h"
+#include "gsm-sound.h"
#include "util.h"
#include <time.h>
+#include <string.h>
#include <glib/gi18n.h>
#include <dbus/dbus-glib-lowlevel.h>
@@ -111,6 +113,21 @@
}
}
+static void
+plugin_activated (DBusGProxy *proxy,
+ const char *name,
+ GnomeSettingsData *gsd)
+{
+ if (name == NULL || strcmp (name, "sound") != 0)
+ return;
+
+ /* Play the login sound when the session is activated */
+ gsm_sound_login ();
+
+ dbus_g_proxy_disconnect_signal(gsd->dbus_proxy, "PluginActivated",
+ G_CALLBACK(plugin_activated), gsd);
+}
+
void
gsm_gsd_start (void)
{
@@ -172,6 +189,20 @@
}
else
{
+ /* Connect to the signal before we wake the settings daemon
+ * up, otherwise, it might have the sound system ready before
+ * we're actually listening */
+ dbus_g_proxy_add_signal (gsd.dbus_proxy,
+ "PluginActivated",
+ G_TYPE_STRING,
+ G_TYPE_INVALID);
+
+ dbus_g_proxy_connect_signal (gsd.dbus_proxy,
+ "PluginActivated",
+ G_CALLBACK (plugin_activated),
+ &gsd,
+ NULL);
+
if (!org_gnome_SettingsDaemon_awake(gsd.dbus_proxy, &error))
{
/* Method failed, the GError is set, let's warn everyone */
@@ -199,6 +230,7 @@
G_CALLBACK (name_owner_changed),
&gsd,
NULL);
+
}
}
}
Modified: trunk/gnome-session/gsm-sound.c
==============================================================================
--- trunk/gnome-session/gsm-sound.c (original)
+++ trunk/gnome-session/gsm-sound.c Thu Feb 28 17:57:51 2008
@@ -4,9 +4,6 @@
#include <signal.h>
#include <unistd.h>
-#ifdef HAVE_ESD
-#include <esd.h>
-#endif
#include "util.h"
#include <libgnome/libgnome.h>
@@ -54,60 +51,6 @@
return retval;
}
-#ifdef HAVE_ESD
-static GPid esd_pid = 0;
-
-static void
-reset_esd_pid (GPid pid,
- gint status,
- gpointer ignore)
-{
- if (pid == esd_pid)
- esd_pid = 0;
-}
-
-static void
-start_esd (void)
-{
- gchar *argv[] = {ESD_SERVER, "-nobeeps", NULL};
- GError *err = NULL;
- time_t starttime;
-
- if (!gsm_exec_async (NULL, argv, NULL, &esd_pid, &err))
- {
- g_warning ("Could not start esd: %s\n", err->message);
- g_error_free (err);
- return;
- }
-
- g_child_watch_add (esd_pid, reset_esd_pid, NULL);
-
- starttime = time (NULL);
- gnome_sound_init (NULL);
-
- while (gnome_sound_connection_get () < 0
- && ((time (NULL) - starttime) < 4))
- {
- g_usleep (200);
- gnome_sound_init (NULL);
- }
-}
-
-static void
-stop_esd (void)
-{
- gnome_sound_shutdown ();
-
- if (esd_pid)
- {
- if (kill (esd_pid, SIGTERM) == -1)
- g_printerr ("Failed to kill esd (pid %d)\n", esd_pid);
- else
- esd_pid = 0;
- }
-}
-#endif /* HAVE_ESD */
-
static gboolean
sound_init (void)
{
@@ -115,103 +58,16 @@
if (!sound_enabled ())
return FALSE;
-#ifdef HAVE_ESD
- if (gnome_sound_connection_get () < 0)
- start_esd ();
-#endif
-
if (gnome_sound_connection_get () < 0)
- {
- g_warning ("Failed to start sound.\n");
- return FALSE;
- }
+ return FALSE;
return TRUE;
}
-static void
-sound_shutdown (void)
-{
-#ifdef HAVE_ESD
- stop_esd ();
-#endif
-}
-
-static char *
-get_filename_from_string (const char *string)
-{
- if (string[0] != '/')
- {
- return gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_SOUND, string,
- TRUE, NULL);
- }
-
- return g_strdup (string);
-}
-
-static char *
-get_filename_for_sound_from_keyfile (const char *name, const char *soundlist_file)
-{
- GKeyFile *keyfile;
- char *sound;
-
- keyfile = g_key_file_new ();
-
- if (g_key_file_load_from_file (keyfile, soundlist_file, G_KEY_FILE_NONE, NULL) == FALSE)
- {
- g_key_file_free (keyfile);
- return NULL;
- }
-
- sound = g_key_file_get_string (keyfile, name, "file", NULL);
- g_key_file_free (keyfile);
- if (sound != NULL)
- {
- char *res;
-
- res = get_filename_from_string (sound);
- if (res != NULL)
- {
- g_free (sound);
- return res;
- }
- }
- g_free (sound);
-
- return NULL;
-}
-
-static char *
-get_filename_for_sound (const char *name)
-{
- char *soundlist, *sound;
-
- /* Try to load the user configuration first */
- soundlist = g_build_filename (g_get_home_dir(), ".gnome2", "sound",
- "events", "gnome-2.soundlist", NULL);
- sound = get_filename_for_sound_from_keyfile (name, soundlist);
- g_free (soundlist);
- if (sound != NULL)
- return sound;
-
- soundlist = g_build_filename (SYSCONFDIR, "sound", "events", "gnome-2.soundlist", NULL);
- sound = get_filename_for_sound_from_keyfile (name, soundlist);
- g_free (soundlist);
-
- return sound;
-}
-
static void
play_sound_event (const char *name)
{
- char *sound;
-
- sound = get_filename_for_sound (name);
- if (sound != NULL)
- {
- gnome_sound_play (sound);
- g_free (sound);
- }
+ gnome_triggers_do (NULL, NULL, "gnome-2", name, NULL);
}
void
@@ -230,5 +86,6 @@
if (sound_events_enabled ())
play_sound_event ("logout");
- sound_shutdown ();
+ gnome_sound_shutdown ();
}
+
Modified: trunk/gnome-session/main.c
==============================================================================
--- trunk/gnome-session/main.c (original)
+++ trunk/gnome-session/main.c Thu Feb 28 17:57:51 2008
@@ -776,8 +776,6 @@
g_setenv ("GNOME_DESKTOP_SESSION_ID", session_name, TRUE);
the_session = read_session (session_name);
- gsm_sound_login ();
-
gsm_remote_desktop_start ();
if (splashing)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]