~brandontschaefer/unity/move-pointer-barrier-to-xi-1.6.99.1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
/*
* Copyright (C) 2013 Canonical Ltd
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
*
* Authored by: Marco Trevisan (TreviƱo) <marco.trevisan@canonical.com>
*/

#include <NuxCore/Logger.h>

#include "GLibDBusServer.h"
#include "Variant.h"

namespace unity
{
namespace glib
{
namespace
{
void safe_interface_info_unref(GDBusInterfaceInfo* info)
{
  if (info) ::g_dbus_interface_info_unref(info);
}

void safe_node_info_unref(GDBusNodeInfo* info)
{
  if (info) ::g_dbus_node_info_unref(info);
}
}

DECLARE_LOGGER(logger_o, "unity.glib.dbus.object");

struct DBusObject::Impl
{
  Impl(DBusObject* obj, std::string const& introspection_xml, std::string const& interface_name)
    : object_(obj)
    , interface_info_(nullptr, safe_interface_info_unref)
  {
    glib::Error error;
    auto xml_int = g_dbus_node_info_new_for_xml(introspection_xml.c_str(), &error);
    std::shared_ptr<GDBusNodeInfo> node_info(xml_int, safe_node_info_unref);

    if (error)
    {
      LOG_ERROR(logger_o) << "Unable to parse the given introspection for "
                          << interface_name << ": " << error.Message();
    }

    if (!node_info)
      return;

    interface_info_.reset(g_dbus_node_info_lookup_interface(node_info.get(), interface_name.c_str()));

    if (!interface_info_)
    {
      LOG_ERROR(logger_o) << "Unable to find the interface '" << interface_name
                          << "' in the provided introspection XML";
      return;
    }

    g_dbus_interface_info_ref(interface_info_.get());

    interface_vtable_.method_call = [] (GDBusConnection* connection, const gchar* sender,
                                        const gchar* object_path, const gchar* interface_name,
                                        const gchar* method_name, GVariant* parameters,
                                        GDBusMethodInvocation* invocation, gpointer user_data) {
      auto self = static_cast<DBusObject::Impl*>(user_data);
      GVariant *ret = nullptr;

      if (self->method_cb_)
      {
        ret = self->method_cb_(method_name ? method_name : "", parameters);

        LOG_INFO(logger_o) << "Called method: '" << method_name << " "
                           << (parameters ? String(g_variant_print(parameters, TRUE)) : "()")
                           << "' on object '" << object_path << "' with interface '"
                           << interface_name << "' , returning: '"
                           << (ret ? String(g_variant_print(ret, TRUE)) : "()") << "'";

        const GDBusMethodInfo* info = g_dbus_method_invocation_get_method_info(invocation);

        if ((!ret || g_variant_equal(ret, glib::Variant(g_variant_new("()")))) && info->out_args && info->out_args[0])
        {
          LOG_ERROR(logger_o) << "Retuning NULL on method call '" << method_name << "' "
                              << "while its interface requires a value";

          std::string error_name = std::string(interface_name)+".Error.BadReturn";
          std::string error = "Returning invalid value for '"+std::string(method_name)+"' on path '"+std::string(object_path)+"'.";
          g_dbus_method_invocation_return_dbus_error(invocation, error_name.c_str(), error.c_str());

          if (ret)
            g_variant_unref (ret);
        }
        else
        {
          g_dbus_method_invocation_return_value(invocation, ret);
        }
      }
      else
      {
        LOG_WARN(logger_o) << "Called method: '" << method_name << " "
                           << (parameters ? String(g_variant_print(parameters, TRUE)) : "()")
                           << "' on object '" << object_path << "' with interface '"
                           << interface_name << "', but no methods handler is set";

        std::string error_name = std::string(interface_name)+".Error.NoHandlerSet";
        std::string error = "No handler set for method '"+std::string(method_name)+"' on path '"+std::string(object_path)+"'.";
        g_dbus_method_invocation_return_dbus_error(invocation, error_name.c_str(), error.c_str());
      }
    };

    interface_vtable_.get_property = [] (GDBusConnection* connection, const gchar* sender,
                                         const gchar* object_path, const gchar* interface_name,
                                         const gchar* property_name, GError **error, gpointer user_data) {
      auto self = static_cast<DBusObject::Impl*>(user_data);
      GVariant *value = nullptr;

      if (self->property_get_cb_)
        value = self->property_get_cb_(property_name ? property_name : "");

      LOG_INFO(logger_o) << "Getting property '" << property_name << "' on '"
                         << interface_name << "' , returning: '"
                         << (value ? String(g_variant_print(value, TRUE)) : "()") << "'";

      return value;
    };

    interface_vtable_.set_property = [] (GDBusConnection* connection, const gchar* sender,
                                         const gchar* object_path, const gchar* interface_name,
                                         const gchar* property_name, GVariant *value,
                                         GError **error, gpointer user_data) {
      auto self = static_cast<DBusObject::Impl*>(user_data);
      glib::Variant old_value;
      gboolean ret = TRUE;

      if (self->property_get_cb_)
        old_value = self->property_get_cb_(property_name ? property_name : "");

      if (self->property_set_cb_)
      {
        if (!self->property_set_cb_(property_name ? property_name : "", value))
        {
          ret = FALSE;

          g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "It was impossible " \
                       "to set the property '%s' on '%s'", property_name, interface_name);
        }
      }

      if (ret)
      {
        LOG_INFO(logger_o) << "Setting property '" << property_name << "' on '"
                           << interface_name << "' , to value: '"
                           << (value ? String(g_variant_print(value, TRUE)) : "<null>") << "'";

        if (old_value && !g_variant_equal(old_value, value))
          self->EmitPropertyChanged(property_name ? property_name : "");
      }
      else
      {
        LOG_WARN(logger_o) << "It was impossible to set the property '"
                           << property_name << "' on '" << interface_name
                           << "' , to value: '"
                           << (value ? String(g_variant_print(value, TRUE)) : "()")
                           << "'";
      }

      return ret;
    };
  }

  ~Impl()
  {
    UnRegister();
  }

  std::string InterfaceName() const
  {
    if (interface_info_ && interface_info_->name)
      return interface_info_->name;

    return "";
  }

  bool Register(glib::Object<GDBusConnection> const& conn, std::string const& path)
  {
    if (!interface_info_)
    {
      LOG_ERROR(logger_o) << "Can't register object '" << InterfaceName()
                          << "', bad interface";
      return false;
    }

    if (connection_by_path_.find(path) != connection_by_path_.end())
    {
      LOG_ERROR(logger_o) << "Can't register object '" << InterfaceName()
                          << "', it's already registered on path '" << path << "'";
      return false;
    }

    if (!conn.IsType(G_TYPE_DBUS_CONNECTION))
    {
      LOG_ERROR(logger_o) << "Can't register object '" << InterfaceName()
                          << "', invalid connection";
      return false;
    }

    glib::Error error;

    guint id = g_dbus_connection_register_object(conn, path.c_str(), interface_info_.get(),
                                                 &interface_vtable_, this, nullptr, &error);
    if (error)
    {
      LOG_ERROR(logger_o) << "Could not register object in dbus: "
                          << error.Message();
      return false;
    }

    registrations_[id] = path;
    connection_by_path_[path] = conn;
    object_->registered.emit(path);

    LOG_INFO(logger_o) << "Registering object '" << InterfaceName() << "'";

    return true;
  }

  void UnRegister(std::string const& path = "")
  {
    if (!path.empty())
    {
      auto conn_it = connection_by_path_.find(path);

      if (conn_it == connection_by_path_.end())
      {
        LOG_WARN(logger_o) << "Impossible unregistering object for path " << path;
        return;
      }

      guint registration_id = 0;

      for (auto const& pair : registrations_)
      {
        auto const& obj_path = pair.second;

        if (obj_path == path)
        {
          registration_id = pair.first;
          g_dbus_connection_unregister_object(conn_it->second, registration_id);
          object_->unregistered.emit(path);

          LOG_INFO(logger_o) << "Unregistering object '" << InterfaceName() << "'"
                             << " on path '" << path << "'";
          break;
        }
      }

      registrations_.erase(registration_id);
      connection_by_path_.erase(conn_it);

      if (registrations_.empty())
        object_->fully_unregistered.emit();
    }
    else
    {
      for (auto const& pair : registrations_)
      {
        auto const& registration_id = pair.first;
        auto const& obj_path = pair.second;
        auto const& connection = connection_by_path_[obj_path];

        g_dbus_connection_unregister_object(connection, registration_id);
        object_->unregistered.emit(obj_path);

        LOG_INFO(logger_o) << "Unregistering object '" << InterfaceName() << "'"
                           << " on path '" << obj_path << "'";
      }

      registrations_.clear();
      connection_by_path_.clear();
      object_->fully_unregistered.emit();
    }
  }

  void EmitGenericSignal(glib::Object<GDBusConnection> const& conn, std::string const& path,
                         std::string const& interface, std::string const& signal,
                         GVariant* parameters = nullptr)
  {
    LOG_INFO(logger_o) << "Emitting signal '" << signal << "'" << " for the interface "
                     << "'" << interface << "' on object path '" << path << "'";

    glib::Error error;
    g_dbus_connection_emit_signal(conn, nullptr, path.c_str(), interface.c_str(),
                                  signal.c_str(), parameters, &error);

    if (error)
    {
      LOG_ERROR(logger_o) << "Got error when emitting signal '" << signal << "': "
                          << " for the interface '" << interface << "' on object path '"
                          << path << "': " << error.Message();
    }
  }

  void EmitSignal(std::string const& signal, GVariant* parameters, std::string const& path)
  {
    glib::Variant reffed_params(parameters);

    if (signal.empty())
    {
      LOG_ERROR(logger_o) << "Impossible to emit an empty signal";
      return;
    }

    if (!path.empty())
    {
      auto conn_it = connection_by_path_.find(path);

      if (conn_it == connection_by_path_.end())
      {
        LOG_ERROR(logger_o) << "Impossible to emit signal '" << signal << "' "
                            << "on object path '" << path << "': no connection available";
        return;
      }

      EmitGenericSignal(conn_it->second, path, InterfaceName(), signal, parameters);
    }
    else
    {
      for (auto const& pair : connection_by_path_)
      {
        glib::Variant params(parameters);
        auto const& obj_path = pair.first;
        auto const& conn = pair.second;

        EmitGenericSignal(conn, obj_path, InterfaceName(), signal, params);
      }
    }
  }

  void EmitPropertyChanged(std::string const& property, std::string const& path = "")
  {
    if (property.empty())
    {
      LOG_ERROR(logger_o) << "Impossible to emit a changed property for an invalid one";
      return;
    }

    if (!property_get_cb_)
    {
      LOG_ERROR(logger_o) << "We don't have a property getter for this object";
      return;
    }

    GVariant* value = property_get_cb_(property.c_str());

    if (!value)
    {
      LOG_ERROR(logger_o) << "The property value is not valid";
      return;
    }

    auto builder = g_variant_builder_new(G_VARIANT_TYPE_ARRAY);
    g_variant_builder_add(builder, "{sv}", property.c_str(), value);
    glib::Variant parameters(g_variant_new("(sa{sv}as)", InterfaceName().c_str(), builder, nullptr));

    if (!path.empty())
    {
      auto conn_it = connection_by_path_.find(path);

      if (conn_it == connection_by_path_.end())
      {
        LOG_ERROR(logger_o) << "Impossible to emit property changed '" << property << "' "
                            << "on object path '" << path << "': no connection available";
        return;
      }

      EmitGenericSignal(conn_it->second, path, "org.freedesktop.DBus.Properties", "PropertiesChanged", parameters);
    }
    else
    {
      for (auto const& pair : connection_by_path_)
      {
        glib::Variant reffed_params(parameters);
        auto const& obj_path = pair.first;
        auto const& conn = pair.second;

        EmitGenericSignal(conn, obj_path, "org.freedesktop.DBus.Properties", "PropertiesChanged", reffed_params);
      }
    }
  }

  DBusObject* object_;
  MethodCallback method_cb_;
  PropertyGetterCallback property_get_cb_;
  PropertySetterCallback property_set_cb_;

  GDBusInterfaceVTable interface_vtable_;
  std::shared_ptr<GDBusInterfaceInfo> interface_info_;
  std::map<guint, std::string> registrations_;
  std::map<std::string, glib::Object<GDBusConnection>> connection_by_path_;
};

DBusObject::DBusObject(std::string const& introspection_xml, std::string const& interface_name)
  : impl_(new DBusObject::Impl(this, introspection_xml, interface_name))
{}

DBusObject::~DBusObject()
{}

void DBusObject::SetMethodsCallsHandler(MethodCallback const& func)
{
  impl_->method_cb_ = func;
}

void DBusObject::SetPropertyGetter(PropertyGetterCallback const& func)
{
  impl_->property_get_cb_ = func;
}

void DBusObject::SetPropertySetter(PropertySetterCallback const& func)
{
  impl_->property_set_cb_ = func;
}

std::string DBusObject::InterfaceName() const
{
  return impl_->InterfaceName();
}

bool DBusObject::Register(glib::Object<GDBusConnection> const& conn, std::string const& path)
{
  return impl_->Register(conn, path);
}

void DBusObject::UnRegister(std::string const& path)
{
  impl_->UnRegister(path);
}

void DBusObject::EmitSignal(std::string const& signal, GVariant* parameters, std::string const& path)
{
  impl_->EmitSignal(signal, parameters, path);
}

void DBusObject::EmitPropertyChanged(std::string const& property, std::string const& path)
{
  impl_->EmitPropertyChanged(property, path);
}

// DBusObjectBuilder

DECLARE_LOGGER(logger_b, "unity.glib.dbus.object.builder");

std::list<DBusObject::Ptr> DBusObjectBuilder::GetObjectsForIntrospection(std::string const& xml)
{
  std::list<DBusObject::Ptr> objects;
  glib::Error error;
  auto xml_int = g_dbus_node_info_new_for_xml(xml.c_str(), &error);
  std::shared_ptr<GDBusNodeInfo> node_info(xml_int, safe_node_info_unref);

  if (error || !node_info)
  {
    LOG_ERROR(logger_b) << "Unable to parse the given introspection: "
                        << error.Message();

    return objects;
  }

  for (unsigned i = 0; node_info->interfaces[i]; ++i)
  {
    glib::Error error;
    GDBusInterfaceInfo *interface = node_info->interfaces[i];

    auto obj = std::make_shared<DBusObject>(xml, interface->name);
    objects.push_back(obj);
  }

  return objects;
}

// DBusServer

DECLARE_LOGGER(logger_s, "unity.glib.dbus.server");

struct DBusServer::Impl
{
  Impl(DBusServer* server, std::string const& name = "")
    : server_(server)
    , name_(name)
    , name_owned_(false)
    , owner_name_(0)
  {}

  Impl(DBusServer* server, std::string const& name, GBusType bus_type)
    : Impl(server, name)
  {
    owner_name_ = g_bus_own_name(bus_type, name.c_str(), G_BUS_NAME_OWNER_FLAGS_NONE,
      [] (GDBusConnection* conn, const gchar* name, gpointer data)
      {
        auto self = static_cast<DBusServer::Impl*>(data);

        LOG_INFO(logger_s) << "DBus name acquired '" << name << "'";

        self->connection_ = glib::Object<GDBusConnection>(conn, glib::AddRef());
        self->name_owned_ = true;
        self->server_->name_acquired.emit();
        self->server_->connected.emit();
        self->RegisterPendingObjects();
      }, nullptr,
      [] (GDBusConnection *connection, const gchar *name, gpointer data)
      {
        auto self = static_cast<DBusServer::Impl*>(data);

        LOG_ERROR(logger_s) << "DBus name lost '" << name << "'";

        self->name_owned_ = false;
        self->server_->name_lost.emit();
      }, this, nullptr);
  }

  Impl(DBusServer* server, GBusType bus_type)
    : Impl(server)
  {
    g_bus_get(bus_type, cancellable_, [] (GObject*, GAsyncResult* res, gpointer data) {
      auto self = static_cast<DBusServer::Impl*>(data);
      glib::Error error;

      GDBusConnection* conn = g_bus_get_finish(res, &error);

      if (!error)
      {
        self->connection_ = glib::Object<GDBusConnection>(conn, glib::AddRef());
        self->server_->connected.emit();
        self->RegisterPendingObjects();
      }
      else
      {
        LOG_ERROR(logger_s) << "Can't get bus: " << error.Message();
      }
    }, this);
  }

  ~Impl()
  {
    if (owner_name_)
      g_bus_unown_name(owner_name_);

    LOG_INFO(logger_s) << "Removing dbus server";
  }

  void RegisterPendingObjects()
  {
    for (auto const& pair : pending_objects_)
      AddObject(pair.first, pair.second);

    pending_objects_.clear();
  }

  bool AddObject(DBusObject::Ptr const& obj, std::string const& path)
  {
    if (!obj)
    {
      LOG_ERROR(logger_s) << "Can't register an invalid object";
      return false;
    }

    if (!connection_)
    {
      LOG_WARN(logger_s) << "Can't register object '" << obj->InterfaceName()
                         << "' yet as we don't have a connection, waiting for it...";

      pending_objects_.push_back(std::make_pair(obj, path));
    }
    else
    {
      if (obj->Register(connection_, path))
      {
        objects_.push_back(obj);
        return true;
      }
    }

    return false;
  }

  bool RemoveObject(DBusObject::Ptr const& obj)
  {
    if (!obj)
      return false;

    bool removed = false;

    for (auto it = pending_objects_.begin(); it != pending_objects_.end(); ++it)
    {
      if (it->first == obj)
      {
        pending_objects_.erase(it);
        removed = true;
        LOG_INFO(logger_s) << "Removing object '" << obj->InterfaceName() << "' ...";
        break;
      }
    }

    if (!removed)
    {
      auto it = std::find(objects_.begin(), objects_.end(), obj);
      if (it != objects_.end())
      {
        objects_.erase(it);
        removed = true;
        LOG_INFO(logger_s) << "Removing object '" << obj->InterfaceName() << "' ...";
      }
    }

    if (removed)
    {
      obj->UnRegister();
    }

    return removed;
  }

  DBusObject::Ptr GetObject(std::string const& interface) const
  {
    for (auto const& pair : pending_objects_)
    {
      if (pair.first->InterfaceName() == interface)
        return pair.first;
    }

    for (auto const& obj : objects_)
    {
      if (obj->InterfaceName() == interface)
        return obj;
    }

    return DBusObject::Ptr();
  }

  void EmitSignal(std::string const& interface, std::string const& signal, GVariant* parameters)
  {
    auto const& obj = GetObject(interface);

    if (obj)
      obj->EmitSignal(signal, parameters);
  }

  DBusServer* server_;
  std::string name_;
  bool name_owned_;
  guint owner_name_;
  glib::Cancellable cancellable_;
  glib::Object<GDBusConnection> connection_;
  std::vector<DBusObject::Ptr> objects_;
  std::vector<std::pair<DBusObject::Ptr, std::string>> pending_objects_;
};

DBusServer::DBusServer(std::string const& name, GBusType bus_type)
  : impl_(new DBusServer::Impl(this, name, bus_type))
{}

DBusServer::DBusServer(GBusType bus_type)
  : impl_(new DBusServer::Impl(this, bus_type))
{}

DBusServer::~DBusServer()
{}

bool DBusServer::IsConnected() const
{
  return impl_->connection_.IsType(G_TYPE_DBUS_CONNECTION);
}

std::string const& DBusServer::Name() const
{
  return impl_->name_;
}

bool DBusServer::OwnsName() const
{
  return impl_->name_owned_;
}

void DBusServer::AddObjects(std::string const& introspection_xml, std::string const& path)
{
  auto const& objs = DBusObjectBuilder::GetObjectsForIntrospection(introspection_xml);

  if (objs.empty())
  {
    LOG_WARN(logger_s) << "Impossible to add empty objects list";
  }
  else
  {
    for (auto const& obj : objs)
      AddObject(obj, path);
  }
}

bool DBusServer::AddObject(DBusObject::Ptr const& obj, std::string const& path)
{
  return impl_->AddObject(obj, path);
}

bool DBusServer::RemoveObject(DBusObject::Ptr const& obj)
{
  return impl_->RemoveObject(obj);
}

std::list<DBusObject::Ptr> DBusServer::GetObjects() const
{
  std::list<DBusObject::Ptr> objects;

  for (auto const& pair : impl_->pending_objects_)
    objects.push_back(pair.first);

  for (auto const& obj : impl_->objects_)
    objects.push_back(obj);

  return objects;
}

DBusObject::Ptr DBusServer::GetObject(std::string const& interface) const
{
  return impl_->GetObject(interface);
}

void DBusServer::EmitSignal(std::string const& interface, std::string const& signal, GVariant* parameters)
{
  impl_->EmitSignal(interface, signal, parameters);
}

} // namespace glib
} // namespace unity