~alexlauni/unity/introspection-search-cleanup

« back to all changes in this revision

Viewing changes to plugins/unityshell/src/DebugDBusInterface.cpp

  • Committer: Alex Launi
  • Date: 2011-11-08 18:36:12 UTC
  • Revision ID: alex.launi@canonical.com-20111108183612-u3vwdbpq6fbf7xlg
Fix introspection piece search

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
void DBusMethodCall(GDBusConnection*, const gchar*, const gchar*,
31
31
                    const gchar*, const gchar*, GVariant*,
32
32
                    GDBusMethodInvocation*, gpointer);
33
 
Introspectable* FindPieceToIntrospect(std::queue<Introspectable*> queue, 
34
 
                                      const std::string pieceName);
 
33
Introspectable* FindPieceToIntrospect(const std::string pieceName);
35
34
 
36
35
static const GDBusInterfaceVTable si_vtable =
37
36
{
258
257
  // mean the top level.
259
258
  Introspectable* piece = (pieceName == "")
260
259
    ? _parent_introspectable
261
 
    : FindPieceToIntrospect(queue, pieceName);
 
260
    : FindPieceToIntrospect(pieceName);
262
261
 
263
262
  // FIXME this might not work, make sure it does.
264
263
  if (piece == NULL)
277
276
 * Do a breadth-first search of the introspectable tree.
278
277
 */
279
278
Introspectable*
280
 
FindPieceToIntrospect(std::queue<Introspectable*> queue, const std::string pieceName)
 
279
FindPieceToIntrospect(const std::string pieceName)
281
280
{
282
281
  Introspectable* piece;
 
282
  std::queue<Introspectable*> queue;
 
283
  queue.push(_parent_introspectable);
283
284
 
284
285
  while (!queue.empty())
285
286
  {
291
292
      return piece;
292
293
    }
293
294
 
294
 
    for (auto it = piece->GetIntrospectableChildren().begin(), last = piece->GetIntrospectableChildren().end(); it != last; it++)
 
295
    for (Introspectable* child : piece->GetIntrospectableChildren())
295
296
    {
296
 
      queue.push(*it);
 
297
      queue.push(child);
297
298
    }
298
 
 
299
 
    FindPieceToIntrospect(queue, pieceName);
300
299
  }
301
300
 
302
301
  return NULL;