summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrion Vibber <bvibber@wikimedia.org>2019-10-30 12:11:44 -0700
committerAlexander Mikhaylenko <alexm@gnome.org>2021-02-11 18:52:46 +0000
commit74e0c35f56cc3d04f0e82a3d979520f21ff581b4 (patch)
treeb04ceccffb3cf43ef9b277066a0159a6d591b965
parent55f2278263552dc2a24a8b54f9e4cea188182e29 (diff)
downloadgnome-screenshot-74e0c35f56cc3d04f0e82a3d979520f21ff581b4.tar.gz
Move the screenshot sound effects to gnome-shell
Companion patches: * gnome-shell https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1658 * g-s-d https://gitlab.gnome.org/GNOME/gnome-settings-daemon/-/merge_requests/223 Since it can take some time to compress a PNG image, at very high resolutions there was a noticeable delay before the audiovisual feedback on screenshots. To keep from complicating the interface for the shell screenshot service, moving the sound effects into the service (which already did the visual effects) so it can trigger them after capture and before compression. Note this removes the canberra dependency for gnome-screenshot.
-rw-r--r--README.md1
-rw-r--r--meson.build1
-rw-r--r--org.gnome.Screenshot.json22
-rw-r--r--src/meson.build3
-rw-r--r--src/screenshot-application.c8
-rw-r--r--src/screenshot-utils.c34
-rw-r--r--src/screenshot-utils.h2
7 files changed, 1 insertions, 70 deletions
diff --git a/README.md b/README.md
index 4c9917f..5f13d49 100644
--- a/README.md
+++ b/README.md
@@ -8,5 +8,4 @@ desktop; the currently focused window; or an area of the screen.
- GLib 2.36
- GTK+ 3.12
- - libcanberra-gtk3
- X11
diff --git a/meson.build b/meson.build
index 4ad282d..6029e40 100644
--- a/meson.build
+++ b/meson.build
@@ -39,7 +39,6 @@ xext_dep = dependency('xext', required: get_option ('x11'))
glib_dep = dependency('glib-2.0', version: glib_req_version)
gtk_dep = dependency('gtk+-3.0', version: gtk_req_version)
libhandy_dep = dependency('libhandy-1', version: libhandy_req_version)
-canberra_dep = dependency('libcanberra-gtk3')
config_h = configuration_data()
config_h.set_quoted('VERSION', meson.project_version())
diff --git a/org.gnome.Screenshot.json b/org.gnome.Screenshot.json
index c133fd9..c560f6b 100644
--- a/org.gnome.Screenshot.json
+++ b/org.gnome.Screenshot.json
@@ -29,28 +29,6 @@
],
"modules" : [
{
- "name" : "libcanberra-gtk3",
- "cleanup" : [
- "/bin",
- "/lib/gnome-settings-daemon-3.0",
- "/share/doc",
- "/share/gdm",
- "/share/gnome"
- ],
- "config-opts" : [
- "--disable-alsa",
- "--disable-null",
- "--disable-oss"
- ],
- "sources" : [
- {
- "type" : "archive",
- "url" : "http://0pointer.de/lennart/projects/libcanberra/libcanberra-0.30.tar.xz",
- "sha256" : "c2b671e67e0c288a69fc33dc1b6f1b534d07882c2aceed37004bf48c601afa72"
- }
- ]
- },
- {
"name" : "libhandy",
"buildsystem" : "meson",
"config-opts" : [
diff --git a/src/meson.build b/src/meson.build
index 5c014a2..f07eccc 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -26,8 +26,7 @@ dependencies = [
xext_dep,
glib_dep,
gtk_dep,
- libhandy_dep,
- canberra_dep
+ libhandy_dep
]
c_args = [
diff --git a/src/screenshot-application.c b/src/screenshot-application.c
index 4cc64c8..ccc5eac 100644
--- a/src/screenshot-application.c
+++ b/src/screenshot-application.c
@@ -175,7 +175,6 @@ save_pixbuf_handle_error (ScreenshotApplication *self,
else
{
g_critical ("Unable to save the screenshot: %s", error->message);
- screenshot_play_sound_effect ("dialog-error", _("Unable to capture a screenshot"));
g_application_release (G_APPLICATION (self));
if (screenshot_config->file != NULL)
exit (EXIT_FAILURE);
@@ -429,7 +428,6 @@ build_filename_ready_cb (GObject *source,
_("Error creating file"));
else
{
- screenshot_play_sound_effect ("dialog-error", _("Unable to capture a screenshot"));
if (screenshot_config->file != NULL)
exit (EXIT_FAILURE);
}
@@ -437,8 +435,6 @@ build_filename_ready_cb (GObject *source,
return;
}
- screenshot_play_sound_effect ("screen-capture", _("Screenshot taken"));
-
if (screenshot_config->interactive)
{
self->dialog = screenshot_dialog_new (GTK_APPLICATION (self),
@@ -473,8 +469,6 @@ finish_take_screenshot (ScreenshotApplication *self)
GTK_BUTTONS_OK,
_("Unable to capture a screenshot"),
_("All possible methods failed"));
- else
- screenshot_play_sound_effect ("dialog-error", _("Unable to capture a screenshot"));
g_application_release (G_APPLICATION (self));
if (screenshot_config->file != NULL)
@@ -488,8 +482,6 @@ finish_take_screenshot (ScreenshotApplication *self)
if (screenshot_config->copy_to_clipboard)
{
screenshot_save_to_clipboard (self);
- screenshot_play_sound_effect ("screen-capture", _("Screenshot taken"));
-
if (screenshot_config->file == NULL)
{
g_application_release (G_APPLICATION (self));
diff --git a/src/screenshot-utils.c b/src/screenshot-utils.c
index 9b87cad..906aace 100644
--- a/src/screenshot-utils.c
+++ b/src/screenshot-utils.c
@@ -25,7 +25,6 @@
#include <gtk/gtk.h>
#include <glib.h>
#include <glib/gi18n.h>
-#include <canberra-gtk.h>
#include "screenshot-backend-shell.h"
@@ -33,39 +32,6 @@
#include "screenshot-backend-x11.h"
#endif
-void
-screenshot_play_sound_effect (const gchar *event_id,
- const gchar *event_desc)
-{
- ca_context *c;
- ca_proplist *p = NULL;
- int res;
-
- c = ca_gtk_context_get ();
-
- res = ca_proplist_create (&p);
- if (res < 0)
- goto done;
-
- res = ca_proplist_sets (p, CA_PROP_EVENT_ID, event_id);
- if (res < 0)
- goto done;
-
- res = ca_proplist_sets (p, CA_PROP_EVENT_DESCRIPTION, event_desc);
- if (res < 0)
- goto done;
-
- res = ca_proplist_sets (p, CA_PROP_CANBERRA_CACHE_CONTROL, "permanent");
- if (res < 0)
- goto done;
-
- ca_context_play_full (c, 0, p, NULL, NULL);
-
- done:
- if (p != NULL)
- ca_proplist_destroy (p);
-}
-
GdkPixbuf *
screenshot_get_pixbuf (GdkRectangle *rectangle)
{
diff --git a/src/screenshot-utils.h b/src/screenshot-utils.h
index 77e6b8c..015ca96 100644
--- a/src/screenshot-utils.h
+++ b/src/screenshot-utils.h
@@ -32,8 +32,6 @@ gint screenshot_show_dialog (GtkWindow *parent,
GtkButtonsType buttons_type,
const gchar *message,
const gchar *detail);
-void screenshot_play_sound_effect (const gchar *event_id,
- const gchar *event_desc);
void screenshot_display_help (GtkWindow *parent);
G_END_DECLS