phonemgr r329 - in trunk: . data src



Author: hadess
Date: Wed Feb  4 16:23:01 2009
New Revision: 329
URL: http://svn.gnome.org/viewvc/phonemgr?rev=329&view=rev

Log:
2009-02-04  Bastien Nocera  <hadess hadess net>

	* configure.in:
	* data/Makefile.am:
	* src/app.h:
	* src/main.c (main):
	* src/ui.c (idle_play_alert): Code removal galore, use
	libcanberra to play back sounds instead of GStreamer
	(Closes: #558285)



Removed:
   trunk/data/alert.wav
Modified:
   trunk/ChangeLog
   trunk/configure.in
   trunk/data/Makefile.am
   trunk/src/app.h
   trunk/src/main.c
   trunk/src/ui.c

Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in	(original)
+++ trunk/configure.in	Wed Feb  4 16:23:01 2009
@@ -46,7 +46,7 @@
 PKG_CHECK_MODULES(LIBGSM, glib-2.0 gobject-2.0 $GNOKII_REQS gthread-2.0 bluez $evo_pc_file)
 
 PKG_CHECK_MODULES(PHONEMGR, gtk+-2.0 >= 2.10 glib-2.0 >= 2.13.0
-	gstreamer-0.10 gdk-pixbuf-2.0 gconf-2.0
+	libcanberra-gtk gdk-pixbuf-2.0 gconf-2.0
 	$GNOME_BLUETOOTH_REQS libglade-2.0 $evo_pc_file
 	gmodule-2.0 dbus-glib-1 gnome-icon-theme >= 2.19.1
 	gtkspell-2.0

Modified: trunk/data/Makefile.am
==============================================================================
--- trunk/data/Makefile.am	(original)
+++ trunk/data/Makefile.am	Wed Feb  4 16:23:01 2009
@@ -6,9 +6,6 @@
 uidir = $(pkgdatadir)
 ui_DATA = phonemgr.glade
 
-sounddir = $(datadir)/$(PACKAGE)
-sound_DATA = alert.wav
-
 schema_in_files = gnome-phone-manager.schemas.in
 schemadir = $(GCONF_SCHEMA_FILE_DIR)
 schema_DATA = $(schema_in_files:.schemas.in=.schemas)
@@ -37,5 +34,5 @@
 	fi
 
 CLEANFILES = $(schema_DATA)
-EXTRA_DIST = $(ui_DATA) $(sound_DATA) $(schema_in_files) $(man_MANS)
+EXTRA_DIST = $(ui_DATA) $(schema_in_files) $(man_MANS)
 

Modified: trunk/src/app.h
==============================================================================
--- trunk/src/app.h	(original)
+++ trunk/src/app.h	Wed Feb  4 16:23:01 2009
@@ -25,7 +25,6 @@
 #include <gtk/gtk.h>
 #include <glade/glade.h>
 #include <gconf/gconf-client.h>
-#include <gst/gst.h>
 #include <gnomebt-controller.h>
 
 #include "phonemgr-listener.h"
@@ -45,7 +44,6 @@
 	GConfClient *client;
 	PhonemgrListener    *listener;
 	PhonemgrObject      *object;
-	GstElement *playbin;
 
 	/* connection state */
 	char   *devname;

Modified: trunk/src/main.c
==============================================================================
--- trunk/src/main.c	(original)
+++ trunk/src/main.c	Wed Feb  4 16:23:01 2009
@@ -61,7 +61,6 @@
 	g_option_context_set_translation_domain(context, GETTEXT_PACKAGE);
 
 	g_option_context_add_group (context, gtk_get_option_group (TRUE));
-	g_option_context_add_group (context, gst_init_get_option_group ());
 	if (g_option_context_parse (context, &argc, &argv, &error) == FALSE) {
 		g_error ("Couldn't parse options: %s", error->message);
 		g_error_free (error);
@@ -109,8 +108,6 @@
 	g_object_unref (app->listener);
 	g_object_unref (app->client);
 	g_object_unref (app->object);
-	if (app->playbin)
-		g_object_unref (app->playbin);
 
 	return 0;
 }

Modified: trunk/src/ui.c
==============================================================================
--- trunk/src/ui.c	(original)
+++ trunk/src/ui.c	Wed Feb  4 16:23:01 2009
@@ -24,6 +24,7 @@
 #include <glade/glade.h>
 #include <gtk/gtk.h>
 #include <gtkspell/gtkspell.h>
+#include <canberra-gtk.h>
 #include <time.h>
 #include <string.h>
 
@@ -127,48 +128,16 @@
 	return ui;
 }
 
-static void
-play_sound (MyApp *app, const char *filename)
-{
-	GstElement *audio_sink;
-	char *uri;
-
-	/* Setup the playbin */
-	if (app->playbin == NULL) {
-		audio_sink = gst_element_factory_make ("gconfaudiosink", "audio-sink");
-		if (audio_sink == NULL)
-			audio_sink = gst_element_factory_make ("autoaudiosink", "audio-sink");
-		if (audio_sink == NULL) {
-			g_warning ("Couldn't create audio sink");
-			return;
-		}
-		if (g_object_class_find_property (G_OBJECT_GET_CLASS (audio_sink), "profile"))
-			g_object_set (G_OBJECT (audio_sink), "profile", 0, NULL);
-		app->playbin = gst_element_factory_make ("playbin", "play");
-		g_object_set (app->playbin, "audio-sink", audio_sink, NULL);
-	}
-
-	/* Play the file */
-	uri = g_filename_to_uri (filename, NULL, NULL);
-	gst_element_set_state (app->playbin, GST_STATE_NULL);
-	g_object_set (G_OBJECT (app->playbin), "uri", uri, NULL);
-	gst_element_set_state (app->playbin, GST_STATE_PLAYING);
-	g_free (uri);
-}
-
 static gboolean
 idle_play_alert (MyApp *app)
 {
-	char *fname;
-
 	if (gconf_client_get_bool (app->client, CONFBASE"/sound_alert", NULL)) {
-		fname = g_build_filename (DATA_DIR, "alert.wav", NULL);
-		if (fname) {
-			play_sound (app, fname);
-			g_free (fname);
-		} else {
-			g_warning ("Couldn't find sound file %s", fname);
-		}
+		ca_context *ctx;
+		ctx = ca_gtk_context_get ();
+		ca_context_play (ctx, 0,
+				 CA_PROP_EVENT_ID, "message-new-instant",
+				 CA_PROP_EVENT_DESCRIPTION, _("New text message received"),
+				 NULL);
 	}
 	return FALSE;
 }



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