[gnome-clocks] Remove the empty property of content view
- From: Paolo Borelli <pborelli src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-clocks] Remove the empty property of content view
- Date: Mon, 8 Feb 2016 11:58:37 +0000 (UTC)
commit 6a5cb62db9b3b327652130dd083e60ad79d925a2
Author: Paolo Borelli <pborelli gnome org>
Date: Mon Feb 8 12:41:31 2016 +0100
Remove the empty property of content view
We can now watch the model instead of the view to see when it is empty
data/ui/alarm.ui | 1 -
data/ui/world.ui | 1 -
src/alarm.vala | 8 ++------
src/widgets.vala | 4 ----
src/world.vala | 8 ++------
5 files changed, 4 insertions(+), 18 deletions(-)
---
diff --git a/data/ui/alarm.ui b/data/ui/alarm.ui
index 4fca290..1b54b6e 100644
--- a/data/ui/alarm.ui
+++ b/data/ui/alarm.ui
@@ -49,7 +49,6 @@
<object class="ClocksContentView" id="content_view">
<property name="visible">True</property>
<signal name="item-activated" handler="item_activated" swapped="no"/>
- <signal name="notify::empty" handler="empty_changed" swapped="no"/>
</object>
</child>
<child>
diff --git a/data/ui/world.ui b/data/ui/world.ui
index 42b57d1..93d6a36 100644
--- a/data/ui/world.ui
+++ b/data/ui/world.ui
@@ -49,7 +49,6 @@
<object class="ClocksContentView" id="content_view">
<property name="visible">True</property>
<signal name="item-activated" handler="item_activated" swapped="no"/>
- <signal name="notify::empty" handler="empty_changed" swapped="no"/>
</object>
</child>
<child>
diff --git a/src/alarm.vala b/src/alarm.vala
index 22573d2..d834f7e 100644
--- a/src/alarm.vala
+++ b/src/alarm.vala
@@ -578,6 +578,7 @@ public class Face : Gtk.Stack, Clocks.Clock {
alarms.items_changed.connect ((position, removed, added) => {
save ();
+ reset_view ();
});
// Start ticking...
@@ -609,11 +610,6 @@ public class Face : Gtk.Stack, Clocks.Clock {
}
[GtkCallback]
- private void empty_changed () {
- reset_view ();
- }
-
- [GtkCallback]
private void dismiss_ringing_panel () {
reset_view ();
}
@@ -662,7 +658,7 @@ public class Face : Gtk.Stack, Clocks.Clock {
}
private void reset_view () {
- visible_child = content_view.empty ? empty_view : content_view;
+ visible_child = alarms.get_n_items () == 0 ? empty_view : content_view;
}
public void activate_new () {
diff --git a/src/widgets.vala b/src/widgets.vala
index efde590..c6b7cf4 100644
--- a/src/widgets.vala
+++ b/src/widgets.vala
@@ -495,8 +495,6 @@ private class IconView : Gtk.IconView {
}
public class ContentView : Gtk.Bin {
- public bool empty { get; private set; default = true; }
-
private bool can_select {
get {
return _can_select;
@@ -604,8 +602,6 @@ public class ContentView : Gtk.Bin {
public void bind_model (ContentStore store) {
model = store;
model.items_changed.connect ((position, removed, added) => {
- empty = model.get_n_items () == 0;
-
var first_selectable = model.find ((i) => {
return i.selectable;
});
diff --git a/src/world.vala b/src/world.vala
index 7bfcccb..5a9d188 100644
--- a/src/world.vala
+++ b/src/world.vala
@@ -307,6 +307,7 @@ public class Face : Gtk.Stack, Clocks.Clock {
locations.items_changed.connect ((position, removed, added) => {
save ();
+ reset_view ();
});
show_all ();
@@ -327,11 +328,6 @@ public class Face : Gtk.Stack, Clocks.Clock {
}
[GtkCallback]
- private void empty_changed () {
- reset_view ();
- }
-
- [GtkCallback]
private void visible_child_changed () {
if (visible_child == empty_view || visible_child == content_view) {
header_bar.mode = HeaderBar.Mode.NORMAL;
@@ -442,7 +438,7 @@ public class Face : Gtk.Stack, Clocks.Clock {
public void reset_view () {
standalone_location = null;
- visible_child = content_view.empty ? empty_view : content_view;
+ visible_child = locations.get_n_items () == 0 ? empty_view : content_view;
}
public void update_header_bar () {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]