File: no-notification-on-alarm.patch

package info (click to toggle)
indicator-sensors 1.4-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,328 kB
  • sloc: ansic: 8,886; sh: 571; makefile: 394; xml: 41
file content (59 lines) | stat: -rw-r--r-- 2,361 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
Description: don't show notification on alarm
 There is nothing the user can do in this case so don't bother showing a
 notification, this is just noise.
Origin: upstream, https://github.com/alexmurray/indicator-sensors/commit/62d576b01a112446a7be09fc10eb8c2830eb14c9
Author: Alex Murray <murray.alex@gmail.com>
Last-Update: 2023-03-25

--- a/indicator-sensors/is-sensor.c
+++ b/indicator-sensors/is-sensor.c
@@ -35,9 +35,9 @@
 static void is_sensor_set_property(GObject *object,
                                    guint property_id, const GValue *value, GParamSpec *pspec);
 
-// alarm timeout should be more than the sensor poll timeout / hysteresis to ensure we
-// get at least one more reading in before showing any notification otherwise
-// there is no hysteresis
+// alarm timeout should be more than the sensor poll timeout / hysteresis to
+// ensure we get at least one more reading in before showing the alarm state
+// otherwise there is no hysteresis
 #define DEFAULT_ALARM_TIMEOUT 5
 
 /* signal enum */
@@ -384,19 +384,8 @@
 static gboolean
 enable_alarm(IsSensor *self)
 {
-  NotifyNotification *notification;
-
   g_return_val_if_fail(self != NULL, FALSE);
 
-  notification = is_notify(IS_NOTIFY_LEVEL_WARNING,
-                           _("Sensor Alarm"),
-                           "%s: %2.1f%s",
-                           is_sensor_get_label(self),
-                           is_sensor_get_value(self),
-                           is_sensor_get_units(self));
-  is_debug("sensor", "Displaying alarm notification");
-  g_object_set_data_full(G_OBJECT(self), "notification",
-                         notification, g_object_unref);
   self->priv->alarmed = TRUE;
   g_object_notify_by_pspec(G_OBJECT(self),
                            properties[PROP_ALARMED]);
@@ -408,16 +397,8 @@
 static gboolean
 disable_alarm(IsSensor *self)
 {
-  /* hide any notification */
-  NotifyNotification *notification;
-
   g_return_val_if_fail(self != NULL, FALSE);
 
-  notification = g_object_get_data(G_OBJECT(self), "notification");
-  is_debug("sensor", "Closing alarm notification");
-  notify_notification_close(notification, NULL);
-  g_object_set_data(G_OBJECT(self), "notification",
-                    NULL);
   self->priv->alarmed = FALSE;
   g_object_notify_by_pspec(G_OBJECT(self),
                            properties[PROP_ALARMED]);