aboutsummaryrefslogtreecommitdiff
path: root/src/actions-live.cpp
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2014-03-14 17:37:21 +0000
committerCI bot <ps-jenkins@lists.canonical.com>2014-03-14 17:37:21 +0000
commit5148b720cf8aa9ab2c89442ff528c5b344da556e (patch)
tree94c68d5551f00eb3f9828931c8545c42050fd564 /src/actions-live.cpp
parent8c4067b5484a81e2bb9158266601e30262bfb119 (diff)
parent01dca64fc75b6bff4494f1886f2397f6fd0ad8d1 (diff)
downloadayatana-indicator-datetime-5148b720cf8aa9ab2c89442ff528c5b344da556e.tar.gz
ayatana-indicator-datetime-5148b720cf8aa9ab2c89442ff528c5b344da556e.tar.bz2
ayatana-indicator-datetime-5148b720cf8aa9ab2c89442ff528c5b344da556e.zip
Don't show the "Add Event..." button if the calendar app can't be found. Fixes: 1250632
Diffstat (limited to 'src/actions-live.cpp')
-rw-r--r--src/actions-live.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/actions-live.cpp b/src/actions-live.cpp
index c179274..97b12db 100644
--- a/src/actions-live.cpp
+++ b/src/actions-live.cpp
@@ -74,6 +74,30 @@ void LiveActions::open_desktop_settings()
g_free (path);
}
+bool LiveActions::can_open_planner() const
+{
+ static bool inited = false;
+ static bool have_calendar = false;
+
+ if (G_UNLIKELY(!inited))
+ {
+ inited = true;
+
+ auto all = g_app_info_get_all_for_type ("text/calendar");
+ for(auto l=all; !have_calendar && l!=nullptr; l=l->next)
+ {
+ auto app_info = static_cast<GAppInfo*>(l->data);
+
+ if (!g_strcmp0("evolution.desktop", g_app_info_get_id(app_info)))
+ have_calendar = true;
+ }
+
+ g_list_free_full(all, (GDestroyNotify)g_object_unref);
+ }
+
+ return have_calendar;
+}
+
void LiveActions::open_planner()
{
execute_command("evolution -c calendar");