[gnome-clocks/zbrown/list-alarms: 3/7] alarms: Wire up edit button
- From: Zander <zbrown src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-clocks/zbrown/list-alarms: 3/7] alarms: Wire up edit button
- Date: Sat, 7 Dec 2019 20:06:17 +0000 (UTC)
commit 3b2772b333daa1a2dddbdd338f5775a9f9f14993
Author: Zander Brown <zbrown gnome org>
Date: Mon Aug 5 23:49:49 2019 +0100
alarms: Wire up edit button
data/css/gnome-clocks.css | 5 +++++
data/css/gnome-clocks.highcontrast.css | 5 +++++
data/ui/alarm.ui | 1 -
data/ui/alarmtile.ui | 1 +
src/alarm.vala | 24 ++++++++++--------------
5 files changed, 21 insertions(+), 15 deletions(-)
---
diff --git a/data/css/gnome-clocks.css b/data/css/gnome-clocks.css
index 883bbed..11326ee 100644
--- a/data/css/gnome-clocks.css
+++ b/data/css/gnome-clocks.css
@@ -56,6 +56,11 @@ window > stack:backdrop {
/* alarms */
+row.snoozing {
+ background: transparent -gtk-icontheme("alarm-symbolic") 65% 400%/48px 48px no-repeat;
+ font-weight: bold;
+}
+
.alarm-tile,
.alarm-tile:backdrop {
color: shade(@insensitive_fg_color,0.9);
diff --git a/data/css/gnome-clocks.highcontrast.css b/data/css/gnome-clocks.highcontrast.css
index af781d2..b6b91d5 100644
--- a/data/css/gnome-clocks.highcontrast.css
+++ b/data/css/gnome-clocks.highcontrast.css
@@ -35,6 +35,11 @@ window > stack:backdrop {
/* alarms */
+row.snoozing {
+ background: transparent -gtk-icontheme("alarm-symbolic") 65% 400%/48px 48px no-repeat;
+ font-weight: bold;
+}
+
.alarm-tile,
.alarm-tile:backdrop,
.tile.prelight .alarm-tile,
diff --git a/data/ui/alarm.ui b/data/ui/alarm.ui
index 6c90e88..b947f1c 100644
--- a/data/ui/alarm.ui
+++ b/data/ui/alarm.ui
@@ -56,7 +56,6 @@
<property name="selection-mode">none</property>
<property name="valign">start</property>
<property name="margin">24</property>
- <!--<signal name="row-activated" handler="item_activated" swapped="no"/>-->
<style>
<class name="frame"/>
</style>
diff --git a/data/ui/alarmtile.ui b/data/ui/alarmtile.ui
index 15d1730..9e6578a 100644
--- a/data/ui/alarmtile.ui
+++ b/data/ui/alarmtile.ui
@@ -9,6 +9,7 @@
<property name="visible">True</property>
<property name="valign">center</property>
<property name="halign">center</property>
+ <signal name="clicked" handler="edit" swapped="no" object="ClocksAlarmRow"/>
<child>
<object class="GtkImage">
<property name="visible">True</property>
diff --git a/src/alarm.vala b/src/alarm.vala
index 7d9127d..7a0ac42 100644
--- a/src/alarm.vala
+++ b/src/alarm.vala
@@ -277,9 +277,10 @@ private class Item : Object, ContentItem {
[GtkTemplate (ui = "/org/gnome/clocks/ui/alarmtile.ui")]
private class Row : Hdy.ActionRow {
public Item alarm { get; construct set; }
+ public Face face { get; construct set; }
- public Row (Item alarm) {
- Object (alarm: alarm);
+ public Row (Item alarm, Face face) {
+ Object (alarm: alarm, face: face);
alarm.bind_property ("name", this, "subtitle", BindingFlags.DEFAULT | BindingFlags.SYNC_CREATE);
@@ -316,6 +317,11 @@ private class Row : Hdy.ActionRow {
title = text;
}
}
+
+ [GtkCallback]
+ private void edit () requires (face != null && alarm != null) {
+ face.edit(alarm);
+ }
}
[GtkTemplate (ui = "/org/gnome/clocks/ui/alarmsetupdialog.ui")]
@@ -629,7 +635,7 @@ public class Face : Gtk.Stack, Clocks.Clock {
listbox.set_header_func((Gtk.ListBoxUpdateHeaderFunc) Hdy.list_box_separator_header);
listbox.bind_model (alarms, (item) => {
- return new Row ((Item)item);
+ return new Row ((Item) item, this);
});
load ();
@@ -660,16 +666,6 @@ public class Face : Gtk.Stack, Clocks.Clock {
public signal void ring ();
- //[GtkCallback]
- private void item_activated (ContentItem item) {
- Item alarm = (Item) item;
- if (alarm.state == Item.State.SNOOZING) {
- show_ringing_panel (alarm);
- } else {
- edit (alarm);
- }
- }
-
[GtkCallback]
private void dismiss_ringing_panel () {
reset_view ();
@@ -694,7 +690,7 @@ public class Face : Gtk.Stack, Clocks.Clock {
settings.set_value ("alarms", alarms.serialize ());
}
- private void edit (Item alarm) {
+ internal void edit (Item alarm) {
var dialog = new SetupDialog ((Gtk.Window) get_toplevel (), alarm, alarms);
// Disable alarm while editing it and remember the original active state.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]