diff options
Diffstat (limited to 'utils')
-rw-r--r-- | utils/Makefile.am | 2 | ||||
-rw-r--r-- | utils/gdm-screenshot.c | 53 |
2 files changed, 55 insertions, 0 deletions
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); |