[gnome-clocks/wip/vala] More work on the ring panel
- From: Paolo Borelli <pborelli src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-clocks/wip/vala] More work on the ring panel
- Date: Sun, 17 Feb 2013 16:29:08 +0000 (UTC)
commit ba4e0316a610e544500a14aae767242593eff5e5
Author: Paolo Borelli <pborelli gnome org>
Date: Sun Feb 17 17:28:35 2013 +0100
More work on the ring panel
src/alarm.ui | 4 ++--
src/alarm.vala | 37 ++++++++++++++++++++++++++++---------
2 files changed, 30 insertions(+), 11 deletions(-)
---
diff --git a/src/alarm.ui b/src/alarm.ui
index 8e9ab3f..40c10c4 100644
--- a/src/alarm.ui
+++ b/src/alarm.ui
@@ -82,7 +82,7 @@
<property name="can_focus">False</property>
<property name="column_spacing">24</property>
<child>
- <object class="GtkButton" id="left_button">
+ <object class="GtkButton" id="stop_button">
<property name="label" translatable="yes">Stop</property>
<property name="width_request">200</property>
<property name="visible">True</property>
@@ -101,7 +101,7 @@
</packing>
</child>
<child>
- <object class="GtkButton" id="right_button">
+ <object class="GtkButton" id="snooze_button">
<property name="label" translatable="yes">Snooze</property>
<property name="width_request">200</property>
<property name="visible">True</property>
diff --git a/src/alarm.vala b/src/alarm.vala
index 9e60cba..b98849a 100644
--- a/src/alarm.vala
+++ b/src/alarm.vala
@@ -167,12 +167,12 @@ private class Item : Object {
bell.ring ();
}
- private void snooze () {
+ public void snooze () {
bell.stop ();
state = State.SNOOZING;
}
- private void stop () {
+ public void stop () {
bell.stop ();
update_snooze_time (alarm_time);
state = State.READY;
@@ -265,7 +265,6 @@ private class SetupDialog : Gtk.Dialog {
private AmPmToggleButton am_pm_button;
private Gtk.ToggleButton[] day_buttons;
private Gtk.Switch active_switch;
- private Item alarm;
public SetupDialog (Gtk.Window parent, Item? alarm) {
Object (transient_for: parent, modal: true, title: _("New Alarm"));
@@ -411,16 +410,36 @@ private class SetupDialog : Gtk.Dialog {
private class StandalonePanel : Gtk.EventBox {
public Item alarm { get; set; }
+ private Gtk.Label time_label;
+ private Gtk.Button stop_button;
+ private Gtk.Button snooze_button;
+
public StandalonePanel () {
get_style_context ().add_class ("view");
get_style_context ().add_class ("content-view");
var builder = Utils.load_ui ("alarm.ui");
var grid = builder.get_object ("ringing_panel") as Gtk.Grid;
+ time_label = builder.get_object ("time_label") as Gtk.Label;
+ stop_button = builder.get_object ("stop_button") as Gtk.Button;
+ snooze_button = builder.get_object ("snooze_button") as Gtk.Button;
+
+ stop_button.clicked.connect (() => {
+ alarm.stop ();
+ });
+
+ snooze_button.clicked.connect (() => {
+ alarm.snooze ();
+ snooze_button.sensitive = false;
+ });
+
+ add (grid);
}
public void update () {
if (alarm != null) {
+ time_label.set_text (alarm.time_label);
+ snooze_button.sensitive = (alarm.state == Item.State.RINGING);
}
}
}
@@ -466,12 +485,12 @@ public class MainPanel : Gd.Stack, Clocks.Clock {
list_store.get (i, Column.ITEM, out alarm);
var dialog = new SetupDialog ((Gtk.Window) get_toplevel (), alarm);
dialog.response.connect ((dialog, response) => {
- if (response == 1) {
- ((SetupDialog) dialog).apply_to_alarm (alarm);
- alarm.reset ();
- }
- dialog.destroy ();
- });
+ if (response == 1) {
+ ((SetupDialog) dialog).apply_to_alarm (alarm);
+ alarm.reset ();
+ }
+ dialog.destroy ();
+ });
dialog.show_all ();
}
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]