Merge lp:~alexlauni/libunity/clear-models-on-vanish-859760 into lp:libunity

Proposed by Alex Launi
Status: Merged
Approved by: Neil J. Patel
Approved revision: 82
Merged at revision: 83
Proposed branch: lp:~alexlauni/libunity/clear-models-on-vanish-859760
Merge into: lp:libunity
Diff against target: 24 lines (+9/-0)
1 file modified
src/unity-scope-proxy-remote.vala (+9/-0)
To merge this branch: bzr merge lp:~alexlauni/libunity/clear-models-on-vanish-859760
Reviewer Review Type Date Requested Status
Mikkel Kamstrup Erlandsen (community) Approve
Neil J. Patel (community) Approve
Review via email: mp+77019@code.launchpad.net

Description of the change

Clears the models before making new ones so that old results don't get stuck

To post a comment you must log in.
Revision history for this message
Mikkel Kamstrup Erlandsen (kamstrup) wrote :

Hmmmm... I am a bit split on this...

Keeping the model around is actually by design. It allows for a
lens/scope to exit, but keep useful state around - which it can pick
up automagically when it starts again. The idea being that it
shouldn't matter whether the lens/scope is running or not; it will be
transparently restarted by DBus activation when needed.

Those noble ideas aside I agree that it adds some unwelcome complexity
when not using this feature. So I agree somewhat on the intent of this
patch, but not so much in it's implementation.

Also at this point in the cycle I think we need to keep a consistent
behavior of the API. So I'd rather see a solution along the lines of:

 * Add a new property "state-type" on lenses and scopes which has
values in a Unity.LensStateType enum

public enum Unity.LensStateType {
  STATELESS,
  RETAINED
}

(This opens the possibility for some nastiness in P where we can add a
PERSISTENT/CACHED statetype, that will transparently store and load
the model state on disk)

Revision history for this message
Mikkel Kamstrup Erlandsen (kamstrup) wrote :

(and the aforementioned property would have a default value of
Unity.LensStateType.RETAINED, which means that behavior will remain as
it is now by default)

Revision history for this message
Neil J. Patel (njpatel) wrote :

Fwiw, with new Lens stuff, a scope can't retain state as a Scope always creates unique model names on the bus, so clearing is the best thing to do. What we're missing, I think, is setting the properties of the preview instance (namely Search and GlobalSearch) on the new one, but probably not a good idea to do that as we're trying really hard to not initiate a million searches when we bring up the scopes (so maybe only of results_model_ != null?).

Also, Mikkel, no appreciation of me remembering you through the dark days when you weren't around and embedding my emotions into the libunity code?!

Revision history for this message
Neil J. Patel (njpatel) wrote :

s/preview/previous

Revision history for this message
Neil J. Patel (njpatel) :
review: Approve
Revision history for this message
Mikkel Kamstrup Erlandsen (kamstrup) wrote :

Ok, sorry Alex, appears I live in the past :-) In light of Neil's comment I think this makes total sense.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/unity-scope-proxy-remote.vala'
2--- src/unity-scope-proxy-remote.vala 2011-09-15 09:39:03 +0000
3+++ src/unity-scope-proxy-remote.vala 2011-09-26 16:41:22 +0000
4@@ -114,12 +114,21 @@
5
6 search_in_global = false;
7 sources = {};
8+ if (_results_model != null)
9+ _results_model.clear ();
10+
11 _results_model = new Dee.SharedModel ("where.in.the.world.is.kamstrup");;
12 _results_model.set_schema ("s", "s", "u", "s", "s", "s", "s");
13
14+ if (_global_results_model != null)
15+ _global_results_model.clear ();
16+
17 _global_results_model = new Dee.SharedModel ("where.in.the.world.is.kamstrup");
18 _global_results_model.set_schema ("s", "s", "u", "s", "s", "s", "s");
19
20+ if (_filters_model != null)
21+ _filters_model.clear ();
22+
23 _filters_model = new Dee.SharedModel ("where.in.the.world.is.kamstrup");
24 _filters_model.set_schema ("s", "s", "s", "s", "a{sv}", "b", "b", "b");
25

Subscribers

People subscribed via source and target branches