From 93f3c7dbbc03a6e7be2a8fcf0693baca167a1d56 Mon Sep 17 00:00:00 2001 From: Neil Jagdish Patel Date: Mon, 31 Jan 2011 15:32:39 +0000 Subject: some fixes (bzr r697.4.52) --- src/PlacesController.cpp | 11 +++++++++++ src/PlacesController.h | 1 + src/PlacesView.cpp | 9 ++++++++- src/PlacesView.h | 5 ++++- 4 files changed, 24 insertions(+), 2 deletions(-) (limited to 'src') 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 entry_changed; protected: -- cgit v1.2.3