[gnome-usage] power, data: Remove the Power and Data views



commit a13c1c50cb8e1a15bfb4035f8be70b9440a17521
Author: Karuna Grewal <karunagrewal98 gmail com>
Date:   Tue Oct 17 19:38:38 2017 +0530

    power, data: Remove the Power and Data views
    
    Earlier power and data views were being displayed.
    
    Temporarily the panels have been dropped by not instantising
    them in the views,until these views are up completely.
    
    Fixes #4

 src/data-view.vala         | 34 ----------------------------------
 src/header-bar.vala        | 32 +++++++++-----------------------
 src/meson.build            |  2 --
 src/power-view.vala        | 34 ----------------------------------
 src/storage-actionbar.vala | 34 +++++++++++++++++-----------------
 src/storage-graph.vala     |  2 +-
 src/storage-list-box.vala  | 10 +++++-----
 src/storage-row.vala       | 20 ++++++++++----------
 src/window.vala            | 20 ++++++++------------
 9 files changed, 50 insertions(+), 138 deletions(-)
---
diff --git a/src/header-bar.vala b/src/header-bar.vala
index e36b199..1374098 100644
--- a/src/header-bar.vala
+++ b/src/header-bar.vala
@@ -25,9 +25,7 @@ namespace Usage
     public enum HeaderBarMode
     {
         PERFORMANCE,
-        DATA,
         STORAGE,
-        POWER
     }
 
     [GtkTemplate (ui = "/org/gnome/Usage/ui/header-bar.ui")]
@@ -75,16 +73,12 @@ namespace Usage
                 case HeaderBarMode.PERFORMANCE:
                     performance_search_button.hide ();
                     break;
-                case HeaderBarMode.DATA:
-                    break;
                 case HeaderBarMode.STORAGE:
                     storage_back_button.hide ();
                     storage_rescan_button.hide ();
                     storage_select_button.hide ();
                     storage_cancel_button.hide ();
                     break;
-                case HeaderBarMode.POWER:
-                    break;
             }
 
             switch(mode)
@@ -94,9 +88,6 @@ namespace Usage
 
                     performance_search_button.show();
                     break;
-                case HeaderBarMode.DATA:
-                    show_stack_switcher();
-                    break;
                 case HeaderBarMode.STORAGE:
                     if(title_text == "")
                         show_stack_switcher();
@@ -107,9 +98,6 @@ namespace Usage
                     storage_select_button.show ();
 
                     break;
-                case HeaderBarMode.POWER:
-                    show_stack_switcher();
-                    break;
             }
             this.mode = mode;
            }
@@ -117,12 +105,12 @@ namespace Usage
         [GtkCallback]
         private void on_performance_search_button_toggled () {
             /* TODO: Implement a saner way of toggling this mode. */
-            ((PerformanceView) (GLib.Application.get_default() as 
Application).get_window().get_views()[0]).set_search_mode(performance_search_button.active);
+            ((PerformanceView) (GLib.Application.get_default() as 
Application).get_window().get_views()[Views.PERFORMANCE]).set_search_mode(performance_search_button.active);
         }
 
         [GtkCallback]
         private void on_storage_back_button_clicked () {
-            ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[2]).get_storage_list_box().on_back_button_clicked();
+            ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[Views.STORAGE]).get_storage_list_box().on_back_button_clicked();
         }
 
         [GtkCallback]
@@ -134,7 +122,7 @@ namespace Usage
 
             storage_back_button.hide ();
             StorageAnalyzer.get_default().create_cache.begin(true);
-            ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[2]).get_storage_list_box().reload();
+            ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[Views.STORAGE]).get_storage_list_box().reload();
         }
 
         [GtkCallback]
@@ -201,9 +189,7 @@ namespace Usage
                 case HeaderBarMode.PERFORMANCE:
                     performance_search_button.set_active(!performance_search_button.get_active());
                     break;
-                case HeaderBarMode.DATA:
                 case HeaderBarMode.STORAGE:
-                case HeaderBarMode.POWER:
                     break;
             }
         }
@@ -216,8 +202,8 @@ namespace Usage
                 storage_select_button.hide ();
                 storage_back_button.hide();
                 storage_cancel_button.show();
-                ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[2]).show_action_bar(true);
-                ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[2]).get_storage_list_box().set_select_mode(true);
+                ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[Views.STORAGE]).show_action_bar(true);
+                ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[Views.STORAGE]).get_storage_list_box().set_select_mode(true);
 
                 var menu = new GLib.Menu ();
                 var item = new GLib.MenuItem (_("Select all"), "headerbar.select-all");
@@ -254,8 +240,8 @@ namespace Usage
                     show_stack_switcher();
                 else
                     show_title();
-                ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[2]).show_action_bar(false);
-                ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[2]).get_storage_list_box().set_select_mode(false);
+                ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[Views.STORAGE]).show_action_bar(false);
+                ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[Views.STORAGE]).get_storage_list_box().set_select_mode(false);
                 this.get_style_context().remove_class("selection-mode");
                 this.show_close_button = true;
             }
@@ -263,13 +249,13 @@ namespace Usage
 
         private void select_all()
         {
-            ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[2]).get_storage_list_box().select_all_rows();
+            ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[Views.STORAGE]).get_storage_list_box().select_all_rows();
 
         }
 
         private void select_none()
         {
-            ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[2]).get_storage_list_box().unselect_all_rows();
+            ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[Views.STORAGE]).get_storage_list_box().unselect_all_rows();
         }
     }
 }
diff --git a/src/meson.build b/src/meson.build
index dd14435..a2ca3f9 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -6,7 +6,6 @@ vala_sources = [
     'cpu-graph.vala',
     'cpu-monitor.vala',
     'cpu-sub-view.vala',
-    'data-view.vala',
     'gnome-usage.vala',
     'graph-block-row.vala',
     'graph-block.vala',
@@ -21,7 +20,6 @@ vala_sources = [
     'monitor.vala',
     'performance-view.vala',
     'pie-chart.vala',
-    'power-view.vala',
     'process-dialog.vala',
     'process-list-box.vala',
     'process-row.vala',
diff --git a/src/storage-actionbar.vala b/src/storage-actionbar.vala
index d15effc..1abb517 100644
--- a/src/storage-actionbar.vala
+++ b/src/storage-actionbar.vala
@@ -112,7 +112,7 @@ namespace Usage
             chooser.destroy_with_parent = true;
             Gtk.FileFilter filter = new Gtk.FileFilter();
             filter.add_custom(Gtk.FileFilterFlags.FILENAME, (filter_info) => {
-                foreach (Gtk.ListBoxRow row in ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[2]).get_storage_list_box().get_selected_rows())
+                foreach (Gtk.ListBoxRow row in ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[Views.STORAGE]).get_storage_list_box().get_selected_rows())
                 {
                     StorageRow storage_row = (StorageRow) row;
                     if(filter_info.filename == storage_row.get_item_path())
@@ -121,7 +121,7 @@ namespace Usage
                 return true;
             });
             chooser.set_filter(filter);
-            StorageRow storage_row = (StorageRow) ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[2]).get_storage_list_box().get_selected_row();
+            StorageRow storage_row = (StorageRow) ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[Views.STORAGE]).get_storage_list_box().get_selected_row();
             chooser.set_filename(storage_row.get_item_path());
             chooser.show();
 
@@ -129,12 +129,12 @@ namespace Usage
             {
                Timeout.add(0, () => {
                     var storage_analyzer = StorageAnalyzer.get_default();
-                    foreach (Gtk.ListBoxRow row in ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[2]).get_storage_list_box().get_selected_rows())
+                    foreach (Gtk.ListBoxRow row in ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[Views.STORAGE]).get_storage_list_box().get_selected_rows())
                     {
                         StorageRow actual_storage_row = (StorageRow) row;
                         string destination = chooser.get_file().get_parse_name() + "/" + 
Path.get_basename(actual_storage_row.get_item_path());
                         
storage_analyzer.move_file.begin(File.new_for_path(actual_storage_row.get_item_path()), 
File.new_for_path(destination), () => {
-                            ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[2]).get_storage_list_box().refresh();
+                            ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[Views.STORAGE]).get_storage_list_box().refresh();
                         });
                     }
                     hide_selection_mode();
@@ -148,7 +148,7 @@ namespace Usage
         private void delete_clicked()
         {
             string files = "";
-            foreach (Gtk.ListBoxRow row in ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[2]).get_storage_list_box().get_selected_rows())
+            foreach (Gtk.ListBoxRow row in ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[Views.STORAGE]).get_storage_list_box().get_selected_rows())
             {
                 StorageRow storage_row = (StorageRow) row;
                 if(files != "")
@@ -164,11 +164,11 @@ namespace Usage
             {
                Timeout.add(0, () => {
                     var storage_analyzer = StorageAnalyzer.get_default();
-                    foreach (Gtk.ListBoxRow row in ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[2]).get_storage_list_box().get_selected_rows())
+                    foreach (Gtk.ListBoxRow row in ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[Views.STORAGE]).get_storage_list_box().get_selected_rows())
                     {
                         StorageRow storage_row = (StorageRow) row;
                         storage_analyzer.delete_file.begin(storage_row.get_item_path(), () => {
-                            ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[2]).get_storage_list_box().refresh();
+                            ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[Views.STORAGE]).get_storage_list_box().refresh();
                         });
                     }
                     hide_selection_mode();
@@ -184,12 +184,12 @@ namespace Usage
         private void move_to_trash_clicked()
         {
             Timeout.add(0, () => {
-                foreach (Gtk.ListBoxRow row in ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[2]).get_storage_list_box().get_selected_rows())
+                foreach (Gtk.ListBoxRow row in ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[Views.STORAGE]).get_storage_list_box().get_selected_rows())
                 {
                     var storage_analyzer = StorageAnalyzer.get_default();
                     StorageRow storage_row = (StorageRow) row;
                     storage_analyzer.trash_file.begin(storage_row.get_item_path(), () => {
-                        ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[2]).get_storage_list_box().refresh();
+                        ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[Views.STORAGE]).get_storage_list_box().refresh();
                     });
                 }
                 hide_selection_mode();
@@ -203,7 +203,7 @@ namespace Usage
             Timeout.add(0, () => {
                 string folders = "";
                 var storage_analyzer = StorageAnalyzer.get_default();
-                foreach (Gtk.ListBoxRow row in ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[2]).get_storage_list_box().get_selected_rows())
+                foreach (Gtk.ListBoxRow row in ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[Views.STORAGE]).get_storage_list_box().get_selected_rows())
                 {
                     StorageRow storage_row = (StorageRow) row;
                     if(storage_row.get_item_type() == StorageItemType.TRASH)
@@ -215,7 +215,7 @@ namespace Usage
                         if(dialog.run() == Gtk.ResponseType.OK)
                         {
                             storage_analyzer.wipe_trash.begin(() => {
-                                ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[2]).get_storage_list_box().refresh();
+                                ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[Views.STORAGE]).get_storage_list_box().refresh();
                             });
                         }
                         dialog.destroy();
@@ -236,11 +236,11 @@ namespace Usage
 
                     if(dialog.run() == Gtk.ResponseType.OK)
                     {
-                        foreach (Gtk.ListBoxRow row in ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[2]).get_storage_list_box().get_selected_rows())
+                        foreach (Gtk.ListBoxRow row in ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[Views.STORAGE]).get_storage_list_box().get_selected_rows())
                         {
                             StorageRow storage_row = (StorageRow) row;
                             storage_analyzer.wipe_folder.begin(storage_row.get_item_path(), () => {
-                                ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[2]).get_storage_list_box().refresh();
+                                ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[Views.STORAGE]).get_storage_list_box().refresh();
                             });
                         }
 
@@ -257,11 +257,11 @@ namespace Usage
         {
             Timeout.add(0, () => {
                 var storage_analyzer = StorageAnalyzer.get_default();
-                foreach (Gtk.ListBoxRow row in ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[2]).get_storage_list_box().get_selected_rows())
+                foreach (Gtk.ListBoxRow row in ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[Views.STORAGE]).get_storage_list_box().get_selected_rows())
                 {
                     StorageRow storage_row = (StorageRow) row;
                     storage_analyzer.restore_trash_file.begin(storage_row.get_item_path(), () => {
-                        ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[2]).get_storage_list_box().refresh();
+                        ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[Views.STORAGE]).get_storage_list_box().refresh();
                     });
                 }
                 hide_selection_mode();
@@ -274,11 +274,11 @@ namespace Usage
         {
             Timeout.add(0, () => {
                 var storage_analyzer = StorageAnalyzer.get_default();
-                foreach (Gtk.ListBoxRow row in ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[2]).get_storage_list_box().get_selected_rows())
+                foreach (Gtk.ListBoxRow row in ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[Views.STORAGE]).get_storage_list_box().get_selected_rows())
                 {
                     StorageRow storage_row = (StorageRow) row;
                     storage_analyzer.delete_trash_file.begin(storage_row.get_item_path(), () => {
-                        ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[2]).get_storage_list_box().refresh();
+                        ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[Views.STORAGE]).get_storage_list_box().refresh();
                     });
                 }
                 hide_selection_mode();
diff --git a/src/storage-graph.vala b/src/storage-graph.vala
index 08ad80e..6605640 100644
--- a/src/storage-graph.vala
+++ b/src/storage-graph.vala
@@ -204,7 +204,7 @@ namespace Usage
             int height = this.get_allocated_height ();
             int width = this.get_allocated_width ();
 
-            var storage_list_box = ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[2]).get_storage_list_box();
+            var storage_list_box = ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[Views.STORAGE]).get_storage_list_box();
             var model = storage_list_box.get_model();
 
             var two_graphs = false;
diff --git a/src/storage-list-box.vala b/src/storage-list-box.vala
index 593ca50..3cb986b 100644
--- a/src/storage-list-box.vala
+++ b/src/storage-list-box.vala
@@ -156,11 +156,11 @@ namespace Usage
                 });
 
                 if(root)
-                    ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[2]).get_action_bar().show_root();
+                    ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[Views.STORAGE]).get_action_bar().show_root();
                 else if(actual_parent_type == StorageItemType.TRASH)
-                    ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[2]).get_action_bar().show_trash();
+                    ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[Views.STORAGE]).get_action_bar().show_trash();
                 else if(actual_parent_type != StorageItemType.TRASHFILE && actual_parent_type != 
StorageItemType.TRASHSUBFILE)
-                    ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[2]).get_action_bar().show_common();
+                    ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[Views.STORAGE]).get_action_bar().show_common();
 
                 on_selected_rows_changed();
             }
@@ -342,9 +342,9 @@ namespace Usage
         {
             (GLib.Application.get_default() as 
Application).get_window().get_header_bar().change_selected_items(get_selected_rows().length());
             if(get_selected_rows().length() > 0)
-                ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[2]).get_action_bar().set_sensitive_all(true);
+                ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[Views.STORAGE]).get_action_bar().set_sensitive_all(true);
             else
-                ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[2]).get_action_bar().set_sensitive_all(false);
+                ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[Views.STORAGE]).get_action_bar().set_sensitive_all(false);
         }
 
         private Gtk.Widget on_row_created(Object item)
diff --git a/src/storage-row.vala b/src/storage-row.vala
index adeed3c..a10003a 100644
--- a/src/storage-row.vala
+++ b/src/storage-row.vala
@@ -127,9 +127,9 @@ namespace Usage
             {
                 check_button.toggled.connect(() => {
                     if(check_button.get_active())
-                        ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[2]).get_storage_list_box().select_row(this);
+                        ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[Views.STORAGE]).get_storage_list_box().select_row(this);
                     else
-                        ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[2]).get_storage_list_box().unselect_row(this);
+                        ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[Views.STORAGE]).get_storage_list_box().unselect_row(this);
                 });
                 box.pack_start(check_button, false, false, 5);
             }
@@ -297,7 +297,7 @@ namespace Usage
             Timeout.add(0, () => {
                 var storage_analyzer = StorageAnalyzer.get_default();
                 storage_analyzer.restore_trash_file.begin(item_path, () => {
-                    ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[2]).get_storage_list_box().refresh();
+                    ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[Views.STORAGE]).get_storage_list_box().refresh();
                 });
 
                 return false;
@@ -309,7 +309,7 @@ namespace Usage
             Timeout.add(0, () => {
                 var storage_analyzer = StorageAnalyzer.get_default();
                 storage_analyzer.delete_trash_file.begin(item_path, () => {
-                    ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[2]).get_storage_list_box().refresh();
+                    ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[Views.STORAGE]).get_storage_list_box().refresh();
                 });
 
                 return false;
@@ -327,7 +327,7 @@ namespace Usage
                Timeout.add(0, () => {
                     var storage_analyzer = StorageAnalyzer.get_default();
                     storage_analyzer.wipe_folder.begin(item_path, () => {
-                        ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[2]).get_storage_list_box().refresh();
+                        ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[Views.STORAGE]).get_storage_list_box().refresh();
                     });
 
                     return false;
@@ -347,7 +347,7 @@ namespace Usage
                Timeout.add(0, () => {
                     var storage_analyzer = StorageAnalyzer.get_default();
                     storage_analyzer.wipe_trash.begin(() => {
-                        ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[2]).get_storage_list_box().refresh();
+                        ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[Views.STORAGE]).get_storage_list_box().refresh();
                     });
 
                     return false;
@@ -371,7 +371,7 @@ namespace Usage
                     string destination = Path.get_dirname(item_path) + "/" + entry.get_text();
                     var storage_analyzer = StorageAnalyzer.get_default();
                     storage_analyzer.move_file.begin(File.new_for_path(item_path), 
File.new_for_path(destination), () => {
-                        ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[2]).get_storage_list_box().refresh();
+                        ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[Views.STORAGE]).get_storage_list_box().refresh();
                     });
 
                     return false;
@@ -412,7 +412,7 @@ namespace Usage
                    string destination = chooser.get_file().get_parse_name() + "/" + 
Path.get_basename(item_path);
                     var storage_analyzer = StorageAnalyzer.get_default();
                     storage_analyzer.move_file.begin(File.new_for_path(item_path), 
File.new_for_path(destination), () => {
-                        ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[2]).get_storage_list_box().refresh();
+                        ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[Views.STORAGE]).get_storage_list_box().refresh();
                     });
 
                     return false;
@@ -426,7 +426,7 @@ namespace Usage
             Timeout.add(0, () => {
                 var storage_analyzer = StorageAnalyzer.get_default();
                 storage_analyzer.trash_file.begin(item_path, () => {
-                    ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[2]).get_storage_list_box().refresh();
+                    ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[Views.STORAGE]).get_storage_list_box().refresh();
                 });
 
                 return false;
@@ -444,7 +444,7 @@ namespace Usage
                Timeout.add(0, () => {
                     var storage_analyzer = StorageAnalyzer.get_default();
                     storage_analyzer.delete_file.begin(item_path, () => {
-                        ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[2]).get_storage_list_box().refresh();
+                        ((StorageView) (GLib.Application.get_default() as 
Application).get_window().get_views()[Views.STORAGE]).get_storage_list_box().refresh();
                     });
 
                     return false;
diff --git a/src/window.vala b/src/window.vala
index 5e1304a..2cce793 100644
--- a/src/window.vala
+++ b/src/window.vala
@@ -20,6 +20,12 @@
 
 namespace Usage
 {
+    public enum Views
+    {
+        PERFORMANCE,
+        STORAGE,
+    }
+
     public class Window : Gtk.ApplicationWindow
     {
         private Usage.HeaderBar header_bar;
@@ -47,32 +53,22 @@ namespace Usage
             views = new View[]
             {
                 new PerformanceView(),
-                new DataView(),
                 new StorageView(),
-                new PowerView()
             };
 
             foreach(var view in views)
                 stack.add_titled(view, view.name, view.title);
 
             stack.notify.connect(() => {
-                if(stack.visible_child_name == views[0].name)
+                if(stack.visible_child_name == views[Views.PERFORMANCE].name)
                 {
                     header_bar.set_mode(HeaderBarMode.PERFORMANCE);
                 }
-                else if(stack.visible_child_name == views[1].name)
-                {
-                    header_bar.set_mode(HeaderBarMode.DATA);
-                }
-                else if(stack.visible_child_name == views[2].name)
+                else if(stack.visible_child_name == views[Views.STORAGE].name)
                 {
                     header_bar.set_mode(HeaderBarMode.STORAGE);
                     StorageAnalyzer.get_default().create_cache.begin();
                 }
-                else if(stack.visible_child_name == views[3].name)
-                {
-                    header_bar.set_mode(HeaderBarMode.POWER);
-                }
             });
 
             this.add(stack);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]