Commit 75cd827c authored by William Jon McCann's avatar William Jon McCann

Add screen capture sound effect to screenshot tool

parent a5794429
......@@ -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
)
......
......@@ -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)
......
......@@ -28,6 +28,7 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <canberra-gtk.h>
#include <X11/Xatom.h>
#include <gdk/gdkx.h>
......@@ -187,6 +188,56 @@ screenshot_save (GdkPixbuf *pixbuf)
return filename;
}
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)
{
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment