From df650bec0f1c634ee773c150b451c3bdd8ed4e65 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Thu, 6 Mar 2014 17:54:57 -0600 Subject: =?UTF-8?q?In=20the=20Desktop=20profile,=20don't=20show=20the=20'A?= =?UTF-8?q?dd=20Event=E2=80=A6'=20button=20if=20evolution=20can't=20be=20l?= =?UTF-8?q?aunched.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/actions-live.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/actions-live.cpp') 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(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"); -- cgit v1.2.3 From 01dca64fc75b6bff4494f1886f2397f6fd0ad8d1 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Thu, 13 Mar 2014 17:00:19 -0500 Subject: test for evolution with g_app_info_get_id() rather than g_app_info_get_name() --- src/actions-live.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/actions-live.cpp') diff --git a/src/actions-live.cpp b/src/actions-live.cpp index f8ef4e8..51d96c6 100644 --- a/src/actions-live.cpp +++ b/src/actions-live.cpp @@ -76,26 +76,26 @@ void LiveActions::open_desktop_settings() bool LiveActions::can_open_planner() const { - bool inited = false; - bool have_evolution = false; + 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_evolution && l!=nullptr; l=l->next) + for(auto l=all; !have_calendar && l!=nullptr; l=l->next) { auto app_info = static_cast(l->data); - if (!g_strcmp0("evolution", g_app_info_get_executable(app_info))) - have_evolution = true; + 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_evolution; + return have_calendar; } void LiveActions::open_planner() -- cgit v1.2.3