~oif-team/geis/client-arch

« back to all changes in this revision

Viewing changes to libutouch-geis/geis_subscription.c

  • Committer: Stephen M. Webb
  • Date: 2011-10-17 21:52:08 UTC
  • mfrom: (197.1.9 autodiscover-backend)
  • Revision ID: stephen.webb@canonical.com-20111017215208-gk9v99iouh4d07do
Added back-end autodiscovery and failover.

The default back end is now DBus, with a fallback to XCB if the DBus server is not detected.

Show diffs side-by-side

added added

removed removed

Lines of Context:
138
138
 
139
139
 
140
140
/*
141
 
 * Gets an iterator initialized to teh first subscription held in a bag.
 
141
 * Gets an iterator initialized to the first subscription held in a bag.
142
142
 */
143
143
GeisSubBagIterator
144
144
geis_subscription_bag_begin(GeisSubBag bag)
145
145
{
146
 
  return &bag->sub_store[0];
 
146
  if (bag->sub_store_size > 0 && bag->sub_store[0])
 
147
    return &bag->sub_store[0];
 
148
  return geis_subscription_bag_end(bag);
147
149
}
148
150
 
149
151
 
334
336
  GeisStatus status = GEIS_STATUS_UNKNOWN_ERROR;
335
337
  if (sub->sub_backend_token)
336
338
  {
337
 
    status = geis_backend_token_deactivate(sub->sub_backend_token);
 
339
    status = geis_backend_token_deactivate(sub->sub_backend_token, sub);
338
340
    geis_backend_token_delete(sub->sub_backend_token);
339
341
    sub->sub_backend_token = NULL;
340
342
  }
392
394
    goto unwind_name;
393
395
  }
394
396
 
395
 
  sub->sub_id = geis_subscription_bag_insert(geis_subscription_bag(geis), sub);
 
397
  sub->sub_id = geis_add_subscription(geis, sub);
396
398
  if (sub->sub_id < 0)
397
399
  {
398
400
    geis_error_push(geis, GEIS_STATUS_UNKNOWN_ERROR);
426
428
  geis_subscription_deactivate(sub);
427
429
  if (sub->sub_geis != NULL)
428
430
  {
429
 
    geis_subscription_bag_remove(geis_subscription_bag(sub->sub_geis), sub);
 
431
    geis_remove_subscription(sub->sub_geis, sub);
430
432
    geis_unref(sub->sub_geis);
431
433
  }
432
434
  if (sub->sub_filters != NULL)