~sil2100/unity-2d/bump_new_nux_libunity

« back to all changes in this revision

Viewing changes to launcher/app/visibilitycontroller.cpp

  • Committer: Florian Boucault
  • Date: 2011-11-18 10:15:49 UTC
  • mto: This revision was merged to the branch mainline in revision 784.
  • Revision ID: florian@boucault.net-20111118101549-20cfg7x2bi8za8zb
Centralised configuration management into config.h. All common accesses to DConf go through there.

New APIs available:
 QConf& unity2dConfiguration()
 QConf& launcher2dConfiguration()
 QConf& panel2dConfiguration()
 QConf& unityConfiguration()
 QConf& launcherConfiguration()
 QConf& panelConfiguration()

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
// unity-2d
30
30
#include <debug_p.h>
31
31
#include <unity2dpanel.h>
32
 
 
33
 
// libdconf-qt
34
 
#include "qconf.h"
 
32
#include <config.h>
35
33
 
36
34
// Qt
37
35
#include <QDBusConnection>
38
36
#include <QDBusServiceWatcher>
39
37
 
40
 
static const char* LAUNCHER_DCONF_SCHEMA = "com.canonical.Unity2d.Launcher";
41
 
 
42
38
VisibilityController::VisibilityController(Unity2dPanel* panel)
43
39
: QObject(panel)
44
40
, m_panel(panel)
45
 
, m_dconf_launcher(new QConf(LAUNCHER_DCONF_SCHEMA))
46
41
, m_dbusWatcher(new QDBusServiceWatcher(this))
47
42
{
48
43
    m_dbusWatcher->setConnection(QDBusConnection::sessionBus());
49
44
    m_dbusWatcher->setWatchMode(QDBusServiceWatcher::WatchForUnregistration);
50
45
 
51
 
    connect(m_dconf_launcher, SIGNAL(hideModeChanged(int)), SLOT(update()));
 
46
    connect(&launcher2dConfiguration(), SIGNAL(hideModeChanged(int)), SLOT(update()));
52
47
    connect(m_panel, SIGNAL(useStrutChanged(bool)), SLOT(update()));
53
48
    connect(m_panel, SIGNAL(manualSlidingChanged(bool)), SLOT(update()));
54
49
    connect(m_dbusWatcher, SIGNAL(serviceUnregistered(const QString&)), SLOT(slotServiceUnregistered(const QString&)));
57
52
 
58
53
VisibilityController::~VisibilityController()
59
54
{
60
 
    delete m_dconf_launcher;
61
55
}
62
56
 
63
57
void VisibilityController::update()
65
59
    if (!m_forceVisibleCountHash.isEmpty()) {
66
60
        return;
67
61
    }
68
 
    AutoHideMode mode = AutoHideMode(m_dconf_launcher->property("hideMode").toInt());
 
62
    AutoHideMode mode = AutoHideMode(launcher2dConfiguration().property("hideMode").toInt());
69
63
 
70
64
    setBehavior(0);
71
65