Merge lp:~kamstrup/libunity/finished-signal into lp:libunity

Proposed by Mikkel Kamstrup Erlandsen
Status: Merged
Merged at revision: 50
Proposed branch: lp:~kamstrup/libunity/finished-signal
Merge into: lp:libunity
Diff against target: 94 lines (+49/-0)
1 file modified
src/unity-place.vala (+49/-0)
To merge this branch: bzr merge lp:~kamstrup/libunity/finished-signal
Reviewer Review Type Date Requested Status
Neil J. Patel (community) Approve
Review via email: mp+54186@code.launchpad.net

Description of the change

Adds a finished() method on PlaceSearch that will emit com.canonical.Unity.PlaceEntry.SearchFinished() on the parent place entry once called

To post a comment you must log in.
Revision history for this message
Neil J. Patel (njpatel) wrote :

Looks good, approved!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/unity-place.vala'
2--- src/unity-place.vala 2011-02-17 13:05:33 +0000
3+++ src/unity-place.vala 2011-03-21 11:32:29 +0000
4@@ -155,6 +155,8 @@
5
6 private string search;
7 private HashTable<string,string> hints;
8+ private weak PlaceEntryInfo? parent_entry;
9+ private uint section;
10
11 /*
12 * Public API
13@@ -165,6 +167,8 @@
14 GLib.Object();
15 this.search = search;
16 this.hints = hints;
17+ parent_entry = null;
18+ section = 0;
19 }
20
21 public string get_search_string ()
22@@ -222,6 +226,46 @@
23
24 return true;
25 }
26+
27+ public void set_section (uint section)
28+ {
29+ this.section = section;
30+ }
31+
32+ public uint get_section ()
33+ {
34+ return section;
35+ }
36+
37+ public void set_parent_entry (PlaceEntryInfo entry)
38+ {
39+ parent_entry = entry;
40+ }
41+
42+ public unowned PlaceEntryInfo? get_parent_entry ()
43+ {
44+ return parent_entry;
45+ }
46+
47+ public void finished ()
48+ {
49+ if (parent_entry == null)
50+ return;
51+
52+ try {
53+ Variant vhints = hints;
54+ var params = new Variant ("(us@a{ss})", section, search, vhints);
55+ var conn = Bus.get_sync(BusType.SESSION);
56+ conn.emit_signal (null, /* dest name */
57+ parent_entry.dbus_path, /* orig path */
58+ "com.canonical.Unity.PlaceEntry", /* iface */
59+ "SearchFinished", /* member */
60+ params); /* params */
61+ } catch (IOError e) {
62+ warning ("Failed to emit com.canonical.Unity.PlaceEntry.SearchFinished: %s",
63+ e.message);
64+ }
65+ }
66 }
67
68 /**
69@@ -485,6 +529,8 @@
70 public signal void global_renderer_info_changed (_PlaceRendererInfo renderer_info);
71
72 public signal void place_entry_info_changed (_PlaceEntryInfoData entry_info_data);
73+
74+ public signal void search_finished (uint section, string search, HashTable<string,string> hints);
75 }
76
77 /**
78@@ -728,6 +774,7 @@
79 HashTable<string,string> hints)
80 {
81 var s = new PlaceSearch (search, hints);
82+ s.set_parent_entry (_entry_info);
83
84 if (!s.equals (this._entry_info.active_global_search))
85 this._entry_info.active_global_search = s;
86@@ -737,6 +784,8 @@
87 HashTable<string,string> hints)
88 {
89 var s = new PlaceSearch (search, hints);
90+ s.set_section (_entry_info.active_section);
91+ s.set_parent_entry (_entry_info);
92
93 if (!s.equals (this._entry_info.active_search))
94 this._entry_info.active_search = s;

Subscribers

People subscribed via source and target branches