[gnome-boxes] filter-switcher: Insensitive on 'no boxes'
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] filter-switcher: Insensitive on 'no boxes'
- Date: Thu, 24 Sep 2015 16:58:07 +0000 (UTC)
commit 3677fc4e7653c048bd25c8d15a4c0c522e4e3846
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Thu Sep 24 17:56:19 2015 +0100
filter-switcher: Insensitive on 'no boxes'
Where there is no boxes, the switcher is pretty much useless and hence
should be disabled.
https://bugzilla.gnome.org/show_bug.cgi?id=755468
src/collection-filter-switcher.vala | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/src/collection-filter-switcher.vala b/src/collection-filter-switcher.vala
index 5f36bdd..47c7867 100644
--- a/src/collection-filter-switcher.vala
+++ b/src/collection-filter-switcher.vala
@@ -18,6 +18,7 @@ private class Boxes.CollectionFilterSwitcher: Gtk.ButtonBox {
all_button.active = true;
activate_button (all_button);
+ App.app.call_when_ready (on_app_ready);
window.foreach_view ((view) => { view.filter.filter_func = null; });
}
@@ -41,6 +42,17 @@ private class Boxes.CollectionFilterSwitcher: Gtk.ButtonBox {
return (item is Machine) && !(item as Machine).is_local;
}
+ private void on_app_ready () {
+ update_sensitivity ();
+
+ App.app.collection.item_added.connect (update_sensitivity);
+ App.app.collection.item_removed.connect (update_sensitivity);
+ }
+
+ private void update_sensitivity () {
+ sensitive = (App.app.collection.items.length != 0);
+ }
+
[GtkCallback]
private void activate_button (Gtk.ToggleButton button) {
if (button == active_button)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]