aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2017-11-28 08:47:03 +0000
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2017-11-28 08:51:08 +0000
commitde76813c8421fd900e0d57038d28e8be693e33be (patch)
treed99b90ed99e1c42f0bd7ad4bef35770bce521720 /src
parent22d45854cb2c7a6374d6dfc631d684d01fcc9063 (diff)
downloadayatana-indicator-display-de76813c8421fd900e0d57038d28e8be693e33be.tar.gz
ayatana-indicator-display-de76813c8421fd900e0d57038d28e8be693e33be.tar.bz2
ayatana-indicator-display-de76813c8421fd900e0d57038d28e8be693e33be.zip
Fork from Ubuntus' indicator-display project.
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt6
-rw-r--r--src/dbus-names.h7
-rw-r--r--src/exporter.cpp8
-rw-r--r--src/greeter.cpp28
-rw-r--r--src/greeter.h12
-rw-r--r--src/main.cpp2
-rw-r--r--src/rotation-lock.cpp6
7 files changed, 37 insertions, 32 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 060071d..eb736c8 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,6 +1,9 @@
-
add_definitions(-DG_LOG_DOMAIN="${CMAKE_PROJECT_NAME}")
+if(EXISTS "/usr/share/glib-2.0/schemas/com.ubuntu.sound.gschema.xml")
+ add_definitions( -DHAS_UBUNTU_TOUCH_SCHEMA )
+endif()
+
add_compile_options(
${CXX_WARNING_ARGS}
)
@@ -34,4 +37,3 @@ install(
${SERVICE_EXEC}
RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_PKGLIBEXECDIR}
)
-
diff --git a/src/dbus-names.h b/src/dbus-names.h
index b31098a..aa7ef2a 100644
--- a/src/dbus-names.h
+++ b/src/dbus-names.h
@@ -39,11 +39,11 @@ namespace DBusNames
}
}
- namespace UnityGreeter
+ namespace Greeter
{
- static constexpr char const * NAME = "com.canonical.UnityGreeter";
+ static constexpr char const * NAME = "org.ayatana.Greeter";
static constexpr char const * PATH = "/";
- static constexpr char const * INTERFACE = "com.canonical.UnityGreeter";
+ static constexpr char const * INTERFACE = "org.ayatana.Greeter";
}
namespace Properties
@@ -57,4 +57,3 @@ namespace DBusNames
}
}
}
-
diff --git a/src/exporter.cpp b/src/exporter.cpp
index 252bbdf..b415a81 100644
--- a/src/exporter.cpp
+++ b/src/exporter.cpp
@@ -26,7 +26,7 @@ public:
explicit Impl(const std::shared_ptr<Indicator>& indicator):
m_indicator(indicator)
{
- auto bus_name = g_strdup_printf("com.canonical.indicator.%s", indicator->name());
+ auto bus_name = g_strdup_printf("org.ayatana.indicator.%s", indicator->name());
m_own_id = g_bus_own_name(G_BUS_TYPE_SESSION,
bus_name,
G_BUS_NAME_OWNER_FLAGS_NONE,
@@ -94,7 +94,7 @@ private:
// export the actions
error = nullptr;
- object_path = g_strdup_printf("/com/canonical/indicator/%s", indicator->name());
+ object_path = g_strdup_printf("/org/ayatana/indicator/%s", indicator->name());
id = g_dbus_connection_export_action_group(m_bus,
object_path,
G_ACTION_GROUP(indicator->action_group()),
@@ -151,7 +151,7 @@ private:
// build the header menu
auto detailed_action = g_strdup_printf("indicator.%s", action_name.c_str());
GMenuItem* header = g_menu_item_new(nullptr, detailed_action);
- g_menu_item_set_attribute(header, "x-canonical-type", "s", "com.canonical.indicator.root");
+ g_menu_item_set_attribute(header, "x-canonical-type", "s", "org.ayatana.indicator.root");
g_menu_item_set_submenu(header, profile->menu_model().get());
g_free(detailed_action);
@@ -161,7 +161,7 @@ private:
g_object_unref(header);
// export the menu
- auto object_path = g_strdup_printf("/com/canonical/indicator/%s/%s",
+ auto object_path = g_strdup_printf("/org/ayatana/indicator/%s/%s",
indicator->name(),
profile->name().c_str());
GError* error = nullptr;
diff --git a/src/greeter.cpp b/src/greeter.cpp
index 3d0f347..02eb0be 100644
--- a/src/greeter.cpp
+++ b/src/greeter.cpp
@@ -22,7 +22,7 @@
#include <gio/gio.h>
-class UnityGreeter::Impl
+class Greeter::Impl
{
public:
@@ -72,7 +72,7 @@ private:
const auto watcher_id = g_bus_watch_name_on_connection(
bus,
- DBusNames::UnityGreeter::NAME,
+ DBusNames::Greeter::NAME,
G_BUS_NAME_WATCHER_FLAGS_AUTO_START,
on_greeter_appeared,
on_greeter_vanished,
@@ -81,11 +81,11 @@ private:
const auto subscription_id = g_dbus_connection_signal_subscribe(
bus,
- DBusNames::UnityGreeter::NAME,
+ DBusNames::Greeter::NAME,
DBusNames::Properties::INTERFACE,
DBusNames::Properties::PropertiesChanged::NAME,
- DBusNames::UnityGreeter::PATH,
- DBusNames::UnityGreeter::INTERFACE,
+ DBusNames::Greeter::PATH,
+ DBusNames::Greeter::INTERFACE,
G_DBUS_SIGNAL_FLAGS_NONE,
on_properties_changed_signal,
gself,
@@ -114,11 +114,11 @@ private:
g_dbus_connection_call(
bus,
- DBusNames::UnityGreeter::NAME,
- DBusNames::UnityGreeter::PATH,
+ DBusNames::Greeter::NAME,
+ DBusNames::Greeter::PATH,
DBusNames::Properties::INTERFACE,
"Get",
- g_variant_new("(ss)", DBusNames::UnityGreeter::INTERFACE, "IsActive"),
+ g_variant_new("(ss)", DBusNames::Greeter::INTERFACE, "IsActive"),
G_VARIANT_TYPE("(v)"),
G_DBUS_CALL_FLAGS_NONE,
-1,
@@ -171,7 +171,7 @@ private:
auto self = static_cast<Impl*>(gself);
g_return_if_fail(!g_strcmp0(sender_name, self->m_owner.c_str()));
- g_return_if_fail(!g_strcmp0(object_path, DBusNames::UnityGreeter::PATH));
+ g_return_if_fail(!g_strcmp0(object_path, DBusNames::Greeter::PATH));
g_return_if_fail(!g_strcmp0(interface_name, DBusNames::Properties::INTERFACE));
g_return_if_fail(!g_strcmp0(signal_name, DBusNames::Properties::PropertiesChanged::NAME));
g_return_if_fail(g_variant_is_of_type(parameters, G_VARIANT_TYPE(DBusNames::Properties::PropertiesChanged::ARGS_VARIANT_TYPE)));
@@ -193,19 +193,19 @@ private:
****
***/
-Greeter::Greeter() =default;
+BaseGreeter::BaseGreeter() =default;
-Greeter::~Greeter() =default;
+BaseGreeter::~BaseGreeter() =default;
-UnityGreeter::UnityGreeter():
+Greeter::Greeter():
impl{new Impl{}}
{
}
-UnityGreeter::~UnityGreeter() =default;
+Greeter::~Greeter() =default;
core::Property<Greeter::State>&
-UnityGreeter::state()
+Greeter::state()
{
return impl->state();
}
diff --git a/src/greeter.h b/src/greeter.h
index f3012f6..0bfe026 100644
--- a/src/greeter.h
+++ b/src/greeter.h
@@ -24,11 +24,11 @@
#include <memory>
#include <string>
-class Greeter
+class BaseGreeter
{
public:
- Greeter();
- virtual ~Greeter();
+ BaseGreeter();
+ virtual ~BaseGreeter();
enum class State { UNAVAILABLE, INACTIVE, ACTIVE };
static inline const char* state_str(const State& state) {
@@ -39,11 +39,11 @@ static inline const char* state_str(const State& state) {
};
-class UnityGreeter: public Greeter
+class Greeter: public BaseGreeter
{
public:
- UnityGreeter();
- virtual ~UnityGreeter();
+ Greeter();
+ virtual ~Greeter();
core::Property<State>& state() override;
protected:
diff --git a/src/main.cpp b/src/main.cpp
index 52cdd58..e061871 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -63,7 +63,7 @@ main(int /*argc*/, char** /*argv*/)
static constexpr char const * ADB_SOCKET_PATH {"/dev/socket/adbd"};
static constexpr char const * PUBLIC_KEYS_FILENAME {"/data/misc/adb/adb_keys"};
auto usb_monitor = std::make_shared<GUDevUsbMonitor>();
- auto greeter = std::make_shared<UnityGreeter>();
+ auto greeter = std::make_shared<Greeter>();
UsbManager usb_manager {ADB_SOCKET_PATH, PUBLIC_KEYS_FILENAME, usb_monitor, greeter};
// let's go!
diff --git a/src/rotation-lock.cpp b/src/rotation-lock.cpp
index 88c7e1b..9af5f8e 100644
--- a/src/rotation-lock.cpp
+++ b/src/rotation-lock.cpp
@@ -123,7 +123,7 @@ private:
menu = g_menu_new();
menu_item = g_menu_item_new(_("Rotation Lock"), "indicator.rotation-lock");
- g_menu_item_set_attribute(menu_item, "x-canonical-type", "s", "com.canonical.indicator.switch");
+ g_menu_item_set_attribute(menu_item, "x-canonical-type", "s", "org.ayatana.indicator.switch");
g_menu_append_item(menu, menu_item);
g_object_unref(menu_item);
@@ -144,7 +144,11 @@ private:
****
***/
+#ifdef HAS_UBUNTU_TOUCH_SCHEMA
static constexpr char const * m_schema_name {"com.ubuntu.touch.system"};
+#else
+ static constexpr char const * m_schema_name {"org.ayatana.display"};
+#endif
static constexpr char const * m_rotation_lock_icon_name {"orientation-lock"};
GSettings* m_settings = nullptr;
GSimpleActionGroup* m_action_group = nullptr;