summaryrefslogtreecommitdiff
path: root/src
diff options
authorNeil Jagdish Patel <neil.patel@canonical.com>2011-01-31 15:32:39 +0000
committerNeil Jagdish Patel <neil.patel@canonical.com>2011-01-31 15:32:39 +0000
commit93f3c7dbbc03a6e7be2a8fcf0693baca167a1d56 (patch)
tree7219e2b85cde765c8b1164c1ef8b2e7ca8c270c6 /src
parentc6af09b712a4e6d99a5fb57f61b7d36a822ede3e (diff)
some fixes
(bzr r697.4.52)
Diffstat (limited to 'src')
-rw-r--r--src/PlacesController.cpp11
-rw-r--r--src/PlacesController.h1
-rw-r--r--src/PlacesView.cpp9
-rw-r--r--src/PlacesView.h5
4 files changed, 24 insertions, 2 deletions
diff --git a/src/PlacesController.cpp b/src/PlacesController.cpp
index 42988caee..1031360dd 100644
--- a/src/PlacesController.cpp
+++ b/src/PlacesController.cpp
@@ -63,6 +63,8 @@ PlacesController::PlacesController ()
_window_layout->SetHorizontalExternalMargin(0);
_window->SetLayout (_window_layout);
+
+ _view->entry_changed.connect (sigc::mem_fun (this, &PlacesController::OnActivePlaceEntryChanged));
}
PlacesController::~PlacesController ()
@@ -101,6 +103,8 @@ void PlacesController::Hide ()
_visible = false;
+ _view->SetActiveEntry (NULL, 0, "", false);
+
ubus_server_send_message (ubus_server_get_default (), UBUS_PLACE_VIEW_HIDDEN, NULL);
}
@@ -137,6 +141,13 @@ PlacesController::RecvMouseDownOutsideOfView (int x, int y, unsigned long butto
Hide ();
}
+void
+PlacesController::OnActivePlaceEntryChanged (PlaceEntry *entry)
+{
+ entry ? Show () : Hide ();
+}
+
+
/* Introspection */
const gchar *
PlacesController::GetName ()
diff --git a/src/PlacesController.h b/src/PlacesController.h
index ecc602dc9..9b550b2d3 100644
--- a/src/PlacesController.h
+++ b/src/PlacesController.h
@@ -51,6 +51,7 @@ protected:
nux::Geometry& geo, void *user_data);
void RecvMouseDownOutsideOfView (int x, int y, unsigned long button_flags, unsigned long key_flags);
+ void OnActivePlaceEntryChanged (PlaceEntry *entry);
private:
nux::BaseWindow *_window;
diff --git a/src/PlacesView.cpp b/src/PlacesView.cpp
index c753fce9e..2fd9cafc9 100644
--- a/src/PlacesView.cpp
+++ b/src/PlacesView.cpp
@@ -99,7 +99,7 @@ PlacesView::DrawContent (nux::GraphicsEngine &GfxContext, bool force_draw)
// PlacesView Methods
//
void
-PlacesView::SetActiveEntry (PlaceEntry *entry, guint section_id, const char *search_string)
+PlacesView::SetActiveEntry (PlaceEntry *entry, guint section_id, const char *search_string, bool signal)
{
if (_entry)
{
@@ -145,6 +145,9 @@ PlacesView::SetActiveEntry (PlaceEntry *entry, guint section_id, const char *sea
(GCallback)&PlacesView::OnResultRemoved, this);
}
_search_bar->SetActiveEntry (_entry, section_id, search_string);
+
+ if (signal)
+ entry_changed.emit (_entry);
}
PlaceEntry *
@@ -280,6 +283,10 @@ PlacesView::OnResultClicked (PlacesTile *tile)
g_error_free (error);
}
}
+
+ ubus_server_send_message (ubus_server_get_default (),
+ UBUS_PLACE_VIEW_CLOSE_REQUEST,
+ NULL);
}
//
diff --git a/src/PlacesView.h b/src/PlacesView.h
index c4b18b3f7..b8ba431fa 100644
--- a/src/PlacesView.h
+++ b/src/PlacesView.h
@@ -52,13 +52,16 @@ public:
void DrawContent (nux::GraphicsEngine &GfxContext, bool force_draw);
// Methods
- void SetActiveEntry (PlaceEntry *entry, guint section_id, const char *search_string);
+ void SetActiveEntry (PlaceEntry *entry, guint section_id, const char *search_string, bool signal=true);
PlaceEntry * GetActiveEntry ();
// UBus handlers
void PlaceEntryActivateRequest (const char *entry_id, guint section, const gchar *search);
PlacesResultsController * GetResultsController ();
+
+ // Signals
+ sigc::signal<void, PlaceEntry *> entry_changed;
protected: