- Add patch to make login sounds work

- Remove unneeded patch to launch gnome-user-share, it launches using
    autostart now
This commit is contained in:
Bastien Nocera 2008-02-11 11:59:56 +00:00
parent 70b35f8cf0
commit 9a1bcfd516
3 changed files with 127 additions and 97 deletions

View File

@ -1,92 +0,0 @@
diff -up /dev/null gnome-session-2.21.5/gnome-session/gsm-user-share.h
--- /dev/null 2008-01-15 08:30:50.560008905 -0500
+++ gnome-session-2.21.5/gnome-session/gsm-user-share.h 2008-01-15 09:14:18.000000000 -0500
@@ -0,0 +1,6 @@
+#ifndef GSM_USER_SHARE_H
+#define GSM_USER_SHARE_H
+
+void gsm_user_share_start (void);
+
+#endif /* GSM_USER_SHARE_H */
diff -up gnome-session-2.21.5/gnome-session/Makefile.am.user-share gnome-session-2.21.5/gnome-session/Makefile.am
--- gnome-session-2.21.5/gnome-session/Makefile.am.user-share 2008-01-14 17:42:46.000000000 -0500
+++ gnome-session-2.21.5/gnome-session/Makefile.am 2008-01-15 09:14:18.000000000 -0500
@@ -23,6 +23,7 @@ STANDARD_PROPERTIES_CFLAGS =
-DPREFIX=\""$(prefix)"\" \
-DSYSCONFDIR=\""$(sysconfdir)"\" \
-DLIBDIR=\""$(libdir)"\" \
+ -DLIBEXECDIR=\""$(libexecdir)"\" \
-DDATADIR=\""$(datadir)"\" \
$(NULL)
@@ -82,6 +83,8 @@ gnome_session_SOURCES = \
gsm-dbus.h \
gsm-keyring.c \
gsm-keyring.h \
+ gsm-user-share.c \
+ gsm-user-share.h \
gsm-gsd.c \
gsm-gsd.h \
gsm-protocol.c \
diff -up /dev/null gnome-session-2.21.5/gnome-session/gsm-user-share.c
--- /dev/null 2008-01-15 08:30:50.560008905 -0500
+++ gnome-session-2.21.5/gnome-session/gsm-user-share.c 2008-01-15 09:14:18.000000000 -0500
@@ -0,0 +1,38 @@
+#include <config.h>
+
+#include <glib.h>
+#include <gconf/gconf-client.h>
+
+#include "gsm-user-share.h"
+
+#define FILE_SHARING_ENABLED "/desktop/gnome/file_sharing/enabled"
+
+void
+gsm_user_share_start (void)
+{
+ GConfClient *client;
+ gboolean enabled;
+ char *argv[2];
+ int i;
+
+ client = gconf_client_get_default ();
+ enabled = gconf_client_get_bool (client,
+ FILE_SHARING_ENABLED,
+ NULL);
+ g_object_unref (client);
+
+ if (enabled) {
+ i = 0;
+ argv[i++] = LIBEXECDIR"/gnome-user-share";
+ argv[i++] = NULL;
+
+ g_spawn_async (NULL,
+ argv,
+ NULL,
+ G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_STDERR_TO_DEV_NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+ }
+}
diff -up gnome-session-2.21.5/gnome-session/main.c.user-share gnome-session-2.21.5/gnome-session/main.c
--- gnome-session-2.21.5/gnome-session/main.c.user-share 2008-01-14 18:21:52.000000000 -0500
+++ gnome-session-2.21.5/gnome-session/main.c 2008-01-15 09:24:53.000000000 -0500
@@ -51,6 +51,7 @@
#include "gsm-sound.h"
#include "gsm-gsd.h"
#include "gsm-keyring.h"
+#include "gsm-user-share.h"
#include "gsm-at-startup.h"
#include "gsm-remote-desktop.h"
@@ -778,6 +779,8 @@ main (int argc, char *argv[])
gsm_sound_login ();
+ gsm_user_share_start ();
+
gsm_remote_desktop_start ();
if (splashing)

View File

@ -0,0 +1,116 @@
Index: gsm-sound.c
===================================================================
--- gsm-sound.c (revision 4557)
+++ gsm-sound.c (working copy)
@@ -9,8 +9,7 @@
#endif
#include "util.h"
-#include <libgnome/gnome-sound.h>
-#include <libgnome/gnome-triggers.h>
+#include <libgnome/libgnome.h>
#define ENABLE_SOUND_KEY "/desktop/gnome/sound/enable_esd"
#define ENABLE_EVENT_SOUNDS_KEY "/desktop/gnome/sound/event_sounds"
@@ -138,10 +137,81 @@
#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)
{
- gnome_triggers_do (NULL, NULL, "gnome-2", name, NULL);
+ char *sound;
+
+ sound = get_filename_for_sound (name);
+ if (sound != NULL)
+ {
+ gnome_sound_play (sound);
+ g_free (sound);
+ }
}
void
Index: Makefile.am
===================================================================
--- Makefile.am (revision 4557)
+++ Makefile.am (working copy)
@@ -16,12 +16,12 @@
-DDEFAULTDIR="\"$(defaultdir)\"" \
-DESD_SERVER="\"$(ESD_SERVER)\"" \
-DAT_SPI_REGISTRYD_DIR="\"$(AT_SPI_REGISTRYD_DIR)\"" \
- -DTIME_UTILITY="\"$(TIME_UTILITY)\""
+ -DTIME_UTILITY="\"$(TIME_UTILITY)\"" \
+ -DSYSCONFDIR=\""$(sysconfdir)"\"
# Used by the GNOME_PROGRAM_STANDARD_PROPERTIES macros
STANDARD_PROPERTIES_CFLAGS = \
-DPREFIX=\""$(prefix)"\" \
- -DSYSCONFDIR=\""$(sysconfdir)"\" \
-DLIBDIR=\""$(libdir)"\" \
-DDATADIR=\""$(datadir)"\" \
$(NULL)

View File

@ -12,7 +12,7 @@
Summary: GNOME session manager Summary: GNOME session manager
Name: gnome-session Name: gnome-session
Version: 2.21.90 Version: 2.21.90
Release: 1%{?dist} Release: 2%{?dist}
URL: http://www.gnome.org URL: http://www.gnome.org
Source0: http://download.gnome.org/sources/gnome-session/2.21/%{name}-%{version}.tar.bz2 Source0: http://download.gnome.org/sources/gnome-session/2.21/%{name}-%{version}.tar.bz2
Source1: redhat-default-session Source1: redhat-default-session
@ -41,9 +41,8 @@ Patch1: gnome-session-2.2.2-icons.patch
# Launch "esd" (really pulseaudio) all the time # Launch "esd" (really pulseaudio) all the time
Patch2: gnome-session-enable-sound-by-default.patch Patch2: gnome-session-enable-sound-by-default.patch
# http://bugzilla.gnome.org/show_bug.cgi?id=466458
# Launch gnome-user-share on login if enabled Patch3: gnome-session-play-login-sound-2.patch
Patch7: gnome-session-2.21.5-user-share.patch
# too much crashing # too much crashing
Patch9: gnome-session-2.13.4-no-crashes.patch Patch9: gnome-session-2.13.4-no-crashes.patch
@ -102,7 +101,9 @@ GNOME components and handles logout and saving the session.
%patch1 -p1 -b .icons %patch1 -p1 -b .icons
%patch2 -p0 -b .sound %patch2 -p0 -b .sound
%patch7 -p1 -b .user-share pushd gnome-session
%patch3 -p0 -b .login-sound
popd
%patch9 -p1 -b .no-crashes %patch9 -p1 -b .no-crashes
%patch13 -p1 -b .window-manager %patch13 -p1 -b .window-manager
%patch20 -p1 -b .timeout %patch20 -p1 -b .timeout
@ -192,6 +193,11 @@ fi
%doc %{_mandir}/man*/* %doc %{_mandir}/man*/*
%changelog %changelog
* Mon Feb 11 2008 - Bastien Nocera <bnocera@redhat.com> - 2.21.90-2
- Add patch to make login sounds work
- Remove unneeded patch to launch gnome-user-share, it launches
using autostart now
* Tue Jan 29 2008 Matthias Clasen <mclasen@redhat.com> - 2.21.90-1 * Tue Jan 29 2008 Matthias Clasen <mclasen@redhat.com> - 2.21.90-1
- Update to 2.21.90 - Update to 2.21.90