summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac7
-rw-r--r--utils/Makefile.am2
-rw-r--r--utils/gdm-screenshot.c53
3 files changed, 62 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 44705573..e04025e6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -48,6 +48,7 @@ SCROLLKEEPER_REQUIRED_VERSION=0.1.4
GCONF_REQUIRED_VERSION=2.6.1
GNOME_PANEL_REQUIRED_VERSION=2.0.0
LIBXKLAVIER_REQUIRED_VERSION=4.0
+LIBCANBERRA_GTK_REQUIRED_VERSION=0.4
#FONTCONFIG_REQUIRED_VERSION=2.6.0
FONTCONFIG_REQUIRED_VERSION=2.5.0
@@ -89,6 +90,12 @@ PKG_CHECK_MODULES(GTK,
AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LIBS)
+PKG_CHECK_MODULES(CANBERRA_GTK,
+ libcanberra-gtk >= $LIBCANBERRA_GTK_REQUIRED_VERSION
+)
+AC_SUBST(GCONF_CFLAGS)
+AC_SUBST(GCONF_LIBS)
+
PKG_CHECK_MODULES(GCONF,
gconf-2.0 >= $GCONF_REQUIRED_VERSION
)
diff --git a/utils/Makefile.am b/utils/Makefile.am
index 7b90beb9..0b6ea049 100644
--- a/utils/Makefile.am
+++ b/utils/Makefile.am
@@ -6,6 +6,7 @@ AM_CPPFLAGS = \
-DLOCALSTATEDIR=\""$(localstatedir)"\" \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
$(UTILS_CFLAGS) \
+ $(CANBERRA_GTK_CFLAGS) \
$(GTK_CFLAGS) \
$(COMMON_CFLAGS) \
$(NULL)
@@ -49,6 +50,7 @@ gdm_screenshot_SOURCES = \
gdm_screenshot_LDADD = \
$(GTK_LIBS) \
+ $(CANBERRA_GTK_LIBS) \
$(COMMON_LIBS) \
$(NULL)
diff --git a/utils/gdm-screenshot.c b/utils/gdm-screenshot.c
index ac01727c..f66de460 100644
--- a/utils/gdm-screenshot.c
+++ b/utils/gdm-screenshot.c
@@ -28,6 +28,7 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
+#include <canberra-gtk.h>
#include <X11/Xatom.h>
#include <gdk/gdkx.h>
@@ -188,6 +189,56 @@ screenshot_save (GdkPixbuf *pixbuf)
}
static void
+sound_effect_finished (ca_context *c,
+ uint32_t id,
+ int error_code,
+ void *userdata)
+{
+}
+
+static void
+play_sound_effect (Window xid)
+{
+ ca_context *c;
+ ca_proplist *p;
+ int res;
+
+ c = ca_gtk_context_get ();
+
+ p = NULL;
+ res = ca_proplist_create (&p);
+ if (res < 0) {
+ goto done;
+ }
+
+ res = ca_proplist_sets (p, CA_PROP_EVENT_ID, "screen-capture");
+ if (res < 0) {
+ goto done;
+ }
+
+ res = ca_proplist_sets (p, CA_PROP_EVENT_DESCRIPTION, _("Screenshot taken"));
+ if (res < 0) {
+ goto done;
+ }
+
+ res = ca_proplist_setf (p,
+ CA_PROP_WINDOW_X11_XID,
+ "%lu",
+ (unsigned long) xid);
+ if (res < 0) {
+ goto done;
+ }
+
+ ca_context_play_full (c, 0, p, sound_effect_finished, NULL);
+
+ done:
+ if (p != NULL) {
+ ca_proplist_destroy (p);
+ }
+
+}
+
+static void
prepare_screenshot (void)
{
Window win;
@@ -209,6 +260,8 @@ prepare_screenshot (void)
exit (1);
}
+ play_sound_effect (win);
+
filename = screenshot_save (screenshot);
if (filename != NULL) {
g_print ("Wrote %s\n", filename);