aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2018-03-28 10:36:02 +0000
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2018-03-28 10:36:02 +0000
commit929c53ab323d17aebae6278228c7a31353a3589e (patch)
tree5ebf1eb4099c8c8b807019520022fd923c0f4494
parent3b05bdde4416d19bebcbfc583719d692187dca6b (diff)
downloadayatana-indicator-datetime-929c53ab323d17aebae6278228c7a31353a3589e.tar.gz
ayatana-indicator-datetime-929c53ab323d17aebae6278228c7a31353a3589e.tar.bz2
ayatana-indicator-datetime-929c53ab323d17aebae6278228c7a31353a3589e.zip
URL dispatcher on non-Ubuntu: Fake it as best as possible, so that the unit tests are happy and succeed.
-rw-r--r--include/datetime/actions-live.h2
-rw-r--r--src/actions-live.cpp24
-rw-r--r--tests/timedated-fixture.h2
3 files changed, 4 insertions, 24 deletions
diff --git a/include/datetime/actions-live.h b/include/datetime/actions-live.h
index ea27f36..2c348c6 100644
--- a/include/datetime/actions-live.h
+++ b/include/datetime/actions-live.h
@@ -54,9 +54,7 @@ public:
protected:
virtual void execute_command(const std::string& command);
-#ifdef HAS_URLDISPATCHER
virtual void dispatch_url(const std::string& url);
-#endif
};
} // namespace datetime
diff --git a/src/actions-live.cpp b/src/actions-live.cpp
index 9225d30..e2fbf94 100644
--- a/src/actions-live.cpp
+++ b/src/actions-live.cpp
@@ -51,13 +51,15 @@ void LiveActions::execute_command(const std::string& cmdstr)
}
}
-#ifdef HAS_URLDISPATCHER
void LiveActions::dispatch_url(const std::string& url)
{
g_debug("Dispatching url '%s'", url.c_str());
+#ifdef HAS_URLDISPATCHER
url_dispatch_send(url.c_str(), nullptr, nullptr);
-}
+#else
+ // FIXME: Deal with this, if we build without liburl-dispatcher...
#endif
+}
/***
****
@@ -65,13 +67,11 @@ void LiveActions::dispatch_url(const std::string& url)
void LiveActions::desktop_open_settings_app()
{
-#ifdef HAS_URLDISPATCHER
if (g_getenv ("MIR_SOCKET") != nullptr)
{
dispatch_url("settings:///system/time-date");
}
else
-#endif
if ((g_strcmp0 (g_getenv ("XDG_CURRENT_DESKTOP"), "Unity") == 0))
{
execute_command("unity-control-center datetime");
@@ -137,11 +137,7 @@ void LiveActions::desktop_open_calendar_app(const DateTime& dt)
void LiveActions::phone_open_alarm_app()
{
-#ifdef HAS_URLDISPATCHER
dispatch_url("appid://com.ubuntu.clock/clock/current-user-version");
-#else
- // FIXME: Deal with this, if we build without liburl-dispatcher...
-#endif
}
void LiveActions::phone_open_appointment(const Appointment& appt)
@@ -149,11 +145,7 @@ void LiveActions::phone_open_appointment(const Appointment& appt)
if (!appt.activation_url.empty())
{
-#ifdef HAS_URLDISPATCHER
dispatch_url(appt.activation_url);
-#else
- // FIXME: Deal with this, if we build without liburl-dispatcher...
-#endif
}
else switch (appt.type)
{
@@ -168,21 +160,13 @@ void LiveActions::phone_open_appointment(const Appointment& appt)
void LiveActions::phone_open_calendar_app(const DateTime&)
{
-#ifdef HAS_URLDISPATCHER
// does calendar app have a mechanism for specifying dates?
dispatch_url("appid://com.ubuntu.calendar/calendar/current-user-version");
-#else
- // FIXME: Deal with this, if we build without liburl-dispatcher...
-#endif
}
void LiveActions::phone_open_settings_app()
{
-#ifdef HAS_URLDISPATCHER
dispatch_url("settings:///system/time-date");
-#else
- // FIXME: Deal with this, if we build without liburl-dispatcher...
-#endif
}
/***
diff --git a/tests/timedated-fixture.h b/tests/timedated-fixture.h
index 07b3d9f..00269e0 100644
--- a/tests/timedated-fixture.h
+++ b/tests/timedated-fixture.h
@@ -36,9 +36,7 @@ public:
~MockLiveActions() {}
protected:
-#ifdef HAS_URLDISPATCHER
void dispatch_url(const std::string& url) override { last_url = url; }
-#endif
void execute_command(const std::string& cmd) override { last_cmd = cmd; }
};