Commit 348ad5ec authored by Julian Sparber's avatar Julian Sparber
Browse files

debian: add libfeedback patches

parent 15ce5690
From 97d70fbc40edfe4e73b0e879fd680c2ba9d5f033 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Guido=20G=C3=BCnther?= <agx@sigxcpu.org>
Date: Sat, 22 Feb 2020 18:51:42 +0100
Subject: [PATCH] Use libfeedback in instead of GSound
This allows to use haptic (and later led) based
feedback on top of audio.
---
meson.build | 2 +-
src/main.vala | 9 ++++++++-
src/meson.build | 3 ++-
src/utils.vala | 47 +++++++++++++++++++++--------------------------
4 files changed, 32 insertions(+), 29 deletions(-)
diff --git a/meson.build b/meson.build
index f30fd0b..01cd631 100644
--- a/meson.build
+++ b/meson.build
@@ -14,7 +14,7 @@ glib = dependency('glib-2.0', version: '>= 2.58')
gio = dependency('gio-2.0', version: '>= 2.58')
gobject = dependency('gobject-2.0', version: '>= 2.58')
gtk = dependency('gtk+-3.0', version: '>=3.20')
-gsound = dependency('gsound', version: '>=0.98')
+libfeedback = dependency('libfeedback-0.0', version: '>= 0.0.0')
gweather = dependency('gweather-3.0', version: '>=3.32.0')
gnomedesktop = dependency('gnome-desktop-3.0', version: '>=3.8')
geocodeglib = dependency('geocode-glib-1.0', version: '>=1.0')
diff --git a/src/main.vala b/src/main.vala
index 97d3350..905ef7f 100644
--- a/src/main.vala
+++ b/src/main.vala
@@ -24,6 +24,13 @@ int main (string[] args) {
Environment.set_application_name (_("Clocks"));
+ try {
+ Lfb.init(Config.APP_ID);
+ } catch (GLib.Error e) {
+ warning ("Couldn't init libfeedback: %s", e.message);
+ }
var app = new Clocks.Application ();
- return app.run (args);
+ var ret = app.run (args);
+ Lfb.uninit();
+ return ret;
}
diff --git a/src/meson.build b/src/meson.build
index 4c51188..e5b0edd 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -59,6 +59,7 @@ clocks_c_args = [
'-include', 'config.h',
'-DGWEATHER_I_KNOW_THIS_IS_UNSTABLE',
'-DGNOME_DESKTOP_USE_UNSTABLE_API',
+ '-DLIBFEEDBACK_USE_UNSTABLE_API',
]
clocks_dependencies = [
@@ -66,10 +67,10 @@ clocks_dependencies = [
gio,
gobject,
gtk,
- gsound,
gweather,
gnomedesktop,
geocodeglib,
+ libfeedback,
libgeoclue,
libhandy,
math
diff --git a/src/utils.vala b/src/utils.vala
index eebad84..21c1914 100644
--- a/src/utils.vala
+++ b/src/utils.vala
@@ -382,44 +382,31 @@ public class Weekdays {
}
public class Bell : Object {
- private GSound.Context? gsound;
private GLib.Cancellable cancellable;
+ private Lfb.Event event;
private string soundtheme;
- private string sound;
+ private string eventname;
- public Bell (string soundid) {
- try {
- gsound = new GSound.Context ();
- } catch (GLib.Error e) {
- warning ("Sound could not be initialized, error: %s", e.message);
- }
-
- var settings = new GLib.Settings ("org.gnome.desktop.sound");
+ public Bell (string eventid) {
+ var settings = new GLib.Settings("org.gnome.desktop.sound");
soundtheme = settings.get_string ("theme-name");
- sound = soundid;
- cancellable = new GLib.Cancellable ();
+ eventname = eventid;
+ cancellable = new GLib.Cancellable();
}
private async void ring_real (bool repeat) {
- if (gsound == null) {
+ if (!Lfb.is_initted())
return;
- }
-
- if (cancellable.is_cancelled ()) {
- cancellable.reset ();
- }
+ event = new Lfb.Event (eventname);
+ if (repeat)
+ event.timeout = 0;
try {
- do {
- yield ((GSound.Context) gsound).play_full (cancellable,
- GSound.Attribute.EVENT_ID, sound,
- GSound.Attribute.CANBERRA_XDG_THEME_NAME, soundtheme,
- GSound.Attribute.MEDIA_ROLE, "alarm");
- } while (repeat);
+ yield event.trigger_feedback_async (cancellable);
} catch (GLib.IOError.CANCELLED e) {
// ignore
} catch (GLib.Error e) {
- warning ("Error playing sound: %s", e.message);
+ warning ("Error triggering feedback for event %s: %s", eventname, e.message);
}
}
@@ -432,7 +419,15 @@ public class Bell : Object {
}
public void stop () {
- cancellable.cancel ();
+ event.end_feedback_async.begin (cancellable, (obj, res) => {
+ try {
+ event.end_feedback_async.end(res);
+ } catch (GLib.IOError.CANCELLED e) {
+ // ignore
+ } catch (GLib.Error e) {
+ warning ("Error ending feedback for event %s: %s", eventname, e.message);
+ }
+ });
}
}
--
2.29.2
From b34034d39c546ca92747ab34db3da1122cf68667 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Guido=20G=C3=BCnther?= <agx@sigxcpu.org>
Date: Mon, 24 Feb 2020 13:00:59 +0100
Subject: [PATCH] timer: Use name that can be added to the event naming spec
---
src/main.vala | 4 ++--
src/timer-face.vala | 2 +-
src/utils.vala | 8 ++++----
3 files changed, 7 insertions(+), 7 deletions(-)
Index: gnome-clocks/src/timer-face.vala
===================================================================
--- gnome-clocks.orig/src/timer-face.vala
+++ gnome-clocks/src/timer-face.vala
@@ -71,7 +71,7 @@ public class Face : Gtk.Stack, Clocks.Cl
save ();
});
- bell = new Utils.Bell ("complete");
+ bell = new Utils.Bell ("timeout-completed");
notification = new GLib.Notification (_("Time is up!"));
notification.set_body (_("Timer countdown finished"));
......@@ -18,3 +18,6 @@
0018-fix-build-due-to-nullability-update-on-gio.patch
0001-stopwatch-only-update-labels-when-text-changes.patch
0002-timer-item-only-emit-countdown_updated-event-the-tex.patch
#replace GSound with Libfeedback: https://gitlab.gnome.org/GNOME/gnome-clocks/-/merge_requests/151
0001-timer-Use-name-that-can-be-added-to-the-event-naming.patch
0001-Use-libfeedback-in-instead-of-GSound.patch
Supports Markdown
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