aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2018-03-26 19:55:23 +0000
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2018-03-26 19:55:23 +0000
commitb39526c27c44302c34fce26163919a0c4c7aecd3 (patch)
treebe0d3759a081f90b73aa90e0cf1b5a2a6a9783f3 /src
parent8dbc66cab4eadfdde3809340d03c4cc10b2032eb (diff)
downloadayatana-indicator-datetime-b39526c27c44302c34fce26163919a0c4c7aecd3.tar.gz
ayatana-indicator-datetime-b39526c27c44302c34fce26163919a0c4c7aecd3.tar.bz2
ayatana-indicator-datetime-b39526c27c44302c34fce26163919a0c4c7aecd3.zip
URL dispatcher support: Build phone code, even if URL dispatcher is unavailable.
Diffstat (limited to 'src')
-rw-r--r--src/actions-live.cpp18
-rw-r--r--src/actions.cpp5
-rw-r--r--src/menu.cpp18
3 files changed, 19 insertions, 22 deletions
diff --git a/src/actions-live.cpp b/src/actions-live.cpp
index 994fc3c..9225d30 100644
--- a/src/actions-live.cpp
+++ b/src/actions-live.cpp
@@ -135,10 +135,13 @@ void LiveActions::desktop_open_calendar_app(const DateTime& dt)
****
***/
-#ifdef HAS_URLDISPATCHER
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)
@@ -146,7 +149,11 @@ 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)
{
@@ -161,15 +168,22 @@ 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/src/actions.cpp b/src/actions.cpp
index d288a0e..663812c 100644
--- a/src/actions.cpp
+++ b/src/actions.cpp
@@ -88,7 +88,6 @@ void on_desktop_settings_activated (GSimpleAction*, GVariant*, gpointer gself)
static_cast<Actions*>(gself)->desktop_open_settings_app();
}
-#ifdef HAS_URLDISPATCHER
void on_phone_appointment_activated (GSimpleAction*, GVariant *vuid, gpointer gself)
{
auto self = static_cast<Actions*>(gself);
@@ -109,7 +108,6 @@ void on_phone_settings_activated (GSimpleAction*, GVariant*, gpointer gself)
{
static_cast<Actions*>(gself)->phone_open_settings_app();
}
-#endif
void on_set_location(GSimpleAction * /*action*/,
GVariant * param,
@@ -205,12 +203,11 @@ Actions::Actions(const std::shared_ptr<State>& state):
{ "desktop.open-calendar-app", on_desktop_calendar_activated, "x", nullptr },
{ "desktop.open-settings-app", on_desktop_settings_activated },
-#ifdef HAS_URLDISPATCHER
{ "phone.open-appointment", on_phone_appointment_activated, "s", nullptr },
{ "phone.open-alarm-app", on_phone_alarm_activated },
{ "phone.open-calendar-app", on_phone_calendar_activated, "x", nullptr },
{ "phone.open-settings-app", on_phone_settings_activated },
-#endif
+
{ "calendar-active", nullptr, nullptr, "false", on_calendar_active_changed },
{ "set-location", on_set_location, "s" }
};
diff --git a/src/menu.cpp b/src/menu.cpp
index c778963..1bf8111 100644
--- a/src/menu.cpp
+++ b/src/menu.cpp
@@ -240,12 +240,9 @@ private:
const char * action_name;
-#ifdef HAS_URLDISPATCHER
if (profile == Phone)
action_name = "indicator.phone.open-calendar-app";
- else
-#endif
- if (profile == Desktop)
+ else if (profile == Desktop)
action_name = "indicator.desktop.open-calendar-app";
else
action_name = nullptr;
@@ -291,12 +288,9 @@ private:
const char * action_name;
-#ifdef HAS_URLDISPATCHER
if (profile == Phone)
action_name = "indicator.phone.open-appointment";
- else
-#endif
- if ((profile == Desktop) && m_actions->desktop_has_calendar_app())
+ else if ((profile == Desktop) && m_actions->desktop_has_calendar_app())
action_name = "indicator.desktop.open-appointment";
else
action_name = nullptr;
@@ -363,7 +357,6 @@ private:
g_object_unref(menu_item);
}
}
-#ifdef HAS_URLDISPATCHER
else if (profile==Phone)
{
auto menu_item = g_menu_item_new (_("Clock"), "indicator.phone.open-alarm-app");
@@ -373,7 +366,6 @@ private:
add_appointments (menu, profile);
}
-#endif
return G_MENU_MODEL(menu);
}
@@ -413,10 +405,8 @@ private:
if (profile == Desktop)
action_name = "indicator.desktop.open-settings-app";
-#ifdef HAS_URLDISPATCHER
else if (profile == Phone)
action_name = "indicator.phone.open-settings-app";
-#endif
else
action_name = nullptr;
@@ -504,7 +494,6 @@ public:
};
-#ifdef HAS_URLDISPATCHER
class PhoneBaseMenu: public MenuImpl
{
protected:
@@ -563,7 +552,6 @@ public:
std::shared_ptr<Actions>& actions_):
PhoneBaseMenu(PhoneGreeter, "phone_greeter", state_, actions_) {}
};
-#endif
/****
*****
@@ -591,7 +579,6 @@ MenuFactory::buildMenu(Menu::Profile profile)
menu.reset(new DesktopGreeterMenu(m_state, m_actions));
break;
-#ifdef HAS_URLDISPATCHER
case Menu::Phone:
menu.reset(new PhoneMenu(m_state, m_actions));
break;
@@ -599,7 +586,6 @@ MenuFactory::buildMenu(Menu::Profile profile)
case Menu::PhoneGreeter:
menu.reset(new PhoneGreeterMenu(m_state, m_actions));
break;
-#endif
default:
g_warn_if_reached();