~unity-2d-team/unity-2d/shortcut-hint-overlay

« back to all changes in this revision

Viewing changes to shell/app/shelldbus.cpp

  • Committer: Tiago Salem Herrmann
  • Date: 2012-03-19 15:28:41 UTC
  • mfrom: (771.40.182 unity-2d)
  • Revision ID: tiago.herrmann@canonical.com-20120319152841-2hfflo67muks7gca
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2011 Canonical, Ltd.
 
3
 *
 
4
 * Authors:
 
5
 *  Ugo Riboni <ugo.riboni@canonical.com>
 
6
 *  Michał Sawicz <michal.sawicz@canonical.com>
 
7
 *
 
8
 * This program is free software; you can redistribute it and/or modify
 
9
 * it under the terms of the GNU General Public License as published by
 
10
 * the Free Software Foundation; version 3.
 
11
 *
 
12
 * This program is distributed in the hope that it will be useful,
 
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
 * GNU General Public License for more details.
 
16
 *
 
17
 * You should have received a copy of the GNU General Public License
 
18
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
19
 */
 
20
 
 
21
#include "shelldbus.h"
 
22
 
 
23
// Local
 
24
#include <shelldeclarativeview.h>
 
25
#include "dashdbus.h"
 
26
#include "huddbus.h"
 
27
 
 
28
// Qt
 
29
#include <QtDBus/QDBusConnection>
 
30
 
 
31
static const char* SHELL_DBUS_SERVICE = "com.canonical.Unity2d.Shell";
 
32
static const char* DASH_DBUS_OBJECT_PATH = "/Dash";
 
33
static const char* HUD_DBUS_OBJECT_PATH = "/HUD";
 
34
 
 
35
ShellDBus::ShellDBus(ShellManager* manager, QObject* parent)
 
36
: QObject(parent)
 
37
, m_manager(manager)
 
38
{
 
39
}
 
40
 
 
41
ShellDBus::~ShellDBus()
 
42
{
 
43
    QDBusConnection::sessionBus().unregisterService(SHELL_DBUS_SERVICE);
 
44
}
 
45
 
 
46
bool
 
47
ShellDBus::connectToBus()
 
48
{
 
49
    bool ok = QDBusConnection::sessionBus().registerService(SHELL_DBUS_SERVICE);
 
50
    if (!ok) {
 
51
        return false;
 
52
    }
 
53
 
 
54
    DashDBus *dashDBus = new DashDBus(m_manager, this);
 
55
    QDBusConnection::sessionBus().registerObject(DASH_DBUS_OBJECT_PATH, dashDBus);
 
56
 
 
57
    HUDDBus *hudDBus = new HUDDBus(m_manager, this);
 
58
    QDBusConnection::sessionBus().registerObject(HUD_DBUS_OBJECT_PATH, hudDBus);
 
59
 
 
60
    return true;
 
61
}