summaryrefslogtreecommitdiff
path: root/unity-shared
diff options
authorMarco Trevisan (Treviño) <mail@3v1n0.net>2013-09-03 17:03:55 +0100
committerMarco Trevisan (Treviño) <mail@3v1n0.net>2013-09-03 17:03:55 +0100
commita71c95a69bb3f3bbaec34a63693c6fc2d1529a2e (patch)
tree5a6bc1b1efaf90b3f3674570f7d70802d4409b2a /unity-shared
parentcf51adfa1345a2892f10f14e45304d48e07ca124 (diff)
DesktopApplicationManager: add skeleton implementation for event logging
(bzr r3477.5.26)
Diffstat (limited to 'unity-shared')
-rw-r--r--unity-shared/ApplicationManager.h31
-rw-r--r--unity-shared/BamfApplicationManager.h4
-rw-r--r--unity-shared/CMakeLists.txt1
-rw-r--r--unity-shared/DesktopApplicationManager.cpp31
-rw-r--r--unity-shared/DesktopApplicationManager.h44
-rw-r--r--unity-shared/ZeitgeistUtils.h3
6 files changed, 109 insertions, 5 deletions
diff --git a/unity-shared/ApplicationManager.h b/unity-shared/ApplicationManager.h
index 68c0a9726..ce8e9edce 100644
--- a/unity-shared/ApplicationManager.h
+++ b/unity-shared/ApplicationManager.h
@@ -34,17 +34,25 @@ namespace unity
class Application;
class ApplicationManager;
class ApplicationWindow;
+class ApplicationSubject;
typedef std::shared_ptr<Application> ApplicationPtr;
typedef std::shared_ptr<ApplicationWindow> ApplicationWindowPtr;
+typedef std::shared_ptr<ApplicationSubject> ApplicationSubjectPtr;
typedef std::vector<ApplicationPtr> ApplicationList;
typedef std::vector<ApplicationWindowPtr> WindowList;
+enum class ApplicationEventType
+{
+ CREATE,
+ DELETE,
+ ACCESS
+};
class ApplicationWindow
{
public:
- virtual ~ApplicationWindow() {}
+ virtual ~ApplicationWindow() = default;
virtual std::string type() const = 0; // 'window' or 'tab'
@@ -68,11 +76,10 @@ public:
nux::ROProperty<bool> urgent;
};
-
class Application
{
public:
- virtual ~Application() {}
+ virtual ~Application() = default;
virtual std::string type() const = 0;
@@ -91,6 +98,8 @@ public:
virtual bool CreateLocalDesktopFile() const = 0;
+ virtual void LogEvent(ApplicationEventType, ApplicationSubjectPtr const&) const = 0;
+
nux::ROProperty<std::string> desktop_file;
nux::ROProperty<std::string> title;
nux::ROProperty<std::string> icon;
@@ -111,6 +120,22 @@ public:
sigc::signal<void> window_closed;
};
+class ApplicationSubject
+{
+public:
+ virtual ~ApplicationSubject() = default;
+
+ nux::RWProperty<std::string> uri;
+ nux::RWProperty<std::string> origin;
+ nux::RWProperty<std::string> text;
+ nux::RWProperty<std::string> storage;
+ nux::RWProperty<std::string> current_uri;
+ nux::RWProperty<std::string> current_origin;
+ nux::RWProperty<std::string> mimetype;
+ nux::RWProperty<std::string> interpretation;
+ nux::RWProperty<std::string> manifestation;
+};
+
class ApplicationManager
{
diff --git a/unity-shared/BamfApplicationManager.h b/unity-shared/BamfApplicationManager.h
index a04446e88..00b25f335 100644
--- a/unity-shared/BamfApplicationManager.h
+++ b/unity-shared/BamfApplicationManager.h
@@ -24,7 +24,7 @@
#include <UnityCore/GLibWrapper.h>
#include <UnityCore/GLibSignal.h>
-#include "unity-shared/ApplicationManager.h"
+#include "unity-shared/DesktopApplicationManager.h"
namespace unity
@@ -104,7 +104,7 @@ private:
};
-class Application : public ::unity::Application, public View
+class Application : public ::unity::desktop::Application, public View
{
public:
Application(ApplicationManager const& manager,
diff --git a/unity-shared/CMakeLists.txt b/unity-shared/CMakeLists.txt
index d8f1f5960..0626e9fe7 100644
--- a/unity-shared/CMakeLists.txt
+++ b/unity-shared/CMakeLists.txt
@@ -25,6 +25,7 @@ set (UNITY_SHARED_SOURCES
DebugDBusInterface.cpp
DefaultThumbnailProvider.cpp
DeltaRestrainment.cpp
+ DesktopApplicationManager.cpp
GnomeFileManager.cpp
FontSettings.cpp
GraphicsUtils.cpp
diff --git a/unity-shared/DesktopApplicationManager.cpp b/unity-shared/DesktopApplicationManager.cpp
new file mode 100644
index 000000000..56c668b00
--- /dev/null
+++ b/unity-shared/DesktopApplicationManager.cpp
@@ -0,0 +1,31 @@
+// -*- 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 <marco.trevisan@canonical.com>
+ */
+
+#include "DesktopApplicationManager.h"
+
+namespace unity
+{
+namespace desktop
+{
+
+void Application::LogEvent(ApplicationEventType, ApplicationSubjectPtr const&) const
+{}
+
+} // namespace desktop
+} // namespace unity
diff --git a/unity-shared/DesktopApplicationManager.h b/unity-shared/DesktopApplicationManager.h
new file mode 100644
index 000000000..08ac61bd8
--- /dev/null
+++ b/unity-shared/DesktopApplicationManager.h
@@ -0,0 +1,44 @@
+// -*- 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 <marco.trevisan@canonical.com>
+ */
+
+#ifndef UNITYSHARED_DESKTOP_APPLICATION_MANAGER_H
+#define UNITYSHARED_DESKTOP_APPLICATION_MANAGER_H
+
+#include <UnityCore/GLibWrapper.h>
+#include <UnityCore/GLibSignal.h>
+
+#include "unity-shared/ApplicationManager.h"
+#include "unity-shared/ZeitgeistUtils.h"
+
+
+namespace unity
+{
+namespace desktop
+{
+class Application : public ::unity::Application
+{
+public:
+ virtual void LogEvent(ApplicationEventType, ApplicationSubjectPtr const&) const;
+};
+
+
+} // namespace desktop
+} // namespace unity
+
+#endif // UNITYSHARED_DESKTOP_APPLICATION_MANAGER_H
diff --git a/unity-shared/ZeitgeistUtils.h b/unity-shared/ZeitgeistUtils.h
index 17ca1a8d6..823978baa 100644
--- a/unity-shared/ZeitgeistUtils.h
+++ b/unity-shared/ZeitgeistUtils.h
@@ -41,10 +41,13 @@ namespace zeitgeist
{
namespace workaround
{
+namespace
+{
void ___dummy_function()
{
(void) zeitgeist_event_constructv_full;
}
+} // anonymous namespace
} // workaround namespace
} // zeitgeist namespace
} // unity namespace