← Back to team overview

elementary-dev-community team mailing list archive

[Merge] lp:~elementary-dev-community/noise/fix-1089869 into lp:noise

 

Cameron Norman has proposed merging lp:~elementary-dev-community/noise/fix-1089869 into lp:noise.

Requested reviews:
  elementary Apps team (elementary-apps)

For more details, see:
https://code.launchpad.net/~elementary-dev-community/noise/fix-1089869/+merge/208528

This changes a couple things about the visibility and sensitivity of the search field and view selector.

1: the view selector is invisible if the list view or grid view is unavailable. This fixes #1089869 because the grid view is not available when the queue, device, et al lists are in use, and the view selector is made invisible.

2: the view selector and search field are invisible on the welcome screen.

3: the view selector is insensitive if the alert screen is present but the grid and list views are still available.
-- 
https://code.launchpad.net/~elementary-dev-community/noise/fix-1089869/+merge/208528
Your team elementary Developer Community is subscribed to branch lp:~elementary-dev-community/noise/fix-1089869.
=== modified file 'src/Views/Wrappers/ViewWrapper.vala'
--- src/Views/Wrappers/ViewWrapper.vala	2013-06-26 21:03:16 +0000
+++ src/Views/Wrappers/ViewWrapper.vala	2014-02-27 05:14:08 +0000
@@ -222,28 +222,26 @@
 
         debug ("update_library_window_widgets [%s]", hint.to_string());
 
-        // Insensitive if there's no media to search
-        
-        bool has_media = media_count > 0;
-        App.main_window.searchField.set_sensitive (has_media);
-
-        // Make the view switcher and search box insensitive if the current item
-        // is the welcome screen. The view selector will only be sensitive if both
-        // views are available.
-        App.main_window.viewSelector.set_sensitive (has_grid_view && has_list_view
-                                       && current_view != ViewType.ALERT
-                                       && current_view != ViewType.WELCOME);
-
-        bool column_browser_available = false;
-        bool column_browser_visible = false;
-
-        // Sensitive only if the column browser is available
-        column_browser_available = list_view.has_column_browser;
-        if (column_browser_available)
-            column_browser_visible = list_view.column_browser.visible;
-
-        App.main_window.viewSelector.set_column_browser_toggle_visible (column_browser_available);
-        App.main_window.viewSelector.set_column_browser_toggle_active (column_browser_visible);
+        // Search field
+        // Insensitive if there's no media to search (applies to ALERT view)
+        App.main_window.searchField.set_sensitive (media_count > 0);
+        // Invisible if the view is WELCOME
+        App.main_window.searchField.visible = !(current_view == ViewType.WELCOME);
+
+        // View switcher
+        // Insensitive if the view is ALERT
+        App.main_window.viewSelector.set_sensitive (current_view != ViewType.ALERT);
+        // Invisible if the current view is the welcome screen or if both views
+        // are not available (in the queue, device, or playlist lists).
+        App.main_window.viewSelector.visible = (has_grid_view && has_list_view
+                                                && current_view != ViewType.WELCOME);
+
+        // Set active mode to column view if it is visible. We have to ensure
+        // that it is not null because the column_browser is not guaranteed to
+        // exist. This is done separately from below because of ViewSelector's
+        // poor API.
+        App.main_window.viewSelector.set_column_browser_toggle_active (list_view.column_browser != null
+                                                                       && list_view.column_browser.visible);
 
         // select the right view in the view selector if it's one of the three views.
         // The order is important here. The sensitivity set above must be set before this,


Follow ups