=== modified file 'plugins/unityshell/src/DashView.cpp'
--- plugins/unityshell/src/DashView.cpp	2011-08-30 16:04:19 +0000
+++ plugins/unityshell/src/DashView.cpp	2011-09-01 12:59:25 +0000
@@ -24,6 +24,7 @@
 
 #include <NuxCore/Logger.h>
 #include <UnityCore/GLibWrapper.h>
+#include <UnityCore/RadioOptionFilter.h>
 
 #include "PlacesStyle.h"
 #include "DashSettings.h"
@@ -45,6 +46,7 @@
   : nux::View(NUX_TRACKER_LOCATION)
   , active_lens_view_(0)
   , last_activated_uri_("")
+  , visible_(false)
 
 {
   SetupBackground();
@@ -68,6 +70,7 @@
 void DashView::AboutToShow()
 {
   ubus_manager_.SendMessage(UBUS_BACKGROUND_REQUEST_COLOUR_EMIT);
+  visible_ = true;
   bg_effect_helper_.enabled = true;
   search_bar_->text_entry()->SelectAll();
   search_bar_->text_entry()->SetFocused(true);
@@ -75,6 +78,7 @@
 
 void DashView::AboutToHide()
 {
+  visible_ = false;
   bg_effect_helper_.enabled = false;
 }
 
@@ -463,18 +467,87 @@
 
 void DashView::OnActivateRequest(GVariant* args)
 {
-  glib::String id;
+  glib::String uri;
   glib::String search_string;
 
-  g_variant_get(args, "(sus)", &id, NULL, &search_string);
-
-  lens_bar_->Activate(id.Str());
+  g_variant_get(args, "(sus)", &uri, NULL, &search_string);
+
+  std::string id = AnalyseLensURI(uri.Str());
+
+  home_view_->search_string = "";
+  lens_bar_->Activate(id);
 
   // Reset focus
   SetFocused(false);
   SetFocused(true);
 
-  ubus_manager_.SendMessage(UBUS_DASH_EXTERNAL_ACTIVATION);
+  if (id == "home.lens" || !visible_)
+    ubus_manager_.SendMessage(UBUS_DASH_EXTERNAL_ACTIVATION);
+}
+
+std::string DashView::AnalyseLensURI(std::string uri)
+{
+  std::string id = uri;
+  std::size_t pos = uri.find("?");
+  
+  // It is a real URI
+  if (pos)
+  {
+    id = uri.substr(0, pos);
+
+    std::string components = uri.substr(++pos);
+    gchar** tokens = g_strsplit(components.c_str(), "&", -1);
+    
+    for (int i = 0; tokens[i]; ++i)
+    {
+      gchar** subs = g_strsplit(tokens[i], "=", 2);
+
+      if (g_str_has_prefix(subs[0], "filter_"))
+      {
+        UpdateLensFilter(id, subs[0] + 7, subs[1]);
+        lens_views_[id]->filters_expanded = true;
+      }
+
+      g_strfreev(subs);
+    }
+
+    g_strfreev(tokens);
+  }
+
+  return id;
+}
+
+void DashView::UpdateLensFilter(std::string lens_id, std::string filter_name, std::string value)
+{
+  if (lenses_.GetLens(lens_id))
+  {
+    Lens::Ptr lens = lenses_.GetLens(lens_id);
+
+    Filters::Ptr filters = lens->filters;
+
+    for (unsigned int i = 0; i < filters->count(); ++i)
+    {
+      Filter::Ptr filter = filters->FilterAtIndex(i);
+
+      if (filter->id() == filter_name)
+      {
+        UpdateLensFilterValue(filter, value);
+      }
+    }
+  }
+}
+
+void DashView::UpdateLensFilterValue(Filter::Ptr filter, std::string value)
+{
+  if (filter->renderer_name == "filter-radiooption")
+  {
+    RadioOptionFilter::Ptr radio = std::static_pointer_cast<RadioOptionFilter>(filter);
+    for (auto option: radio->options())
+    {
+      if (option->id == value)
+        option->active = true;
+    }
+  }
 }
 
 void DashView::OnBackgroundColorChanged(GVariant* args)

=== modified file 'plugins/unityshell/src/DashView.h'
--- plugins/unityshell/src/DashView.h	2011-08-25 10:18:58 +0000
+++ plugins/unityshell/src/DashView.h	2011-09-01 12:59:25 +0000
@@ -81,6 +81,9 @@
   bool DoFallbackActivation(std::string const& uri);
   bool LaunchApp(std::string const& appname);
   void OnEntryActivated();
+  std::string AnalyseLensURI(std::string uri);
+  void UpdateLensFilter(std::string lens, std::string filter, std::string value);
+  void UpdateLensFilterValue(Filter::Ptr filter, std::string value);
   
   bool AcceptKeyNavFocus();
   bool InspectKeyEvent(unsigned int eventType, unsigned int key_sym, const char* character);
@@ -112,6 +115,8 @@
   nux::ObjectPtr <nux::IOpenGLBaseTexture> bg_blur_texture_;
 
   std::string last_activated_uri_;
+  
+  bool visible_;
 };
 
 

=== modified file 'plugins/unityshell/src/LensView.cpp'
--- plugins/unityshell/src/LensView.cpp	2011-08-31 16:52:32 +0000
+++ plugins/unityshell/src/LensView.cpp	2011-09-01 12:59:25 +0000
@@ -161,6 +161,13 @@
   group->SetChildView(grid);
 
   scroll_layout_->AddView(group, 0);
+
+  Categories::Ptr categories = lens_->categories;
+  if (category.index + 1 == categories->count())
+  {
+    lens_->Search("---");
+    lens_->Search("");
+  }
 }
 
 void LensView::OnResultAdded(Result const& result)

=== modified file 'plugins/unityshell/src/PlacesGroup.cpp'
--- plugins/unityshell/src/PlacesGroup.cpp	2011-08-24 22:28:46 +0000
+++ plugins/unityshell/src/PlacesGroup.cpp	2011-09-01 12:59:25 +0000
@@ -266,17 +266,20 @@
 gboolean
 PlacesGroup::OnIdleRelayout(PlacesGroup* self)
 {
-  self->Refresh();
-  self->QueueDraw();
-  self->_group_layout->QueueDraw();
-  self->GetChildView()->QueueDraw();
-  self->ComputeChildLayout();
-  self->_idle_id = 0;
-
-  if (self->GetFocused())
+  if (self->GetChildView())
   {
-    self->SetFocused(false);  // unset focus on all children
-    self->SetFocused(true);  // set focus on first child
+    self->Refresh();
+    self->QueueDraw();
+    self->_group_layout->QueueDraw();
+    self->GetChildView()->QueueDraw();
+    self->ComputeChildLayout();
+    self->_idle_id = 0;
+
+    if (self->GetFocused())
+    {
+      self->SetFocused(false);  // unset focus on all children
+      self->SetFocused(true);  // set focus on first child
+    }
   }
 
   return FALSE;

=== modified file 'plugins/unityshell/src/PlacesHomeView.cpp'
--- plugins/unityshell/src/PlacesHomeView.cpp	2011-08-30 16:04:19 +0000
+++ plugins/unityshell/src/PlacesHomeView.cpp	2011-09-01 12:59:25 +0000
@@ -41,18 +41,16 @@
 
 #include "PlacesSimpleTile.h"
 #include "PlacesStyle.h"
+#include <UnityCore/GLibWrapper.h>
 #include <UnityCore/Variant.h>
 
 #include <string>
 #include <vector>
 
-#define DESKTOP_DIR  "/desktop/gnome/applications"
-#define BROWSER_DIR  DESKTOP_DIR"/browser"
-#define MAIL_DIR     "/desktop/gnome/url-handlers/mailto"
-#define MEDIA_DIR    DESKTOP_DIR"/media"
-
 #define DELTA_DOUBLE_REQUEST 500000000
 
+using namespace unity;
+
 enum
 {
   TYPE_PLACE = 0,
@@ -101,47 +99,14 @@
   _layout->SetChildrenSize(style->GetHomeTileWidth(), style->GetHomeTileHeight());
   _layout->EnablePartialVisibility(false);
   _layout->SetHeightMatchContent(true);
-  //_layout->SetVerticalExternalMargin(24);
   _layout->SetHorizontalExternalMargin(32);
   _layout->SetVerticalInternalMargin(32);
   _layout->SetHorizontalInternalMargin(32);
   _layout->SetMinMaxSize((style->GetHomeTileWidth() * 4) + (32 * 5),
                          (style->GetHomeTileHeight() * 2) + 32);
 
-  _client = gconf_client_get_default();
-  gconf_client_add_dir(_client,
-                       BROWSER_DIR,
-                       GCONF_CLIENT_PRELOAD_NONE,
-                       NULL);
-  gconf_client_add_dir(_client,
-                       MAIL_DIR,
-                       GCONF_CLIENT_PRELOAD_NONE,
-                       NULL);
-  gconf_client_add_dir(_client,
-                       MEDIA_DIR,
-                       GCONF_CLIENT_PRELOAD_NONE,
-                       NULL);
-  _browser_gconf_notify = gconf_client_notify_add(_client,
-                                                  BROWSER_DIR"/exec",
-                                                  (GConfClientNotifyFunc)OnKeyChanged,
-                                                  this,
-                                                  NULL, NULL);
-  _mail_gconf_notify =  gconf_client_notify_add(_client,
-                                                MAIL_DIR"/command",
-                                                (GConfClientNotifyFunc)OnKeyChanged,
-                                                this,
-                                                NULL, NULL);
-  _media_gconf_notify = gconf_client_notify_add(_client,
-                                                MEDIA_DIR"/exec",
-                                                (GConfClientNotifyFunc)OnKeyChanged,
-                                                this,
-                                                NULL, NULL);
-
-  _last_activate_time.tv_sec = 0;
-  _last_activate_time.tv_nsec = 0;
-
   _ubus_handle = ubus_server_register_interest(ubus_server_get_default(),
-                                               UBUS_DASH_EXTERNAL_ACTIVATION,
+                                               UBUS_PLACE_VIEW_SHOWN,
                                                (UBusCallback) &PlacesHomeView::DashVisible,
                                                this);
 
@@ -175,47 +140,14 @@
 
 PlacesHomeView::~PlacesHomeView()
 {
-  g_object_unref(_client);
-
   if (_ubus_handle != 0)
     ubus_server_unregister_interest(ubus_server_get_default(), _ubus_handle);
-
-  if (_browser_gconf_notify)
-    gconf_client_notify_remove(_client, _browser_gconf_notify);
-  if (_mail_gconf_notify)
-    gconf_client_notify_remove(_client, _mail_gconf_notify);
-  if (_media_gconf_notify)
-    gconf_client_notify_remove(_client, _media_gconf_notify);
-  gconf_client_remove_dir(_client, BROWSER_DIR, NULL);
-  gconf_client_remove_dir(_client, MAIL_DIR, NULL);
-  gconf_client_remove_dir(_client, MEDIA_DIR, NULL);
 }
 
 void
 PlacesHomeView::DashVisible(GVariant* data, void* val)
 {
   PlacesHomeView* self = (PlacesHomeView*)val;
-
-  struct timespec event_time, delta;
-  clock_gettime(CLOCK_MONOTONIC, &event_time);
-  delta = self->time_diff(self->_last_activate_time, event_time);
-
-  self->_last_activate_time.tv_sec = event_time.tv_sec;
-  self->_last_activate_time.tv_nsec = event_time.tv_nsec;
-
-  // FIXME: this should be handled by ubus (not sending the request twice
-  // for some selected ones). Too intrusive for now.
-  if (!((delta.tv_sec == 0) && (delta.tv_nsec < DELTA_DOUBLE_REQUEST)))
-    self->Refresh();
-
-}
-
-void
-PlacesHomeView::OnKeyChanged(GConfClient*    client,
-                             guint           cnxn_id,
-                             GConfEntry*     entry,
-                             PlacesHomeView* self)
-{
   self->Refresh();
 }
 
@@ -236,7 +168,7 @@
                           markup,
                           icon_size);
   shortcut->_id = TYPE_PLACE;
-  shortcut->_place_id = g_strdup("/com/canonical/unity/applicationsplace/applications");
+  shortcut->_place_id = g_strdup("applications.lens?filter_type=media");
   shortcut->_place_section = 9;
   _layout->AddView(shortcut, 1, nux::eLeft, nux::eFull);
   shortcut->sigClick.connect(sigc::mem_fun(this, &PlacesHomeView::OnShortcutClicked));
@@ -248,7 +180,7 @@
                           markup,
                           icon_size);
   shortcut->_id = TYPE_PLACE;
-  shortcut->_place_id = g_strdup("/com/canonical/unity/applicationsplace/applications");
+  shortcut->_place_id = g_strdup("applications.lens?filter_type=internet");
   shortcut->_place_section = 8;
   _layout->AddView(shortcut, 1, nux::eLeft, nux::eFull);
   shortcut->sigClick.connect(sigc::mem_fun(this, &PlacesHomeView::OnShortcutClicked));
@@ -260,7 +192,7 @@
                           markup,
                           icon_size);
   shortcut->_id = TYPE_PLACE;
-  shortcut->_place_id = g_strdup("/com/canonical/unity/applicationsplace/applications");
+  shortcut->_place_id = g_strdup("applications.lens");
   shortcut->_place_section = 0;
   _layout->AddView(shortcut, 1, nux::eLeft, nux::eFull);
   shortcut->sigClick.connect(sigc::mem_fun(this, &PlacesHomeView::OnShortcutClicked));
@@ -272,33 +204,25 @@
                           markup,
                           icon_size);
   shortcut->_id = TYPE_PLACE;
-  shortcut->_place_id = g_strdup("/com/canonical/unity/filesplace/files");
+  shortcut->_place_id = g_strdup("files.lens");
   shortcut->_place_section = 0;
   _layout->AddView(shortcut, 1, nux::eLeft, nux::eFull);
   shortcut->sigClick.connect(sigc::mem_fun(this, &PlacesHomeView::OnShortcutClicked));
   g_free(markup);
 
   // Browser
-  markup = gconf_client_get_string(_client, BROWSER_DIR"/exec", NULL);
-  CreateShortcutFromExec(markup, _("Browse the Web"), _browser_alternatives);
-  g_free(markup);
+  CreateShortcutFromMime("x-scheme-handler/http", _("Browse the Web"), _browser_alternatives);
 
   // Photos
   // FIXME: Need to figure out the default
   CreateShortcutFromExec("shotwell", _("View Photos"), _photo_alternatives);
 
-  // Email
-  markup = gconf_client_get_string(_client, MAIL_DIR"/command", NULL);
-  // get the first word on key (the executable name itself)
-  gchar** temp_array = g_strsplit(markup, " ", 0);
-  g_free(markup);
-  CreateShortcutFromExec(temp_array[0], _("Check Email"), _email_alternatives);
-  g_strfreev(temp_array);
-
-  // Music
-  markup = gconf_client_get_string(_client, MEDIA_DIR"/exec", NULL);
-  CreateShortcutFromExec(markup, _("Listen to Music"), _music_alternatives);
-  g_free(markup);
+  CreateShortcutFromMime("x-scheme-handler/mailto", _("Check Email"), _email_alternatives);
+
+  CreateShortcutFromMime("audio/x-vorbis+ogg", _("Listen to Music"), _music_alternatives);
+
+  SetExpanded(true);
+  SetCounts(8, 8);
 
   QueueDraw();
   _layout->QueueDraw();
@@ -373,6 +297,41 @@
   g_free(markup);
 }
 
+void PlacesHomeView::CreateShortcutFromMime(const char* mime,
+                                            const char* name,
+                                            std::vector<std::string>& alternatives)
+{
+  PlacesStyle* style = PlacesStyle::GetDefault();
+  GAppInfo* info = g_app_info_get_default_for_type(mime, FALSE);
+
+  // If it was invalid check alternatives for backup
+  if (!G_IS_DESKTOP_APP_INFO(info))
+  {
+    for (auto alt: alternatives)
+    {
+      std::string id = alt + ".desktop";
+      info = G_APP_INFO(g_desktop_app_info_new(id.c_str()));
+      
+      if (G_IS_DESKTOP_APP_INFO(info))
+        break;
+    }
+  }
+
+  if (G_IS_DESKTOP_APP_INFO(info))
+  {
+    glib::String icon(g_icon_to_string(g_app_info_get_icon(G_APP_INFO(info))));
+    glib::String markup(g_strdup_printf("<big>%s</big>", name));
+    
+    Shortcut*   shortcut = new Shortcut(icon.Value(), markup.Value(), style->GetHomeTileIconSize());
+    shortcut->_id = TYPE_EXEC;
+    shortcut->_exec = g_strdup (g_app_info_get_executable(G_APP_INFO(info)));;
+    shortcut->sigClick.connect(sigc::mem_fun(this, &PlacesHomeView::OnShortcutClicked));
+    _layout->AddView(shortcut, 1, nux::eLeft, nux::eFull);
+
+    g_object_unref(info);
+  }
+}
+
 void
 PlacesHomeView::OnShortcutClicked(PlacesTile* tile)
 {
@@ -423,19 +382,3 @@
   unity::variant::BuilderWrapper(builder).add(GetGeometry());
 }
 
-// TODO: put that in some "util" toolbox
-struct timespec PlacesHomeView::time_diff(struct timespec start, struct timespec end)
-{
-  struct timespec temp;
-  if ((end.tv_nsec - start.tv_nsec) < 0)
-  {
-    temp.tv_sec = end.tv_sec - start.tv_sec - 1;
-    temp.tv_nsec = 1000000000 + end.tv_nsec - start.tv_nsec;
-  }
-  else
-  {
-    temp.tv_sec = end.tv_sec - start.tv_sec;
-    temp.tv_nsec = end.tv_nsec - start.tv_nsec;
-  }
-  return temp;
-}

=== modified file 'plugins/unityshell/src/PlacesHomeView.h'
--- plugins/unityshell/src/PlacesHomeView.h	2011-08-11 01:32:45 +0000
+++ plugins/unityshell/src/PlacesHomeView.h	2011-09-01 12:59:25 +0000
@@ -32,9 +32,6 @@
 #include "PlacesTile.h"
 #include "PlacesGroup.h"
 
-#include <gconf/gconf-client.h>
-#include <time.h>
-
 class PlacesHomeView : public unity::Introspectable, public PlacesGroup
 {
 public:
@@ -52,29 +49,21 @@
 private:
   static void DashVisible(GVariant* data, void* val);
   void OnShortcutClicked(PlacesTile* _tile);
-  static void OnKeyChanged(GConfClient*    client,
-                           guint           cnxn_id,
-                           GConfEntry*     entry,
-                           PlacesHomeView* self);
   void CreateShortcutFromExec(const char* exec,
                               const char* name,
                               std::vector<std::string>& alternatives);
+  void CreateShortcutFromMime(const char* mime,
+                              const char* name,
+                              std::vector<std::string>& alternatives);
 
 private:
   nux::GridHLayout*        _layout;
-  GConfClient* _client;
   std::vector<std::string> _browser_alternatives;
   std::vector<std::string> _photo_alternatives;
   std::vector<std::string> _email_alternatives;
   std::vector<std::string> _music_alternatives;
 
-  struct timespec time_diff(struct timespec start, struct timespec end);
-  struct timespec _last_activate_time;
-
   guint _ubus_handle;
-  guint _browser_gconf_notify;
-  guint _mail_gconf_notify;
-  guint _media_gconf_notify;
 };
 
 

