aboutsummaryrefslogtreecommitdiff
path: root/src/actions.cpp
diff options
context:
space:
mode:
authorRenato Araujo Oliveira Filho <renato.filho@canonical.com>2016-04-28 11:56:11 -0300
committerRobert Tari <robert@tari.in>2021-07-07 01:25:48 +0200
commit85cb430bd147719fed43f4ccf04b9d22cad33bfc (patch)
treed3b97d54cfaf1faa4275adfc93dcd749c4c6d47a /src/actions.cpp
parent846dfb9d7b16aec7923444083256a8565f308013 (diff)
downloadayatana-indicator-datetime-85cb430bd147719fed43f4ccf04b9d22cad33bfc.tar.gz
ayatana-indicator-datetime-85cb430bd147719fed43f4ccf04b9d22cad33bfc.tar.bz2
ayatana-indicator-datetime-85cb430bd147719fed43f4ccf04b9d22cad33bfc.zip
Detect desktop to launch applications.
Diffstat (limited to 'src/actions.cpp')
-rw-r--r--src/actions.cpp64
1 files changed, 20 insertions, 44 deletions
diff --git a/src/actions.cpp b/src/actions.cpp
index ea68d3e..315340a 100644
--- a/src/actions.cpp
+++ b/src/actions.cpp
@@ -62,7 +62,7 @@ bool lookup_appointment_by_uid(const std::shared_ptr<State>& state, const gchar*
return false;
}
-void on_desktop_appointment_activated (GSimpleAction*, GVariant *vdata, gpointer gself)
+void on_appointment_activated (GSimpleAction*, GVariant *vdata, gpointer gself)
{
auto self = static_cast<Actions*>(gself);
Appointment appt;
@@ -70,44 +70,20 @@ void on_desktop_appointment_activated (GSimpleAction*, GVariant *vdata, gpointer
gint64 time = 0;
g_variant_get(vdata, "(&sx)", &uid, &time);
if (lookup_appointment_by_uid(self->state(), uid, appt))
- self->desktop_open_appointment(appt, DateTime::Local(time));
+ self->open_appointment(appt, DateTime::Local(time));
}
-void on_desktop_alarm_activated (GSimpleAction*, GVariant*, gpointer gself)
+void on_alarm_activated (GSimpleAction*, GVariant*, gpointer gself)
{
- static_cast<Actions*>(gself)->desktop_open_alarm_app();
+ static_cast<Actions*>(gself)->open_alarm_app();
}
-void on_desktop_calendar_activated (GSimpleAction*, GVariant* vt, gpointer gself)
+void on_calendar_activated (GSimpleAction*, GVariant* vt, gpointer gself)
{
const auto dt = datetime_from_timet_variant(vt);
- static_cast<Actions*>(gself)->desktop_open_calendar_app(dt);
+ static_cast<Actions*>(gself)->open_calendar_app(dt);
}
-void on_desktop_settings_activated (GSimpleAction*, GVariant*, gpointer gself)
+void on_settings_activated (GSimpleAction*, GVariant*, gpointer gself)
{
- static_cast<Actions*>(gself)->desktop_open_settings_app();
-}
-
-void on_phone_appointment_activated (GSimpleAction*, GVariant *vdata, gpointer gself)
-{
- auto self = static_cast<Actions*>(gself);
- Appointment appt;
- const gchar* uid = nullptr;
- gint64 time = 0;
- g_variant_get(vdata, "(&sx)", &uid, &time);
- if (lookup_appointment_by_uid(self->state(), uid, appt))
- self->phone_open_appointment(appt, DateTime::Local(time));
-}
-void on_phone_alarm_activated (GSimpleAction*, GVariant*, gpointer gself)
-{
- static_cast<Actions*>(gself)->phone_open_alarm_app();
-}
-void on_phone_calendar_activated (GSimpleAction*, GVariant* vt, gpointer gself)
-{
- const auto dt = datetime_from_timet_variant(vt);
- static_cast<Actions*>(gself)->phone_open_calendar_app(dt);
-}
-void on_phone_settings_activated (GSimpleAction*, GVariant*, gpointer gself)
-{
- static_cast<Actions*>(gself)->phone_open_settings_app();
+ static_cast<Actions*>(gself)->open_settings_app();
}
void on_set_location(GSimpleAction * /*action*/,
@@ -135,9 +111,9 @@ void on_calendar_active_changed(GSimpleAction * /*action*/,
}
}
-void on_calendar_activated(GSimpleAction * /*action*/,
- GVariant * state,
- gpointer gself)
+void on_calendar_date_activated(GSimpleAction * /*action*/,
+ GVariant * state,
+ gpointer gself)
{
const time_t t = g_variant_get_int64(state);
@@ -199,15 +175,15 @@ Actions::Actions(const std::shared_ptr<State>& state):
{
GActionEntry entries[] = {
- { "desktop.open-appointment", on_desktop_appointment_activated, "(sx)", nullptr },
- { "desktop.open-alarm-app", on_desktop_alarm_activated },
- { "desktop.open-calendar-app", on_desktop_calendar_activated, "x", nullptr },
- { "desktop.open-settings-app", on_desktop_settings_activated },
+ { "desktop.open-appointment", on_appointment_activated, "(sx)", nullptr },
+ { "desktop.open-alarm-app", on_alarm_activated },
+ { "desktop.open-calendar-app", on_calendar_activated, "x", nullptr },
+ { "desktop.open-settings-app", on_settings_activated },
- { "phone.open-appointment", on_phone_appointment_activated, "(sx)", 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 },
+ { "phone.open-appointment", on_appointment_activated, "(sx)", nullptr },
+ { "phone.open-alarm-app", on_alarm_activated },
+ { "phone.open-calendar-app", on_calendar_activated, "x", nullptr },
+ { "phone.open-settings-app", on_settings_activated },
{ "calendar-active", nullptr, nullptr, "false", on_calendar_active_changed },
{ "set-location", on_set_location, "s" }
@@ -241,7 +217,7 @@ Actions::Actions(const std::shared_ptr<State>& state):
v = create_calendar_state(state);
a = g_simple_action_new_stateful("calendar", G_VARIANT_TYPE_INT64, v);
g_action_map_add_action(gam, G_ACTION(a));
- g_signal_connect(a, "activate", G_CALLBACK(on_calendar_activated), this);
+ g_signal_connect(a, "activate", G_CALLBACK(on_calendar_date_activated), this);
g_object_unref(a);
///