~stolowski/libunity/activate-result

« back to all changes in this revision

Viewing changes to src/unity-scope-proxy-local.vala

  • Committer: Tarmac
  • Author(s): Michal Hruby
  • Date: 2011-12-01 11:27:41 UTC
  • mfrom: (87.3.13 libunity)
  • Revision ID: tarmac-20111201112741-9gw2rrydvgqs8kg5
Simplify the way we use DBus method calls, returns and signals.. Fixes: . Reviewed by Mikkel Kamstrup Erlandsen.

Show diffs side-by-side

added added

removed removed

Lines of Context:
71
71
      notify_property ("sources");
72
72
      return false;
73
73
    });
74
 
 
75
 
    scope.search_finished.connect (on_search_finished);
76
 
    scope.global_search_finished.connect (on_global_search_finished);
77
74
  }
78
75
 
79
76
  /*
85
82
    return reply;
86
83
  }
87
84
 
88
 
  public async void search (string search_string,
89
 
                            HashTable<string, Variant> hints)
 
85
  public async HashTable<string, Variant> search (
 
86
      string search_string, HashTable<string, Variant> hints)
90
87
  {
91
 
    scope.search (search_string, hints);
 
88
    try {
 
89
      var result = yield scope.search (search_string, hints);
 
90
      return result;
 
91
    } catch (ScopeError.SEARCH_CANCELLED scope_error) {
 
92
      // all good
 
93
    } catch (Error e) {
 
94
      warning (@"Unable to search scope ('$search_string'): $(e.message)");
 
95
    }
 
96
 
 
97
    return new HashTable<string, Variant> (str_hash, str_equal);
92
98
  }
93
99
 
94
 
  public async void global_search (string search_string,
95
 
                                   HashTable<string, Variant> hints)
 
100
  public async HashTable<string, Variant> global_search (
 
101
      string search_string, HashTable<string, Variant> hints)
96
102
  {
97
 
    scope.global_search (search_string, hints);
 
103
    try {
 
104
      var result = yield scope.global_search (search_string, hints);
 
105
      return result;
 
106
    } catch (ScopeError.SEARCH_CANCELLED scope_error) {
 
107
      // all good
 
108
    } catch (Error e) {
 
109
      warning (@"Unable to global_search scope ('$search_string'): $(e.message)");
 
110
    }
 
111
 
 
112
    return new HashTable<string, Variant> (str_hash, str_equal);
98
113
  }
99
114
 
100
115
  public async PreviewReplyRaw preview (string uri)
112
127
  {
113
128
    scope.set_active_sources_internal (sources);
114
129
  }
115
 
  
116
 
  public void on_search_finished (string search_string,
117
 
                                  HashTable<string, Variant> hints)
118
 
  {
119
 
    search_finished (search_string, hints);
120
 
  }
121
 
  
122
 
  public void on_global_search_finished (string search_string,
123
 
                                         HashTable<string, Variant> hints)
124
 
  {
125
 
    global_search_finished (search_string, hints);
126
 
  }
127
130
}
128
131
 
129
132
} /* Namespace */