~unity-team/unity/trusty-1066971

« back to all changes in this revision

Viewing changes to UnityCore/GLibDBusProxy.cpp

* Removed debian/patches/libgeis-rename.patch
* debian/unity.lintian-overrides,
  debian/libunity-core-6.0-5.lintian-overrides:
  - added override to silence the binary-or-shlib-defines-rpath error, since
    we are forced to use RPATH in our case
* New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
#include "GLibWrapper.h"
28
28
#include "GLibSignal.h"
29
29
#include "GLibSource.h"
 
30
#include "Variant.h"
30
31
 
31
32
namespace unity
32
33
{
77
78
  struct CallData
78
79
  {
79
80
    DBusProxy::ReplyCallback callback;
80
 
    DBusProxy::Impl* impl;
81
81
    std::string method_name;
82
82
  };
83
83
 
242
242
  {
243
243
    CallData* data = new CallData();
244
244
    data->callback = callback;
245
 
    data->impl = this;
246
245
    data->method_name = method_name;
247
246
 
248
247
    g_dbus_proxy_call(proxy_,
264
263
void DBusProxy::Impl::OnCallCallback(GObject* source, GAsyncResult* res, gpointer call_data)
265
264
{
266
265
  glib::Error error;
267
 
  std::unique_ptr<CallData> data (static_cast<CallData*>(call_data));
268
 
  GVariant* result = g_dbus_proxy_call_finish(G_DBUS_PROXY(source), res, &error);
269
 
 
270
 
  if (error && g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
271
 
  {
272
 
    // silently ignore
273
 
  }
274
 
  else if (error)
275
 
  {
276
 
    // Do not touch the impl pointer as the operation may have been cancelled
277
 
    LOG_WARNING(logger) << "Calling method \"" << data->method_name
278
 
      << "\" on object path: \""
279
 
      << g_dbus_proxy_get_object_path (G_DBUS_PROXY (source))
280
 
      << "\" failed: " << error;
281
 
  }
282
 
  else
283
 
  {
 
266
  std::unique_ptr<CallData> data(static_cast<CallData*>(call_data));
 
267
  glib::Variant result(g_dbus_proxy_call_finish(G_DBUS_PROXY(source), res, &error), glib::StealRef());
 
268
 
 
269
  if (error)
 
270
  {
 
271
    if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
 
272
    {
 
273
      // silently ignore
 
274
    }
 
275
    else
 
276
    {
 
277
      LOG_WARNING(logger) << "Calling method \"" << data->method_name
 
278
        << "\" on object path: \""
 
279
        << g_dbus_proxy_get_object_path(G_DBUS_PROXY(source))
 
280
        << "\" failed: " << error;
 
281
    }
 
282
 
 
283
    return;
 
284
  }
 
285
 
 
286
  if (data->callback)
284
287
    data->callback(result);
285
 
    g_variant_unref(result);
286
 
  }
287
288
}
288
289
 
289
290
void DBusProxy::Impl::Connect(std::string const& signal_name, ReplyCallback callback)
290
291
{
291
 
  handlers_[signal_name].push_back(callback);
 
292
  if (callback)
 
293
    handlers_[signal_name].push_back(callback);
292
294
}
293
295
 
294
296
DBusProxy::DBusProxy(string const& name,