diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2014-03-06 17:54:57 -0600 |
---|---|---|
committer | Charles Kerr <charles.kerr@canonical.com> | 2014-03-06 17:54:57 -0600 |
commit | df650bec0f1c634ee773c150b451c3bdd8ed4e65 (patch) | |
tree | 0373cd9ece920ace2ac790610299b1454c464e67 /src/actions-live.cpp | |
parent | 58dd68d0f2d513f70c0348bc26bb6b4db09377df (diff) | |
download | ayatana-indicator-datetime-df650bec0f1c634ee773c150b451c3bdd8ed4e65.tar.gz ayatana-indicator-datetime-df650bec0f1c634ee773c150b451c3bdd8ed4e65.tar.bz2 ayatana-indicator-datetime-df650bec0f1c634ee773c150b451c3bdd8ed4e65.zip |
In the Desktop profile, don't show the 'Add Event…' button if evolution can't be launched.
Diffstat (limited to 'src/actions-live.cpp')
-rw-r--r-- | src/actions-live.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/actions-live.cpp b/src/actions-live.cpp index ccc7fcf..8fce6ad 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 +{ + bool inited = false; + bool have_evolution = false; + + if (G_UNLIKELY(!inited)) + { + inited = true; + + auto all = g_app_info_get_all_for_type ("text/calendar"); + for(auto l=all; !have_evolution && l!=nullptr; l=l->next) + { + auto app_info = static_cast<GAppInfo*>(l->data); + + if (!g_strcmp0("evolution", g_app_info_get_executable(app_info))) + have_evolution = true; + } + + g_list_free_full(all, (GDestroyNotify)g_object_unref); + } + + return have_evolution; +} + void LiveActions::open_planner() { execute_command("evolution -c calendar"); |