summaryrefslogtreecommitdiff
diff options
-rw-r--r--src/PlaceEntry.h1
-rw-r--r--src/PlaceEntryHome.cpp205
-rw-r--r--src/PlaceEntryHome.h88
-rw-r--r--src/PlaceEntryRemote.cpp29
-rw-r--r--src/PlaceEntryRemote.h4
-rw-r--r--src/PlacesController.cpp2
-rw-r--r--src/PlacesResultsView.cpp2
-rw-r--r--src/PlacesSearchBar.cpp5
-rw-r--r--src/PlacesSearchBar.h2
-rw-r--r--src/PlacesSimpleTile.cpp1
-rw-r--r--src/PlacesView.cpp123
-rw-r--r--src/PlacesView.h7
-rw-r--r--tests/CMakeLists.txt2
-rw-r--r--tests/TestPlaces.cpp8
14 files changed, 425 insertions, 54 deletions
diff --git a/src/PlaceEntry.h b/src/PlaceEntry.h
index 5cec5f4e6..b4c68cfea 100644
--- a/src/PlaceEntry.h
+++ b/src/PlaceEntry.h
@@ -84,6 +84,7 @@ public:
virtual DeeModel * GetGroupsModel () = 0;
virtual DeeModel * GetResultsModel () = 0;
+ virtual DeeModel * GetGlobalResultsModel () = 0;
// Signals
sigc::signal<void, bool> active_changed;
diff --git a/src/PlaceEntryHome.cpp b/src/PlaceEntryHome.cpp
new file mode 100644
index 000000000..bd139ae03
--- /dev/null
+++ b/src/PlaceEntryHome.cpp
@@ -0,0 +1,205 @@
+/*
+ * Copyright (C) 2010 Canonical Ltd
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authored by: Neil Jagdish Patel <neil.patel@canonical.com>
+ */
+
+#include "config.h"
+
+#include "PlaceEntryHome.h"
+
+#include <glib/gi18n-lib.h>
+
+PlaceEntryHome::PlaceEntryHome (PlaceFactory *factory)
+: _factory (factory),
+ _sections_model (NULL),
+ _groups_model (NULL),
+ _results_model (NULL)
+{
+ _sections_model = dee_sequence_model_new ();
+ dee_model_set_schema (_sections_model, "s", "s", NULL);
+
+ _groups_model = dee_sequence_model_new ();
+ dee_model_set_schema (_groups_model, "s", "s", "s", NULL);
+
+ _results_model = dee_sequence_model_new ();
+ dee_model_set_schema (_results_model, "s", "s", "u", "s", "s", "s", NULL);
+
+ LoadExistingEntries ();
+ _factory->place_added.connect (sigc::mem_fun (this, &PlaceEntryHome::OnPlaceAdded));
+}
+
+PlaceEntryHome::~PlaceEntryHome ()
+{
+ g_object_unref (_sections_model);
+ g_object_unref (_groups_model);
+ g_object_unref (_results_model);
+}
+
+void
+PlaceEntryHome::LoadExistingEntries ()
+{
+ std::vector<Place *> places = _factory->GetPlaces ();
+ std::vector<Place *>::iterator it;
+
+ for (it = places.begin (); it != places.end (); ++it)
+ {
+ Place *place = static_cast<Place *> (*it);
+ OnPlaceAdded (place);
+ }
+}
+
+void
+PlaceEntryHome::OnPlaceAdded (Place *place)
+{
+ std::vector<PlaceEntry *> entries = place->GetEntries ();
+ std::vector<PlaceEntry *>::iterator i;
+
+ for (i = entries.begin (); i != entries.end (); ++i)
+ {
+ PlaceEntry *entry = static_cast<PlaceEntry *> (*i);
+ OnPlaceEntryAdded (entry);
+ }
+}
+
+void
+PlaceEntryHome::OnPlaceEntryAdded (PlaceEntry *entry)
+{
+ _entries.push_back (entry);
+ _model_to_group[entry->GetGlobalResultsModel ()] = _entries.size ();
+
+ g_signal_connect (entry->GetGlobalResultsModel (), "row-added",
+ (GCallback)&PlaceEntryHome::OnResultAdded, this);
+ g_signal_connect (entry->GetGlobalResultsModel (), "row-removed",
+ (GCallback)&PlaceEntryHome::OnResultRemoved, this);
+}
+
+void
+PlaceEntryHome::OnResultAdded (DeeModel *model, DeeModelIter *iter, PlaceEntryHome *self)
+{
+ g_debug ("Result added");
+}
+
+
+void
+PlaceEntryHome::OnResultRemoved (DeeModel *model, DeeModelIter *iter, PlaceEntryHome *self)
+{
+ g_debug ("Result removed");
+}
+
+/* Overrides */
+const gchar *
+PlaceEntryHome::GetId ()
+{
+ return "PlaceEntryHome";
+}
+
+const gchar *
+PlaceEntryHome::GetName ()
+{
+ return _("Global Search");
+}
+
+const gchar *
+PlaceEntryHome::GetIcon ()
+{
+ return "folder-home";
+}
+
+const gchar *
+PlaceEntryHome::GetDescription ()
+{
+ return _("Search across all places");
+}
+
+guint32
+PlaceEntryHome::GetPosition ()
+{
+ return 0;
+}
+
+const gchar **
+PlaceEntryHome::GetMimetypes ()
+{
+ return NULL;
+}
+
+const std::map<gchar *, gchar *>&
+PlaceEntryHome::GetHints ()
+{
+ return _hints;
+}
+
+bool
+PlaceEntryHome::IsSensitive ()
+{
+ return true;
+}
+
+bool
+PlaceEntryHome::IsActive ()
+{
+ return true;
+}
+
+bool
+PlaceEntryHome::ShowInLauncher ()
+{
+ return false;
+}
+
+bool
+PlaceEntryHome::ShowInGlobal ()
+{
+ return false;
+}
+
+void
+PlaceEntryHome::SetActive (bool is_active)
+{
+}
+
+void
+PlaceEntryHome::SetSearch (const gchar *search, std::map<gchar*, gchar*>& hints)
+{
+}
+
+void
+PlaceEntryHome::SetActiveSection (guint32 section_id)
+{
+}
+
+void
+PlaceEntryHome::SetGlobalSearch (const gchar *search, std::map<gchar*, gchar*>& hints)
+{
+}
+
+DeeModel *
+PlaceEntryHome::GetSectionsModel ()
+{
+ return _sections_model;
+}
+
+DeeModel *
+PlaceEntryHome::GetGroupsModel ()
+{
+ return _groups_model;
+}
+
+DeeModel *
+PlaceEntryHome::GetResultsModel ()
+{
+ return _results_model;
+}
diff --git a/src/PlaceEntryHome.h b/src/PlaceEntryHome.h
new file mode 100644
index 000000000..d8038156e
--- /dev/null
+++ b/src/PlaceEntryHome.h
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2010 Canonical Ltd
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authored by: Neil Jagdish Patel <neil.patel@canonical.com>
+ */
+
+#ifndef PLACE_ENTRY_HOME_H
+#define PLACE_ENTRY_HOME_H
+
+#include <glib.h>
+#include <gio/gio.h>
+
+#include <string>
+#include <vector>
+#include <sigc++/signal.h>
+#include <sigc++/trackable.h>
+
+#include <dee.h>
+
+#include "PlaceFactory.h"
+#include "PlaceEntry.h"
+
+class PlaceEntryHome : public PlaceEntry
+{
+public:
+ PlaceEntryHome (PlaceFactory *factory);
+ ~PlaceEntryHome ();
+
+ /* Overrides */
+ const gchar * GetId ();
+ const gchar * GetName ();
+ const gchar * GetIcon ();
+ const gchar * GetDescription ();
+
+ guint32 GetPosition ();
+ const gchar ** GetMimetypes ();
+
+ const std::map<gchar *, gchar *>& GetHints ();
+
+ bool IsSensitive ();
+ bool IsActive ();
+ bool ShowInLauncher ();
+ bool ShowInGlobal ();
+
+ void SetActive (bool is_active);
+ void SetSearch (const gchar *search, std::map<gchar*, gchar*>& hints);
+ void SetActiveSection (guint32 section_id);
+ void SetGlobalSearch (const gchar *search, std::map<gchar*, gchar*>& hints);
+
+ DeeModel * GetSectionsModel ();
+ DeeModel * GetGroupsModel ();
+ DeeModel * GetResultsModel ();
+
+ DeeModel * GetGlobalResultsModel () { return NULL; };
+
+private:
+ void LoadExistingEntries ();
+ void OnPlaceAdded (Place *place);
+ void OnPlaceEntryAdded (PlaceEntry *entry);
+
+ static void OnResultAdded (DeeModel *model, DeeModelIter *iter, PlaceEntryHome *self);
+ static void OnResultRemoved (DeeModel *model, DeeModelIter *iter, PlaceEntryHome *self);
+
+private:
+ PlaceFactory *_factory;
+ DeeModel *_sections_model;
+ DeeModel *_groups_model;
+ DeeModel *_results_model;
+
+ std::map<char *, gchar *> _hints;
+
+ std::map<DeeModel *, int> _model_to_group;
+ std::vector<PlaceEntry *> _entries;
+};
+
+#endif // PLACE_ENTRY_HOME_H
diff --git a/src/PlaceEntryRemote.cpp b/src/PlaceEntryRemote.cpp
index 58e148d4a..392f1f237 100644
--- a/src/PlaceEntryRemote.cpp
+++ b/src/PlaceEntryRemote.cpp
@@ -53,6 +53,7 @@ PlaceEntryRemote::PlaceEntryRemote (const gchar *dbus_name)
_sections_model (NULL),
_groups_model (NULL),
_results_model (NULL),
+ _global_results_model (NULL),
_previous_search (NULL),
_previous_section (G_MAXUINT32)
{
@@ -73,6 +74,7 @@ PlaceEntryRemote::~PlaceEntryRemote ()
g_object_unref (_sections_model);
g_object_unref (_groups_model);
g_object_unref (_results_model);
+ g_object_unref (_global_results_model);
}
void
@@ -271,15 +273,20 @@ PlaceEntryRemote::SetActiveSection (guint32 section_id)
void
PlaceEntryRemote::SetGlobalSearch (const gchar *search, std::map<gchar*, gchar*>& hints)
{
+ GVariantBuilder *builder;
+
+ builder = g_variant_builder_new (G_VARIANT_TYPE ("a{ss}"));
+
/* FIXME: I'm ignoring hints because we don't use them currently */
g_dbus_proxy_call (_proxy,
- "SetGlobalSearch",
- g_variant_new ("(sa{ss})", search, NULL),
+ "SetSearch",
+ g_variant_new ("(sa{ss})", search, builder),
G_DBUS_CALL_FLAGS_NONE,
-1,
NULL,
NULL,
NULL);
+ g_variant_builder_unref (builder);
}
DeeModel *
@@ -300,6 +307,11 @@ PlaceEntryRemote::GetResultsModel ()
return _results_model;
}
+DeeModel *
+PlaceEntryRemote::GetGlobalResultsModel ()
+{
+ return _global_results_model;
+}
/* Other methods */
bool
@@ -420,7 +432,18 @@ PlaceEntryRemote::Update (const gchar *dbus_path,
// both places return ""
// FIXME: Handle global groups model name
- // FIXME: Handle global results model name
+
+ if (!DEE_IS_SHARED_MODEL (_global_results_model) ||
+ g_strcmp0 (dee_shared_model_get_swarm_name (DEE_SHARED_MODEL (_global_results_model)), global_results_model) != 0)
+ {
+ if (DEE_IS_SHARED_MODEL (_global_results_model))
+ g_object_unref (_global_results_model);
+
+ _global_results_model = dee_shared_model_new (global_results_model);
+ dee_model_set_schema (_global_results_model, "s", "s", "u", "s", "s", "s", NULL);
+
+ _global_renderer_changed = true;
+ }
// FIXME: Handle global renderer hints
if (_vis_changed)
diff --git a/src/PlaceEntryRemote.h b/src/PlaceEntryRemote.h
index 3eae13eb2..1039249d7 100644
--- a/src/PlaceEntryRemote.h
+++ b/src/PlaceEntryRemote.h
@@ -65,6 +65,8 @@ public:
DeeModel * GetGroupsModel ();
DeeModel * GetResultsModel ();
+ DeeModel * GetGlobalResultsModel ();
+
/* Other methods */
bool IsValid ();
const gchar * GetPath ();
@@ -114,6 +116,8 @@ private:
DeeModel *_groups_model;
DeeModel *_results_model;
+ DeeModel *_global_results_model;
+
gchar *_previous_search;
guint32 _previous_section;
};
diff --git a/src/PlacesController.cpp b/src/PlacesController.cpp
index edd555f08..ad2aa125c 100644
--- a/src/PlacesController.cpp
+++ b/src/PlacesController.cpp
@@ -56,7 +56,7 @@ PlacesController::PlacesController ()
_window->OnMouseDownOutsideArea.connect (sigc::mem_fun (this, &PlacesController::RecvMouseDownOutsideOfView));
- _view = new PlacesView ();
+ _view = new PlacesView (_factory);
_window_layout->AddView(_view, 1);
_window_layout->SetContentDistribution(nux::eStackLeft);
_window_layout->SetVerticalExternalMargin(0);
diff --git a/src/PlacesResultsView.cpp b/src/PlacesResultsView.cpp
index 63a476c32..f11f2a2c3 100644
--- a/src/PlacesResultsView.cpp
+++ b/src/PlacesResultsView.cpp
@@ -178,12 +178,10 @@ void
PlacesResultsView::ScrollUp (float stepy, int mousedy)
{
ScrollView::ScrollUp (stepy, mousedy);
- NeedRedraw ();
}
void
PlacesResultsView::ScrollDown (float stepy, int mousedy)
{
ScrollView::ScrollDown (stepy, mousedy);
- NeedRedraw ();
}
diff --git a/src/PlacesSearchBar.cpp b/src/PlacesSearchBar.cpp
index 38d338380..d1abbe39f 100644
--- a/src/PlacesSearchBar.cpp
+++ b/src/PlacesSearchBar.cpp
@@ -50,11 +50,10 @@ PlacesSearchBar::PlacesSearchBar (NUX_FILE_LINE_DECL)
_layout = new nux::HLayout (NUX_TRACKER_LOCATION);
_pango_entry = new nux::TextEntry ("", NUX_TRACKER_LOCATION);
- _pango_entry->SetMinimumWidth (200);
_pango_entry->sigTextChanged.connect (sigc::mem_fun (this, &PlacesSearchBar::OnSearchChanged));
- _layout->AddView (_pango_entry, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
+ _layout->AddView (_pango_entry, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
_layout->SetVerticalExternalMargin (14);
_layout->SetHorizontalExternalMargin (18);
@@ -171,6 +170,8 @@ PlacesSearchBar::OnSearchChanged (nux::TextEntry *text_entry)
_live_search_timeout = g_timeout_add (LIVE_SEARCH_TIMEOUT,
(GSourceFunc)&OnLiveSearchTimeout,
this);
+
+ search_changed.emit (_pango_entry->GetText ().c_str ());
}
bool
diff --git a/src/PlacesSearchBar.h b/src/PlacesSearchBar.h
index fb3680ca1..76f01c379 100644
--- a/src/PlacesSearchBar.h
+++ b/src/PlacesSearchBar.h
@@ -46,6 +46,8 @@ public:
virtual long PostLayoutManagement (long LayoutResult);
void SetActiveEntry (PlaceEntry *entry, guint section_id, const char *search_string);
+
+ sigc::signal<void, const char *> search_changed;
protected:
// Introspectable methods
diff --git a/src/PlacesSimpleTile.cpp b/src/PlacesSimpleTile.cpp
index 7eae87ea3..1ab0da43c 100644
--- a/src/PlacesSimpleTile.cpp
+++ b/src/PlacesSimpleTile.cpp
@@ -31,7 +31,6 @@ PlacesSimpleTile::PlacesSimpleTile (const char *icon_name, const char *label, in
_uri (NULL)
{
_layout = new nux::VLayout ("", NUX_TRACKER_LOCATION);
- SetCompositionLayout (_layout);
_label = g_strdup (label);
_icon = g_strdup (icon_name);
diff --git a/src/PlacesView.cpp b/src/PlacesView.cpp
index 0dc20994a..d60457715 100644
--- a/src/PlacesView.cpp
+++ b/src/PlacesView.cpp
@@ -36,15 +36,19 @@ static void place_entry_activate_request (GVariant *payload, PlacesView *self);
NUX_IMPLEMENT_OBJECT_TYPE (PlacesView);
-PlacesView::PlacesView (NUX_FILE_LINE_DECL)
+PlacesView::PlacesView (PlaceFactory *factory)
: nux::View (NUX_TRACKER_LOCATION),
+ _factory (factory),
_entry (NULL)
{
+ _home_entry = new PlaceEntryHome (_factory);
+
_layout = new nux::VLayout (NUX_TRACKER_LOCATION);
_search_bar = new PlacesSearchBar ();
_layout->AddView (_search_bar, 0, nux::eCenter, nux::eFull);
AddChild (_search_bar);
+ _search_bar->search_changed.connect (sigc::mem_fun (this, &PlacesView::OnSearchChanged));
_layered_layout = new nux::LayeredLayout (NUX_TRACKER_LOCATION);
_layout->AddLayout (_layered_layout, 1, nux::eCenter, nux::eFull);
@@ -72,11 +76,13 @@ PlacesView::PlacesView (NUX_FILE_LINE_DECL)
this);
_icon_loader = IconLoader::GetDefault ();
+
+ SetActiveEntry (_home_entry, 0, "");
}
PlacesView::~PlacesView ()
{
-
+ delete _home_entry;
}
long
@@ -91,15 +97,23 @@ PlacesView::ProcessEvent(nux::IEvent &ievent, long TraverseInfo, long ProcessEve
void
PlacesView::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
{
+ GfxContext.PushClippingRectangle (GetGeometry() );
+ gPainter.PaintBackground (GfxContext, GetGeometry ());
+
+ GfxContext.PopClippingRectangle ();
}
void
PlacesView::DrawContent (nux::GraphicsEngine &GfxContext, bool force_draw)
{
+ GfxContext.PushClippingRectangle (GetGeometry() );
+
if (_layout)
_layout->ProcessDraw (GfxContext, force_draw);
+
+ GfxContext.PopClippingRectangle ();
}
//
@@ -108,6 +122,9 @@ PlacesView::DrawContent (nux::GraphicsEngine &GfxContext, bool force_draw)
void
PlacesView::SetActiveEntry (PlaceEntry *entry, guint section_id, const char *search_string, bool signal)
{
+ if (entry == NULL)
+ entry = _home_entry;
+
if (_entry)
{
_entry->SetActive (false);
@@ -123,51 +140,48 @@ PlacesView::SetActiveEntry (PlaceEntry *entry, guint section_id, const char *sea
_entry = entry;
- if (_entry)
- {
- std::map <gchar*, gchar*> hints;
- DeeModel *groups, *results;
- DeeModelIter *iter, *last;
-
- _entry->SetActive (true);
-
- groups = _entry->GetGroupsModel ();
- iter = dee_model_get_first_iter (groups);
- last = dee_model_get_last_iter (groups);
- while (iter != last)
- {
- _results_controller->CreateGroup (dee_model_get_string (groups,
- iter,
- PlaceEntry::GROUP_NAME));
- iter = dee_model_next (groups, iter);
- }
+ std::map <gchar*, gchar*> hints;
+ DeeModel *groups, *results;
+ DeeModelIter *iter, *last;
- results = _entry->GetResultsModel ();
- iter = dee_model_get_first_iter (results);
- last = dee_model_get_last_iter (results);
- while (iter != last)
- {
- OnResultAdded (results, iter, this);
- iter = dee_model_next (results, iter);
- }
+ _entry->SetActive (true);
- _group_added_id = g_signal_connect (_entry->GetGroupsModel (), "row-added",
- (GCallback)&PlacesView::OnGroupAdded, this);
- _group_removed_id = g_signal_connect (_entry->GetGroupsModel (), "row-removed",
- (GCallback)&PlacesView::OnGroupRemoved, this);
- _result_added_id = g_signal_connect (_entry->GetResultsModel (), "row-added",
- (GCallback)&PlacesView::OnResultAdded, this);
- _result_removed_id = g_signal_connect (_entry->GetResultsModel (), "row-removed",
- (GCallback)&PlacesView::OnResultRemoved, this);
-
- _layered_layout->SetActiveLayer (_results_view);
+ groups = _entry->GetGroupsModel ();
+ iter = dee_model_get_first_iter (groups);
+ last = dee_model_get_last_iter (groups);
+ while (iter != last)
+ {
+ _results_controller->CreateGroup (dee_model_get_string (groups,
+ iter,
+ PlaceEntry::GROUP_NAME));
+ iter = dee_model_next (groups, iter);
}
- else
+
+ results = _entry->GetResultsModel ();
+ iter = dee_model_get_first_iter (results);
+ last = dee_model_get_last_iter (results);
+ while (iter != last)
{
- _layered_layout->SetActiveLayerN (0);
+ OnResultAdded (results, iter, this);
+ iter = dee_model_next (results, iter);
}
+ _group_added_id = g_signal_connect (_entry->GetGroupsModel (), "row-added",
+ (GCallback)&PlacesView::OnGroupAdded, this);
+ _group_removed_id = g_signal_connect (_entry->GetGroupsModel (), "row-removed",
+ (GCallback)&PlacesView::OnGroupRemoved, this);
+ _result_added_id = g_signal_connect (_entry->GetResultsModel (), "row-added",
+ (GCallback)&PlacesView::OnResultAdded, this);
+ _result_removed_id = g_signal_connect (_entry->GetResultsModel (), "row-removed",
+ (GCallback)&PlacesView::OnResultRemoved, this);
+
+ if (_entry == _home_entry && (g_strcmp0 (search_string, "") == 0))
+ _layered_layout->SetActiveLayer (_home_view);
+ else
+ _layered_layout->SetActiveLayer (_results_view);
+
_search_bar->SetActiveEntry (_entry, section_id, search_string);
+
if (signal)
entry_changed.emit (_entry);
}
@@ -302,6 +316,29 @@ PlacesView::OnResultClicked (PlacesTile *tile)
NULL);
}
+void
+PlacesView::OnSearchChanged (const char *search_string)
+{
+ if (_entry == _home_entry)
+ {
+ if (g_strcmp0 (search_string, "") == 0)
+ {
+ _layered_layout->SetActiveLayer (_home_view);
+ _home_view->QueueDraw ();
+ }
+ else
+ {
+ _layered_layout->SetActiveLayer (_results_view);
+ _results_view->QueueDraw ();
+ }
+
+ _results_view->QueueDraw ();
+ _home_view->QueueDraw ();
+ _layered_layout->QueueDraw ();
+ QueueDraw ();
+ }
+}
+
//
// UBus handlers
//
@@ -312,6 +349,12 @@ PlacesView::PlaceEntryActivateRequest (const char *entry_id,
{
std::vector<Place *> places = PlaceFactory::GetDefault ()->GetPlaces ();
std::vector<Place *>::iterator it;
+
+ if (g_strcmp0 (entry_id, "PlaceEntryHome") == 0)
+ {
+ SetActiveEntry (_home_entry, section_id, search_string);
+ return;
+ }
for (it = places.begin (); it != places.end (); ++it)
{
diff --git a/src/PlacesView.h b/src/PlacesView.h
index c7c217602..dc49fec25 100644
--- a/src/PlacesView.h
+++ b/src/PlacesView.h
@@ -31,6 +31,8 @@
#include "Place.h"
#include "PlaceEntry.h"
+#include "PlaceEntryHome.h"
+#include "PlaceFactory.h"
#include "PlacesSearchBar.h"
#include "PlacesHomeView.h"
@@ -46,7 +48,7 @@ class PlacesView : public nux::View, public Introspectable
{
NUX_DECLARE_OBJECT_TYPE (PlacesView, nux::View);
public:
- PlacesView (NUX_FILE_LINE_PROTO);
+ PlacesView (PlaceFactory *factory);
~PlacesView ();
// nux::View overrides
@@ -85,12 +87,15 @@ private:
static void OnResultRemoved (DeeModel *model, DeeModelIter *iter, PlacesView *self);
void OnResultClicked (PlacesTile *tile);
+ void OnSearchChanged (const char *search_string);
private:
+ PlaceFactory *_factory;
nux::VLayout *_layout;
nux::LayeredLayout *_layered_layout;
PlacesSearchBar *_search_bar;
PlacesHomeView *_home_view;
+ PlaceEntryHome *_home_entry;
PlaceEntry *_entry;
gulong _group_added_id;
gulong _group_removed_id;
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index ec6527363..5e4e4fa0a 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -135,6 +135,8 @@ add_executable (test-places
../src/UBusMessages.h
../src/Introspectable.cpp
../src/Introspectable.h
+ ../src/PlaceEntryHome.cpp
+ ../src/PlaceEntryRemote.h
../src/PlaceEntryRemote.cpp
../src/PlaceEntryRemote.h
../src/PlaceEntry.h
diff --git a/tests/TestPlaces.cpp b/tests/TestPlaces.cpp
index 55456b27d..22e160923 100644
--- a/tests/TestPlaces.cpp
+++ b/tests/TestPlaces.cpp
@@ -48,13 +48,13 @@ public:
_combo->sigTriggered.connect (sigc::mem_fun (this, &TestApp::OnComboChangedFoRealz));
layout->AddView (_combo, 0, nux::eCenter, nux::eFix);
- PlacesView *view = new PlacesView ();
- view->SetMinMaxSize(938, 500);
- layout->AddView(view, 1, nux::eCenter, nux::eFix);
-
_factory = PlaceFactory::GetDefault ();
PopulateEntries ();
_factory->place_added.connect (sigc::mem_fun (this, &TestApp::OnPlaceAdded));
+
+ PlacesView *view = new PlacesView (_factory);
+ view->SetMinMaxSize(938, 500);
+ layout->AddView(view, 1, nux::eCenter, nux::eFix);
layout->SetContentDistribution(nux::eStackCenter);
nux::GetGraphicsThread()->SetLayout (layout);