[gnome-color-manager] Play sounds using libcanberra when user interaction is required
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-color-manager] Play sounds using libcanberra when user interaction is required
- Date: Mon, 22 Feb 2010 14:42:26 +0000 (UTC)
commit 82b409e68316d9061f0a76e3e21442695e1b6075
Author: Richard Hughes <richard hughsie com>
Date: Mon Feb 22 14:41:49 2010 +0000
Play sounds using libcanberra when user interaction is required
configure.ac | 5 +++++
contrib/gnome-color-manager.spec.in | 2 ++
src/Makefile.am | 2 ++
src/gcm-calibrate-argyll.c | 29 +++++++++++++++++++++++++++++
src/gcm-prefs.c | 32 ++++++++++++++++++++++++++++++++
5 files changed, 70 insertions(+), 0 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 35a4b0a..c6c15cc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -105,6 +105,7 @@ GCONF_REQUIRED=0.22
UNIQUE_REQUIRED=1.0.0
VTE_REQUIRED=0.22.2
DBUS_GLIB_REQUIRED=0.73
+CANBERRA_REQUIRED=0.10
dnl ---------------------------------------------------------------------------
dnl - Check library dependencies
@@ -155,6 +156,10 @@ PKG_CHECK_MODULES(X11, x11)
AC_SUBST(X11_CFLAGS)
AC_SUBST(X11_LIBS)
+PKG_CHECK_MODULES(CANBERRA, libcanberra-gtk >= $CANBERRA_REQUIRED)
+AC_SUBST(CANBERRA_CFLAGS)
+AC_SUBST(CANBERRA_LIBS)
+
AC_CHECK_LIB(tiff, TIFFReadRGBAImageOriented,
TIFF_CFLAGS=""
TIFF_LIBS="-ltiff"
diff --git a/contrib/gnome-color-manager.spec.in b/contrib/gnome-color-manager.spec.in
index cbcbd5e..4b7e847 100644
--- a/contrib/gnome-color-manager.spec.in
+++ b/contrib/gnome-color-manager.spec.in
@@ -28,6 +28,7 @@ Requires: cups
Requires: polkit
Requires: PackageKit
Requires: shared-color-profiles
+Requires: libcanberra >= %{libcanberra_version}
Requires(post): scrollkeeper
Requires(pre): GConf2
Requires(post): GConf2
@@ -52,6 +53,7 @@ BuildRequires: gnome-desktop-devel
BuildRequires: lcms-devel
BuildRequires: cups-devel
BuildRequires: libtiff-devel
+BuildRequires: libcanberra-devel >= %{libcanberra_version}
%description
gnome-color-manager is a session framework that makes it easy to manage, install
diff --git a/src/Makefile.am b/src/Makefile.am
index 31a3fbe..9d712ba 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -10,6 +10,7 @@ INCLUDES = \
$(XORG_CFLAGS) \
$(CUPS_CFLAGS) \
$(TIFF_CFLAGS) \
+ $(CANBERRA_CFLAGS) \
$(DBUS_GLIB_CFLAGS) \
-DG_UDEV_API_IS_SUBJECT_TO_CHANGE \
-DGNOME_DESKTOP_USE_UNSTABLE_API \
@@ -240,6 +241,7 @@ gcm_prefs_LDADD = \
$(GTK_LIBS) \
$(CUPS_LIBS) \
$(TIFF_LIBS) \
+ $(CANBERRA_LIBS) \
-lm
gcm_prefs_CFLAGS = \
diff --git a/src/gcm-calibrate-argyll.c b/src/gcm-calibrate-argyll.c
index cede66c..aff40ef 100644
--- a/src/gcm-calibrate-argyll.c
+++ b/src/gcm-calibrate-argyll.c
@@ -37,6 +37,7 @@
#include <gtk/gtk.h>
#include <vte/vte.h>
#include <gconf/gconf-client.h>
+#include <canberra-gtk.h>
#include "gcm-calibrate-argyll.h"
#include "gcm-colorimeter.h"
@@ -1326,6 +1327,13 @@ gcm_calibrate_argyll_process_output_cmd (GcmCalibrateArgyll *calibrate_argyll, c
/* set state */
priv->state = GCM_CALIBRATE_ARGYLL_STATE_WAITING_FOR_STDIN,
+ /* play sound from the naming spec */
+ ca_context_play (ca_gtk_context_get (), 0,
+ CA_PROP_EVENT_ID, "dialog-information",
+ /* TRANSLATORS: this is the application name for libcanberra */
+ CA_PROP_APPLICATION_NAME, _("GNOME Color Manager"),
+ CA_PROP_EVENT_DESCRIPTION, message, NULL);
+
/* save as we know the device is on the screen now */
priv->already_on_window = TRUE;
goto out;
@@ -1358,6 +1366,13 @@ gcm_calibrate_argyll_process_output_cmd (GcmCalibrateArgyll *calibrate_argyll, c
gcm_calibrate_dialog_set_image_filename (priv->calibrate_dialog, filename);
gcm_calibrate_dialog_set_show_expander (priv->calibrate_dialog, TRUE);
+ /* play sound from the naming spec */
+ ca_context_play (ca_gtk_context_get (), 0,
+ CA_PROP_EVENT_ID, "dialog-information",
+ /* TRANSLATORS: this is the application name for libcanberra */
+ CA_PROP_APPLICATION_NAME, _("GNOME Color Manager"),
+ CA_PROP_EVENT_DESCRIPTION, message, NULL);
+
/* set state */
priv->state = GCM_CALIBRATE_ARGYLL_STATE_WAITING_FOR_STDIN;
goto out;
@@ -1390,6 +1405,13 @@ gcm_calibrate_argyll_process_output_cmd (GcmCalibrateArgyll *calibrate_argyll, c
gcm_calibrate_dialog_set_image_filename (priv->calibrate_dialog, filename);
gcm_calibrate_dialog_set_show_expander (priv->calibrate_dialog, TRUE);
+ /* play sound from the naming spec */
+ ca_context_play (ca_gtk_context_get (), 0,
+ CA_PROP_EVENT_ID, "dialog-information",
+ /* TRANSLATORS: this is the application name for libcanberra */
+ CA_PROP_APPLICATION_NAME, _("GNOME Color Manager"),
+ CA_PROP_EVENT_DESCRIPTION, message, NULL);
+
/* set state */
priv->state = GCM_CALIBRATE_ARGYLL_STATE_WAITING_FOR_STDIN;
goto out;
@@ -1441,6 +1463,13 @@ gcm_calibrate_argyll_process_output_cmd (GcmCalibrateArgyll *calibrate_argyll, c
/* set state */
priv->state = GCM_CALIBRATE_ARGYLL_STATE_WAITING_FOR_LOOP;
+ /* play sound from the naming spec */
+ ca_context_play (ca_gtk_context_get (), 0,
+ CA_PROP_EVENT_ID, "dialog-warning",
+ /* TRANSLATORS: this is the application name for libcanberra */
+ CA_PROP_APPLICATION_NAME, _("GNOME Color Manager"),
+ CA_PROP_EVENT_DESCRIPTION, message, NULL);
+
/* wait until finished */
g_main_loop_run (priv->loop);
goto out;
diff --git a/src/gcm-prefs.c b/src/gcm-prefs.c
index e3b045d..2730ed4 100644
--- a/src/gcm-prefs.c
+++ b/src/gcm-prefs.c
@@ -30,6 +30,7 @@
#include <libgnomeui/gnome-rr.h>
#include <gconf/gconf-client.h>
#include <locale.h>
+#include <canberra-gtk.h>
#include "egg-debug.h"
@@ -793,6 +794,14 @@ gcm_prefs_calibrate_cb (GtkWidget *widget, gpointer data)
/* remove temporary file */
g_unlink (filename);
+
+ /* play sound from the naming spec */
+ ca_context_play (ca_gtk_context_get (), 0,
+ CA_PROP_EVENT_ID, "complete",
+ /* TRANSLATORS: this is the application name for libcanberra */
+ CA_PROP_APPLICATION_NAME, _("GNOME Color Manager"),
+ /* TRANSLATORS: this is the sound description */
+ CA_PROP_EVENT_DESCRIPTION, _("Calibration completed"), NULL);
out:
g_free (filename);
g_free (destination);
@@ -1900,6 +1909,29 @@ out:
static void
gcm_prefs_colorimeter_changed_cb (GcmColorimeter *_colorimeter, gpointer user_data)
{
+ gboolean present;
+ const gchar *event_id;
+ const gchar *message;
+
+ present = gcm_colorimeter_get_present (_colorimeter);
+
+ if (present) {
+ /* TRANSLATORS: this is a sound description */
+ message = _("Device added");
+ event_id = "device-added";
+ } else {
+ /* TRANSLATORS: this is a sound description */
+ message = _("Device removed");
+ event_id = "device-removed";
+ }
+
+ /* play sound from the naming spec */
+ ca_context_play (ca_gtk_context_get (), 0,
+ CA_PROP_EVENT_ID, event_id,
+ /* TRANSLATORS: this is the application name for libcanberra */
+ CA_PROP_APPLICATION_NAME, _("GNOME Color Manager"),
+ CA_PROP_EVENT_DESCRIPTION, message, NULL);
+
gcm_prefs_set_calibrate_button_sensitivity ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]