Merge lp:~oier/unity/fix-for-764859 into lp:unity

Proposed by Oier Mees
Status: Merged
Merged at revision: 1257
Proposed branch: lp:~oier/unity/fix-for-764859
Merge into: lp:unity
Diff against target: 93 lines (+28/-0)
5 files modified
src/PlacesController.cpp (+3/-0)
src/PlacesSearchBar.cpp (+17/-0)
src/PlacesSearchBar.h (+1/-0)
src/PlacesView.cpp (+6/-0)
src/PlacesView.h (+1/-0)
To merge this branch: bzr merge lp:~oier/unity/fix-for-764859
Reviewer Review Type Date Requested Status
Jay Taoko Pending
Alex Launi Pending
Review via email: mp+64585@code.launchpad.net

Description of the change

Fixes lp:764859 clicking inside the dash search entry now removes the search entry hint.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/PlacesController.cpp'
2--- src/PlacesController.cpp 2011-04-20 12:27:19 +0000
3+++ src/PlacesController.cpp 2011-06-14 17:59:23 +0000
4@@ -74,6 +74,7 @@
5
6 _window->OnMouseDownOutsideArea.connect (sigc::mem_fun (this, &PlacesController::RecvMouseDownOutsideOfView));
7
8+
9 _view = new PlacesView (_factory);
10 _window_layout->AddView (_view, 1);
11 _window_layout->SetContentDistribution(nux::eStackLeft);
12@@ -85,6 +86,8 @@
13 _window->SetEnterFocusInputArea (_view->GetTextEntryView ());
14 _window->SetFocused (true);
15
16+ _window->OnMouseDown.connect (sigc::mem_fun (_view->GetSearchBar (), &PlacesSearchBar::RecvMouseDownFromWindow));
17+
18 _view->entry_changed.connect (sigc::mem_fun (this, &PlacesController::OnActivePlaceEntryChanged));
19 _view->fullscreen_request.connect (sigc::mem_fun (this, &PlacesController::OnDashFullscreenRequest));
20
21
22=== modified file 'src/PlacesSearchBar.cpp'
23--- src/PlacesSearchBar.cpp 2011-05-30 21:50:44 +0000
24+++ src/PlacesSearchBar.cpp 2011-06-14 17:59:23 +0000
25@@ -306,6 +306,14 @@
26 void
27 PlacesSearchBar::OnClearClicked (int x, int y, unsigned long button_flags, unsigned long key_flags)
28 {
29+ std::map<gchar *, gchar *> hints;
30+ gchar *markup;
31+ gchar *tmp;
32+
33+ tmp = g_markup_escape_text (_entry->GetSearchHint (), -1);
34+ markup = g_strdup_printf ("<span font_size='x-small' font_style='italic'> %s </span>", tmp);
35+
36+ _hint->SetText (markup);
37 if (_pango_entry->GetText () != "")
38 {
39 _pango_entry->SetText ("");
40@@ -505,3 +513,12 @@
41
42 texture2D->UnReference ();
43 }
44+
45+void
46+PlacesSearchBar::RecvMouseDownFromWindow(int x, int y, unsigned long button_flags, unsigned long key_flags)
47+{
48+ if(_pango_entry->GetGeometry().IsPointInside(x, y))
49+ {
50+ _hint->SetText ("");
51+ }
52+}
53
54=== modified file 'src/PlacesSearchBar.h'
55--- src/PlacesSearchBar.h 2011-04-12 14:34:08 +0000
56+++ src/PlacesSearchBar.h 2011-06-14 17:59:23 +0000
57@@ -65,6 +65,7 @@
58 return _pango_entry;
59 }
60
61+ void RecvMouseDownFromWindow (int x, int y, unsigned long button_flags, unsigned long key_flags);
62 protected:
63 // Introspectable methods
64 const gchar * GetName ();
65
66=== modified file 'src/PlacesView.cpp'
67--- src/PlacesView.cpp 2011-05-30 21:50:44 +0000
68+++ src/PlacesView.cpp 2011-06-14 17:59:23 +0000
69@@ -899,6 +899,12 @@
70 return _search_bar->_pango_entry;
71 }
72
73+PlacesSearchBar*
74+PlacesView::GetSearchBar ()
75+{
76+ return _search_bar;
77+}
78+
79 void
80 PlacesView::OnPlaceViewQueueDrawNeeded (GVariant *data, PlacesView *self)
81 {
82
83=== modified file 'src/PlacesView.h'
84--- src/PlacesView.h 2011-04-13 16:06:03 +0000
85+++ src/PlacesView.h 2011-06-14 17:59:23 +0000
86@@ -82,6 +82,7 @@
87 PlacesResultsController * GetResultsController ();
88
89 nux::TextEntry* GetTextEntryView ();
90+ PlacesSearchBar* GetSearchBar ();
91
92 // UBus handlers
93 void PlaceEntryActivateRequest (const char *entry_id, guint section, const gchar *search);