[gnome-clocks/zbrown/list-alarms: 25/36] alarms: update rows for new design
- From: Zander <zbrown src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-clocks/zbrown/list-alarms: 25/36] alarms: update rows for new design
- Date: Fri, 14 Feb 2020 18:12:58 +0000 (UTC)
commit 292676f3d9a8c6294043b66e8330a8a438ab1a86
Author: Zander Brown <zbrown gnome org>
Date: Mon Jan 13 16:34:12 2020 +0000
alarms: update rows for new design
repeats/labels show/hide automatically now
data/css/gnome-clocks.css | 63 ++------------
data/gnome-clocks.gresource.xml | 2 +-
data/gtk/help-overlay.ui | 7 --
data/ui/alarm.ui | 42 ++--------
data/ui/alarmdaypickerrow.ui | 3 +-
data/ui/alarmringing.ui | 29 ++++---
data/ui/alarmrow.ui | 180 ++++++++++++++++++++++++++++++++++++++++
data/ui/alarmsetupdialog.ui | 96 +++++++--------------
data/ui/alarmtile.ui | 31 -------
src/alarm.vala | 83 +++++++++++++-----
src/headerbar.vala | 7 +-
11 files changed, 311 insertions(+), 232 deletions(-)
---
diff --git a/data/css/gnome-clocks.css b/data/css/gnome-clocks.css
index 0767976..7ffe6dc 100644
--- a/data/css/gnome-clocks.css
+++ b/data/css/gnome-clocks.css
@@ -65,66 +65,21 @@ row.snoozing {
font-weight: bold;
}
-.alarm-tile,
-.alarm-tile:backdrop {
- color: shade(@insensitive_fg_color,0.9);
- background-color: transparent;
- background-image: -gtk-gradient(radial,
- center center, 0,
- center bottom, 1.0,
- from(shade(@insensitive_bg_color,0.9)),
to(shade(@insensitive_bg_color,0.85)));
-}
-
-.tile.prelight .alarm-tile,
-.tile.prelight .alarm-tile:backdrop {
- color: @insensitive_fg_color;
- background-color: transparent;
- background-image: -gtk-gradient(radial,
- center center, 0,
- center bottom, 1.0,
- from(shade(@insensitive_bg_color,0.99)),
to(shade(@insensitive_bg_color,0.9)));
-}
-
-.active .alarm-tile,
-.active .alarm-tile:backdrop {
- color: white;
- background-color: transparent;
- background-image: -gtk-gradient(radial,
- center center, 0,
- center bottom, 1.0,
- from(shade(@theme_selected_bg_color,1.2)), to(@theme_selected_bg_color));
+.alarm-row button {
+ min-width: 24px;
+ min-height: 24px;
}
-.tile.prelight .active .alarm-tile,
-.tile.prelight .active .alarm-tile:backdrop {
- color: white;
- text-shadow: 0 2px 2px rgba(0, 0, 0, 0.5);
- background-color: transparent;
- background-image: -gtk-gradient(radial,
- center center, 0,
- center bottom, 1.0,
- from(shade(@theme_selected_bg_color, 1.4)),
to(@theme_selected_bg_color));
+.alarm-name {
+ font-weight: bold;
}
-.snoozing .alarm-tile,
-.snoozing .alarm-tile:backdrop {
- color: white;
- background-color: transparent;
- background-image: -gtk-gradient(radial,
- center center, 0,
- center bottom, 1.0,
- from(@warning_color), to(shade(@warning_color,0.9)));
+.alarm-time {
+ font-size: 2.5em;
}
-.tile.prelight .snoozing .alarm-tile,
-.tile.prelight .snoozing .alarm-tile:backdrop {
- color: white;
- text-shadow: 0 2px 2px rgba(0, 0, 0, 0.5);
- background-color: transparent;
- background-image: -gtk-gradient(radial,
- center center, 0,
- center bottom, 1.0,
- from(shade(@warning_color,1.1)), to(shade(@warning_color,0.99)));
+.alarm-list {
+ border-radius: 6px;
}
.clocks-ampm-toggle-button {
diff --git a/data/gnome-clocks.gresource.xml b/data/gnome-clocks.gresource.xml
index a774c8a..30461ed 100644
--- a/data/gnome-clocks.gresource.xml
+++ b/data/gnome-clocks.gresource.xml
@@ -13,7 +13,7 @@
<file preprocess="xml-stripblanks">ui/world.ui</file>
<file preprocess="xml-stripblanks">ui/worldtile.ui</file>
<file preprocess="xml-stripblanks">ui/alarmringing.ui</file>
- <file preprocess="xml-stripblanks">ui/alarmtile.ui</file>
+ <file preprocess="xml-stripblanks">ui/alarmrow.ui</file>
<file preprocess="xml-stripblanks">ui/alarmdaypickerrow.ui</file>
<file preprocess="xml-stripblanks">ui/alarmsetupdialog.ui</file>
<file preprocess="xml-stripblanks">ui/alarm.ui</file>
diff --git a/data/gtk/help-overlay.ui b/data/gtk/help-overlay.ui
index f4e3a38..f93eed3 100644
--- a/data/gtk/help-overlay.ui
+++ b/data/gtk/help-overlay.ui
@@ -89,13 +89,6 @@
<property name="title" translatable="yes" context="shortcut window">Add an alarm</property>
</object>
</child>
- <child>
- <object class="GtkShortcutsShortcut">
- <property name="visible">1</property>
- <property name="accelerator"><ctrl>A</property>
- <property name="title" translatable="yes" context="shortcut window">Select all
alarms</property>
- </object>
- </child>
</object>
</child>
<child>
diff --git a/data/ui/alarm.ui b/data/ui/alarm.ui
index 5b84659..3e1a782 100644
--- a/data/ui/alarm.ui
+++ b/data/ui/alarm.ui
@@ -51,47 +51,15 @@
<property name="visible">True</property>
<property name="maximum-width">500</property>
<child>
- <object class="GtkBox">
+ <object class="GtkListBox" id="listbox">
<property name="visible">True</property>
- <property name="margin">24</property>
+ <property name="margin">12</property>
<property name="valign">start</property>
- <property name="orientation">vertical</property>
- <child>
- <object class="GtkListBox" id="listbox">
- <property name="visible">True</property>
- <property name="selection-mode">none</property>
- </object>
- </child>
- <child>
- <object class="GtkSeparator">
- <property name="visible">True</property>
- <property name="orientation">horizontal</property>
- </object>
- </child>
- <child>
- <object class="GtkListBox">
- <property name="visible">True</property>
- <property name="selection-mode">none</property>
- <signal name="row-activated" handler="create_alarm" swapped="no"/>
- <child>
- <object class="GtkListBoxRow">
- <property name="visible">True</property>
- <child>
- <object class="GtkLabel">
- <property name="visible">True</property>
- <property name="label">Add a new Alarm…</property>
- <property name="margin-start">12</property>
- <property name="margin-end">12</property>
- <property name="margin-top">18</property>
- <property name="margin-bottom">18</property>
- </object>
- </child>
- </object>
- </child>
- </object>
- </child>
+ <property name="selection-mode">none</property>
+ <property name="activate-on-single-click">False</property>
<style>
<class name="frame"/>
+ <class name="alarm-list"/>
</style>
</object>
</child>
diff --git a/data/ui/alarmdaypickerrow.ui b/data/ui/alarmdaypickerrow.ui
index 8c557ce..594684b 100644
--- a/data/ui/alarmdaypickerrow.ui
+++ b/data/ui/alarmdaypickerrow.ui
@@ -2,7 +2,8 @@
<interface>
<template class="ClocksAlarmDayPickerRow" parent="HdyActionRow">
<property name="visible">True</property>
- <property name="title">Repeats</property>
+ <property name="title">_Repeat</property>
+ <property name="use-underline">True</property>
<child type="action">
<object class="GtkImage" id="icon">
<property name="visible">True</property>
diff --git a/data/ui/alarmringing.ui b/data/ui/alarmringing.ui
index bf44229..d889110 100644
--- a/data/ui/alarmringing.ui
+++ b/data/ui/alarmringing.ui
@@ -1,13 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.1 -->
<interface>
- <!-- interface-requires gtk+ 3.0 -->
+ <requires lib="gtk+" version="3.20"/>
<template class="ClocksAlarmRingingPanel" parent="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="halign">center</property>
- <property name="valign">center</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="row_spacing">48</property>
@@ -20,6 +17,8 @@
<property name="valign">center</property>
<property name="justify">center</property>
<property name="wrap">True</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
<style>
<class name="clocks-ringing-label"/>
</style>
@@ -27,14 +26,17 @@
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkGrid" id="button_grid">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="halign">center</property>
+ <property name="valign">center</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="row_spacing">24</property>
<property name="column_spacing">24</property>
<child>
<object class="GtkButton" id="stop_button">
@@ -47,13 +49,12 @@
<style>
<class name="clocks-button"/>
<class name="clocks-stop"/>
+ <class name="destructive-action"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -63,24 +64,22 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
+ <property name="relief">none</property>
<signal name="clicked" handler="snooze_clicked" swapped="no"/>
<style>
<class name="clocks-button"/>
+ <class name="clocks-snooze"/>
</style>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
</template>
diff --git a/data/ui/alarmrow.ui b/data/ui/alarmrow.ui
new file mode 100644
index 0000000..21d4583
--- /dev/null
+++ b/data/ui/alarmrow.ui
@@ -0,0 +1,180 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.1 -->
+<interface>
+ <requires lib="gtk+" version="3.20"/>
+ <template class="ClocksAlarmRow" parent="GtkListBoxRow">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="activatable">False</property>
+ <property name="selectable">False</property>
+ <child>
+ <object class="GtkGrid">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="valign">center</property>
+ <property name="margin_left">12</property>
+ <property name="margin_right">12</property>
+ <property name="margin_top">6</property>
+ <property name="margin_bottom">6</property>
+ <property name="hexpand">True</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">12</property>
+ <child>
+ <object class="GtkSwitch" id="toggle">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip_text" translatable="yes">Active</property>
+ <property name="valign">center</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkRevealer" id="title_reveal">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="transition_type">slide-up</property>
+ <child>
+ <object class="GtkLabel" id="title">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="label">Name</property>
+ <property name="ellipsize">end</property>
+ <property name="xalign">0</property>
+ <style>
+ <class name="alarm-name"/>
+ </style>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="time">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="label">12:34</property>
+ <property name="xalign">0</property>
+ <style>
+ <class name="alarm-time"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkRevealer" id="repeats_reveal">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkLabel" id="repeats">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="label">Repeats</property>
+ <property name="ellipsize">end</property>
+ <property name="xalign">0</property>
+ <style>
+ <class name="dim-label"/>
+ <class name="alarm-repeate"/>
+ </style>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">2</property>
+ <property name="width">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSeparator">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="top_attach">0</property>
+ <property name="height">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="tooltip_text" translatable="yes">Edit</property>
+ <property name="halign">end</property>
+ <property name="valign">center</property>
+ <signal name="clicked" handler="edit" swapped="no"/>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="margin_bottom">1</property>
+ <property name="icon_name">document-edit-symbolic</property>
+ </object>
+ </child>
+ <style>
+ <class name="circular"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left_attach">3</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="tooltip_text" translatable="yes">Delete</property>
+ <property name="halign">end</property>
+ <property name="valign">center</property>
+ <signal name="clicked" handler="delete" swapped="no"/>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_name">edit-delete-symbolic</property>
+ </object>
+ </child>
+ <style>
+ <class name="circular"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left_attach">4</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ </child>
+ <style>
+ <class name="alarm-row"/>
+ </style>
+ </template>
+</interface>
diff --git a/data/ui/alarmsetupdialog.ui b/data/ui/alarmsetupdialog.ui
index 473a2b1..4a6d308 100644
--- a/data/ui/alarmsetupdialog.ui
+++ b/data/ui/alarmsetupdialog.ui
@@ -186,78 +186,32 @@
</object>
</child>
<child>
- <object class="GtkBox">
+ <object class="GtkListBox" id="listbox">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="selection_mode">none</property>
<property name="margin">6</property>
- <property name="orientation">vertical</property>
<child>
- <object class="GtkListBox" id="listbox">
+ <object class="ClocksAlarmDayPickerRow" id="repeats">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="selection_mode">none</property>
- <child>
- <object class="HdyActionRow">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="activatable_widget">name_entry</property>
- <property name="title" translatable="yes">Name</property>
- <child type="action">
- <object class="GtkEntry" id="name_entry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="valign">center</property>
- <property name="hexpand">True</property>
- <property name="activates_default">True</property>
- <signal name="changed" handler="entry_changed"
object="ClocksAlarmSetupDialog" swapped="no"/>
- </object>
- </child>
- </object>
- </child>
- <child>
- <object class="ClocksAlarmDayPickerRow" id="repeats">
- <property name="visible">True</property>
- <signal name="days_changed" handler="days_changed" swapped="no" />
- </object>
- </child>
+ <signal name="days_changed" handler="days_changed" swapped="no" />
</object>
</child>
<child>
- <object class="GtkBox" id="delete_area">
- <property name="visible">False</property>
- <property name="no-show-all">True</property>
- <property name="orientation">vertical</property>
- <child>
- <object class="GtkSeparator">
- <property name="visible">True</property>
- <property name="orientation">horizontal</property>
- </object>
- </child>
- <child>
- <object class="GtkListBox">
+ <object class="HdyActionRow">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="activatable_widget">name_entry</property>
+ <property name="title" translatable="yes">Name</property>
+ <property name="subtitle" translatable="yes">Optional</property>
+ <child type="action">
+ <object class="GtkEntry" id="name_entry">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="selection_mode">none</property>
- <signal name="row-activated" handler="delete_alarm" swapped="no"/>
- <child>
- <object class="GtkListBoxRow">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <child>
- <object class="GtkLabel">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="margin_left">12</property>
- <property name="margin_right">12</property>
- <property name="margin_top">18</property>
- <property name="margin_bottom">18</property>
- <property name="label" translatable="yes">Delete Alarm</property>
- <style>
- <class name="destructive-action"/>
- </style>
- </object>
- </child>
- </object>
- </child>
+ <property name="can_focus">True</property>
+ <property name="valign">center</property>
+ <property name="hexpand">True</property>
+ <property name="activates_default">True</property>
+ <signal name="changed" handler="entry_changed" object="ClocksAlarmSetupDialog"
swapped="no"/>
</object>
</child>
</object>
@@ -267,6 +221,20 @@
</style>
</object>
</child>
+ <child>
+ <object class="GtkButton" id="delete_button">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">R_emove Alarm</property>
+ <property name="use-underline">True</property>
+ <property name="margin">6</property>
+ <property name="halign">start</property>
+ <signal name="clicked" handler="delete" swapped="no" />
+ <style>
+ <class name="destructive-action"/>
+ </style>
+ </object>
+ </child>
<child>
<object class="GtkRevealer" id="label_revealer">
<property name="visible">True</property>
diff --git a/src/alarm.vala b/src/alarm.vala
index e87553d..c38c686 100644
--- a/src/alarm.vala
+++ b/src/alarm.vala
@@ -276,32 +276,43 @@ private class Item : Object, ContentItem {
}
}
-[GtkTemplate (ui = "/org/gnome/clocks/ui/alarmtile.ui")]
-private class Row : Hdy.ActionRow {
+[GtkTemplate (ui = "/org/gnome/clocks/ui/alarmrow.ui")]
+private class Row : Gtk.ListBoxRow {
public Item alarm { get; construct set; }
public Face face { get; construct set; }
[GtkChild]
private Gtk.Switch toggle;
[GtkChild]
+ private Gtk.Label title;
+ [GtkChild]
+ private Gtk.Revealer title_reveal;
+ [GtkChild]
+ private Gtk.Label time;
+ [GtkChild]
private Gtk.Label repeats;
+ [GtkChild]
+ private Gtk.Revealer repeats_reveal;
public Row (Item alarm, Face face) {
Object (alarm: alarm, face: face);
- alarm.bind_property ("name", this, "subtitle", BindingFlags.DEFAULT | BindingFlags.SYNC_CREATE);
- alarm.bind_property ("active", toggle, "active", BindingFlags.DEFAULT | BindingFlags.SYNC_CREATE);
+ alarm.notify["days"].connect (update_repeats);
+ alarm.bind_property ("active", toggle, "active", SYNC_CREATE | BIDIRECTIONAL);
+
+ alarm.notify["name"].connect (update);
alarm.notify["active"].connect (update);
alarm.notify["state"].connect (update);
alarm.notify["time"].connect (update);
- alarm.notify["days"].connect (update);
+ update_repeats ();
update ();
}
- public override void activate () {
- face.edit(alarm);
+ private void update_repeats () {
+ repeats_reveal.reveal_child = !alarm.days.empty;
+ repeats.label = alarm.days_label;
}
private void update () {
@@ -313,13 +324,41 @@ private class Row : Hdy.ActionRow {
if (alarm.state == Item.State.SNOOZING) {
get_style_context ().add_class ("snoozing");
- title = "%s (%s)".printf (alarm.snooze_time_label, alarm.time_label);
+ time.label = alarm.snooze_time_label;
} else {
get_style_context ().remove_class ("snoozing");
- title = alarm.time_label;
+ time.label = alarm.time_label;
}
- repeats.label = alarm.days_label;
+ var label = alarm.name;
+
+ // Prior to 3.36 unamed alarms would just be called "Alarm",
+ // pretend alarms called "Alarm" don't have a name (of course
+ // this fails if the language/translation has since changed)
+ if (alarm.name == _("Alarm")) {
+ label = null;
+ }
+
+ if (alarm.state == Item.State.SNOOZING) {
+ if (label != null && label.length > 0) {
+ label = "Snoozed from %s: %s".printf (alarm.time_label, label);
+ } else {
+ label = "Snoozed from %s".printf (alarm.time_label);
+ }
+ }
+
+ title_reveal.reveal_child = label != null && label.length > 0;
+ title.label = label;
+ }
+
+ [GtkCallback]
+ private void edit () {
+ face.edit (alarm);
+ }
+
+ [GtkCallback]
+ private void delete () {
+ face.delete (alarm);
}
}
@@ -514,7 +553,7 @@ private class SetupDialog : Hdy.Dialog {
[GtkChild]
private Gtk.ListBox listbox;
[GtkChild]
- private Gtk.Box delete_area;
+ private Gtk.Button delete_button;
private List<Item> other_alarms;
static construct {
@@ -524,7 +563,7 @@ private class SetupDialog : Hdy.Dialog {
public SetupDialog (Gtk.Window parent, Item? alarm, ListModel all_alarms) {
Object (transient_for: parent, title: alarm != null ? _("Edit Alarm") : _("New Alarm"),
use_header_bar: 1);
- delete_area.visible = alarm != null;
+ delete_button.visible = alarm != null;
listbox.set_header_func((Gtk.ListBoxUpdateHeaderFunc) Hdy.list_box_separator_header);
other_alarms = new List<Item> ();
@@ -570,7 +609,8 @@ private class SetupDialog : Hdy.Dialog {
if (alarm == null) {
var wc = Utils.WallClock.get_default ();
- name = _("Alarm");
+ // Not great but we can't null it
+ name = "";
hour = wc.date_time.get_hour ();
minute = wc.date_time.get_minute ();
days = null;
@@ -668,11 +708,12 @@ private class SetupDialog : Hdy.Dialog {
}
[GtkCallback]
- private void delete_alarm () {
- response(2);
+ private void delete () {
+ response (2);
}
}
+
[GtkTemplate (ui = "/org/gnome/clocks/ui/alarmringing.ui")]
private class RingingPanel : Gtk.Grid {
public Item alarm {
@@ -736,7 +777,7 @@ public class Face : Gtk.Stack, Clocks.Clock {
public ViewMode view_mode { get; set; default = NORMAL; }
public PanelId panel_id { get; construct set; }
public ButtonMode button_mode { get; set; default = NEW; }
- public bool can_select { get; set; default = true; }
+ public bool can_select { get; set; default = false; }
public bool n_selected { get; set; }
public string title { get; set; default = _("Clocks"); }
public string subtitle { get; set; }
@@ -832,11 +873,6 @@ public class Face : Gtk.Stack, Clocks.Clock {
}
}
- [GtkCallback]
- private void create_alarm () {
- activate_new();
- }
-
private void load () {
alarms.deserialize (settings.get_value ("alarms"), Item.deserialize);
}
@@ -865,6 +901,11 @@ public class Face : Gtk.Stack, Clocks.Clock {
dialog.show_all ();
}
+ internal void delete (Item alarm) {
+ alarms.delete_item (alarm);
+ save ();
+ }
+
private void show_ringing_panel (Item alarm) {
ringing_panel.alarm = alarm;
ringing_panel.update ();
diff --git a/src/headerbar.vala b/src/headerbar.vala
index a114e23..367e662 100644
--- a/src/headerbar.vala
+++ b/src/headerbar.vala
@@ -43,6 +43,8 @@ public class Clocks.HeaderBar : Hdy.HeaderBar {
set {
_mode = value;
+ var width = get_allocated_width ();
+
switch (_mode) {
case SELECTION:
title_stack.visible_child_name = "selection";
@@ -52,6 +54,7 @@ public class Clocks.HeaderBar : Hdy.HeaderBar {
select_stack.hide ();
end_button_stack.visible_child_name = "cancel";
centering_policy = LOOSE;
+ switcher_bar.reveal = width <= 500;
break;
case NORMAL:
title_stack.visible_child_name = "switcher";
@@ -61,6 +64,7 @@ public class Clocks.HeaderBar : Hdy.HeaderBar {
select_stack.show ();
end_button_stack.visible_child_name = "menu";
centering_policy = STRICT;
+ switcher_bar.reveal = width <= 500;
break;
case STANDALONE:
title_stack.visible_child_name = "title";
@@ -68,6 +72,7 @@ public class Clocks.HeaderBar : Hdy.HeaderBar {
end_button_stack.hide ();
select_stack.hide ();
centering_policy = STRICT;
+ switcher_bar.reveal = false;
break;
}
@@ -148,7 +153,7 @@ public class Clocks.HeaderBar : Hdy.HeaderBar {
squeezer.set_child_enabled (title_wide_switcher, allocation.width > 800);
squeezer.set_child_enabled (title_narrow_switcher, allocation.width > 500);
squeezer.set_child_enabled (title_text, allocation.width <= 500);
- switcher_bar.set_reveal (allocation.width <= 500);
+ switcher_bar.reveal = allocation.width <= 500 && view_mode != STANDALONE;
}
[GtkCallback]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]