~sil2100/unity-2d/bump_new_nux_libunity

768.4.3 by Renato Araujo Oliveira Filho
[cmake] Fixed config.h.in file variables for plugin directory.
1
#define INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@"
768.4.6 by Renato Araujo Oliveira Filho
Merge the latest changes from trunk.
2
#define INSTALL_LIBDIR "@CMAKE_INSTALL_LIBDIR@"
3
#define INSTALL_BINDIR "@CMAKE_INSTALL_BINDIR@"
768.4.3 by Renato Araujo Oliveira Filho
[cmake] Fixed config.h.in file variables for plugin directory.
4
#define UNITY_2D_DIR "@UNITY_2D_DIR@"
5
#define UNITY_DIR "@UNITY_DIR@"
807.1.1 by Tiago Salem Herrmann
[lib] avoid SIGABRT in dash when the schema file isn't properly installed
6
#define UNITY_2D_SCHEMA_FILE "@UNITY_2D_SCHEMA_FILE@"
284.1.1 by Florian Boucault
Deprecated THEME_DIR.
7
8
#include <QCoreApplication>
896.1.1 by Florian Boucault
Support running installed inside a directory that is a symlink.
9
#include <QDir>
783.1.1 by Florian Boucault
Centralised configuration management into config.h. All common accesses to DConf go through there.
10
#include "qconf.h"
11
12
static const char* UNITY2D_DCONF_SCHEMA = "com.canonical.Unity2d";
13
static const char* LAUNCHER2D_DCONF_SCHEMA = "com.canonical.Unity2d.Launcher";
14
static const char* PANEL2D_DCONF_SCHEMA = "com.canonical.Unity2d.Panel";
861.1.1 by Ugo Riboni
Add com/canonical/Unity2d/Dash/full-screen to dconf to preserve dash fullscreen state across sessions (and share it with other processes)
15
static const char* DASH2D_DCONF_SCHEMA = "com.canonical.Unity2d.Dash";
783.1.1 by Florian Boucault
Centralised configuration management into config.h. All common accesses to DConf go through there.
16
17
static const char* UNITY_DCONF_SCHEMA = "com.canonical.Unity";
18
static const char* LAUNCHER_DCONF_SCHEMA = "com.canonical.Unity.Launcher";
19
static const char* PANEL_DCONF_SCHEMA = "com.canonical.Unity.Panel";
20
21
inline QConf& unity2dConfiguration() {
22
    static QConf configuration(UNITY2D_DCONF_SCHEMA);
23
    return configuration;
24
}
25
26
inline QConf& launcher2dConfiguration() {
27
    static QConf configuration(LAUNCHER2D_DCONF_SCHEMA);
28
    return configuration;
29
}
30
31
inline QConf& panel2dConfiguration() {
32
    static QConf configuration(PANEL2D_DCONF_SCHEMA);
33
    return configuration;
34
}
35
861.1.1 by Ugo Riboni
Add com/canonical/Unity2d/Dash/full-screen to dconf to preserve dash fullscreen state across sessions (and share it with other processes)
36
inline QConf& dash2dConfiguration() {
37
    static QConf configuration(DASH2D_DCONF_SCHEMA);
38
    return configuration;
39
}
40
783.1.1 by Florian Boucault
Centralised configuration management into config.h. All common accesses to DConf go through there.
41
inline QConf& unityConfiguration() {
42
    static QConf configuration(UNITY_DCONF_SCHEMA);
43
    return configuration;
44
}
45
46
inline QConf& launcherConfiguration() {
47
    static QConf configuration(LAUNCHER_DCONF_SCHEMA);
48
    return configuration;
49
}
50
51
inline QConf& panelConfiguration() {
52
    static QConf configuration(PANEL_DCONF_SCHEMA);
53
    return configuration;
54
}
55
284.1.1 by Florian Boucault
Deprecated THEME_DIR.
56
284.1.7 by Florian Boucault
QCoreApplication::applicationDirPath() needs to be called after QApplication
57
inline bool isRunningInstalled() {
896.1.1 by Florian Boucault
Support running installed inside a directory that is a symlink.
58
    static bool installed = (QCoreApplication::applicationDirPath() == QDir((INSTALL_PREFIX "/" INSTALL_BINDIR)).canonicalPath());
59
    return installed;
284.1.7 by Florian Boucault
QCoreApplication::applicationDirPath() needs to be called after QApplication
60
}
284.1.1 by Florian Boucault
Deprecated THEME_DIR.
61
360.1.2 by Florian Boucault
Renamed unityQt into unity2d
62
inline QString unity2dDirectory() {
284.1.7 by Florian Boucault
QCoreApplication::applicationDirPath() needs to be called after QApplication
63
    if (isRunningInstalled()) {
360.1.1 by Florian Boucault
Renamed UNITY_QT_ into UNITY_2D_
64
        return QString(INSTALL_PREFIX "/" UNITY_2D_DIR);
284.1.10 by Florian Boucault
Respect camelCasing for variables.
65
    } else {
768.4.1 by Renato Araujo Oliveira Filho
[cmake] Update cmake scripts to allow build and test application in a different directory.
66
        return QString("@CMAKE_SOURCE_DIR@/");
284.1.1 by Florian Boucault
Deprecated THEME_DIR.
67
    }
68
}
69
360.1.2 by Florian Boucault
Renamed unityQt into unity2d
70
inline QString unity2dImportPath() {
284.1.7 by Florian Boucault
QCoreApplication::applicationDirPath() needs to be called after QApplication
71
    if (isRunningInstalled()) {
776.1.1 by Olivier Tilloy
Un-hardcode standard install paths (use GNUInstallDirs.cmake).
72
        return QString(INSTALL_PREFIX "/" INSTALL_LIBDIR "/qt4/imports");
284.1.10 by Florian Boucault
Respect camelCasing for variables.
73
    } else {
768.4.1 by Renato Araujo Oliveira Filho
[cmake] Update cmake scripts to allow build and test application in a different directory.
74
        return QString("@CMAKE_BINARY_DIR@/libunity-2d-private/");
284.1.1 by Florian Boucault
Deprecated THEME_DIR.
75
    }
76
}
574.76.1 by Ugo Riboni
Add basic support for loading panel applets from QT plugins and defining the panel layout in dconf
77
78
inline QString unity2dPluginsPath() {
79
    if (isRunningInstalled()) {
776.1.1 by Olivier Tilloy
Un-hardcode standard install paths (use GNUInstallDirs.cmake).
80
        return QString(INSTALL_PREFIX "/" INSTALL_LIBDIR "/unity-2d/plugins");
574.76.1 by Ugo Riboni
Add basic support for loading panel applets from QT plugins and defining the panel layout in dconf
81
    } else {
768.4.3 by Renato Araujo Oliveira Filho
[cmake] Fixed config.h.in file variables for plugin directory.
82
        return QString("@CMAKE_BINARY_DIR@");
574.76.1 by Ugo Riboni
Add basic support for loading panel applets from QT plugins and defining the panel layout in dconf
83
    }
84
}