[gnome-panel] [panel] Port away from GnomeSound to canberra



commit cda17068f4d1ebb97dc6059f5d53a2de950a55af
Author: Vincent Untz <vuntz gnome org>
Date:   Tue Jan 12 19:48:30 2010 +0100

    [panel] Port away from GnomeSound to canberra
    
    Note that gnome-panel now requires libcanberra-gtk to compile.

 configure.in                          |    2 +-
 gnome-panel/gnome-desktop-item-edit.c |    3 +--
 gnome-panel/nothing.cP                |   32 ++++++++++++++++++--------------
 3 files changed, 20 insertions(+), 17 deletions(-)
---
diff --git a/configure.in b/configure.in
index bac276e..8660d09 100644
--- a/configure.in
+++ b/configure.in
@@ -71,7 +71,7 @@ GWEATHER_REQUIRED=2.27.90
 
 dnl pkg-config dependency checks
 
-PKG_CHECK_MODULES(PANEL, ORBit-2.0 >= $ORBIT_REQUIRED gdk-pixbuf-2.0 >= $GDK_PIXBUF_REQUIRED pango >= $PANGO_REQUIRED gtk+-2.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED gio-2.0 >= $GLIB_REQUIRED gio-unix-2.0 >= $GLIB_REQUIRED libgnome-2.0 >= $LIBGNOME_REQUIRED libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED libbonoboui-2.0 >= $LIBBONOBOUI_REQUIRED gnome-desktop-2.0 >= $LIBGNOME_DESKTOP_REQUIRED gconf-2.0 >= $GCONF_REQUIRED libgnome-menu >= $LIBGNOME_MENU_REQUIRED dbus-glib-1 >= $DBUS_GLIB_REQUIRED)
+PKG_CHECK_MODULES(PANEL, ORBit-2.0 >= $ORBIT_REQUIRED gdk-pixbuf-2.0 >= $GDK_PIXBUF_REQUIRED pango >= $PANGO_REQUIRED gtk+-2.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED gio-2.0 >= $GLIB_REQUIRED gio-unix-2.0 >= $GLIB_REQUIRED libgnome-2.0 >= $LIBGNOME_REQUIRED libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED libbonoboui-2.0 >= $LIBBONOBOUI_REQUIRED gnome-desktop-2.0 >= $LIBGNOME_DESKTOP_REQUIRED gconf-2.0 >= $GCONF_REQUIRED libgnome-menu >= $LIBGNOME_MENU_REQUIRED dbus-glib-1 >= $DBUS_GLIB_REQUIRED libcanberra-gtk)
 AC_SUBST(PANEL_CFLAGS)
 AC_SUBST(PANEL_LIBS)
 
diff --git a/gnome-panel/gnome-desktop-item-edit.c b/gnome-panel/gnome-desktop-item-edit.c
index 494aa9d..e08a10c 100644
--- a/gnome-panel/gnome-desktop-item-edit.c
+++ b/gnome-panel/gnome-desktop-item-edit.c
@@ -9,8 +9,7 @@
 
 #include "panel-ditem-editor.h"
 #include "panel-icon-names.h"
-
-#include "nothing.cP"
+#include "panel-util.h"
 
 /* FIXME Symbols needed by panel-util.c - sucky */
 #include "applet.h"
diff --git a/gnome-panel/nothing.cP b/gnome-panel/nothing.cP
index 3b08ae2..8b20a0d 100644
--- a/gnome-panel/nothing.cP
+++ b/gnome-panel/nothing.cP
@@ -5,8 +5,13 @@
 #include <X11/Xlib.h>
 #include <cairo.h>
 #include <gdk/gdkkeysyms.h>
-#include <libgnome/gnome-program.h>
-#include <libgnome/gnome-sound.h>
+#include <canberra-gtk.h>
+
+#ifdef CA_CHECK_VERSION
+#if CA_CHECK_VERSION(0, 13)
+#define HAVE_CANBERRA_GTK_MULTIHEAD_SAFE
+#endif
+#endif
 
 #include "panel-util.h"
 #include "nothing.h"
@@ -46,8 +51,6 @@ static int goat_timeout = 0;
 static int goat_x = -1, goat_y = -1;
 static int goat_accx = -1, goat_accy = -1;
 
-static char *goat_filename = NULL;
-
 static void
 destroy_egg(GtkWidget *widget, gpointer data)
 {
@@ -123,8 +126,17 @@ goat_timeout_func(gpointer data)
 		sound = TRUE;
 	}
 
-	if (sound && goat_filename != NULL)
-		gnome_sound_play (goat_filename);
+	if (sound) {
+#ifdef HAVE_CANBERRA_GTK_MULTIHEAD_SAFE
+		ca_context_cancel (ca_gtk_context_get_for_screen (gtk_widget_get_screen (goat_darea)), 42);
+#else
+		ca_context_cancel (ca_gtk_context_get (), 42);
+#endif
+		ca_gtk_play_for_widget (goat_darea, 42,
+					CA_PROP_EVENT_ID, "bell-window-system",
+					CA_PROP_EVENT_DESCRIPTION, "Ouch! This box is small!",
+					NULL);
+	}
 
 	real_goat_frame = goat_frame/2;
 
@@ -256,14 +268,6 @@ config_event(GtkWidget *widget,GdkEvent *event,GtkNotebook *nbook)
 	clicks = 0;
 	
 	if(!goat_loaded) {
-		if (goat_filename == NULL)
-			goat_filename =
-				gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_SOUND, 
-							   /* FIXME "ricochet.wav", */
-							   "gnometris/turn.wav",
-							   TRUE /* only_if_exists */,
-							   NULL /* ret_locations */);
-
 		goat_darea = gtk_drawing_area_new();
 
 		g_signal_connect (G_OBJECT(goat_darea),"destroy",



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]