aboutsummaryrefslogtreecommitdiff
path: root/src/notifications.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/notifications.cpp')
-rw-r--r--src/notifications.cpp22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/notifications.cpp b/src/notifications.cpp
index dc42534..9817686 100644
--- a/src/notifications.cpp
+++ b/src/notifications.cpp
@@ -150,14 +150,17 @@ class Engine::Impl
public:
Impl(const std::string& app_name):
- m_messaging_app(messaging_menu_app_new(calendar_app_id().c_str()), g_object_unref),
m_app_name(app_name)
{
if (!notify_init(app_name.c_str()))
g_critical("Unable to initialize libnotify!");
// messaging menu
- messaging_menu_app_register(m_messaging_app.get());
+ auto app_id = calendar_app_id();
+ if (!app_id.empty()) {
+ m_messaging_app.reset(messaging_menu_app_new(app_id.c_str()), g_object_unref);
+ messaging_menu_app_register(m_messaging_app.get());
+ }
}
~Impl()
@@ -166,7 +169,8 @@ public:
remove_all ();
notify_uninit ();
- messaging_menu_app_unregister (m_messaging_app.get());
+ if (m_messaging_app)
+ messaging_menu_app_unregister (m_messaging_app.get());
}
const std::string& app_name() const
@@ -280,6 +284,9 @@ public:
std::string post(const Builder::Impl& data)
{
+ if (!m_messaging_app) {
+ return std::string();
+ }
uuid_t message_uuid;
uuid_generate(message_uuid);
@@ -439,9 +446,14 @@ private:
{
#ifdef HAS_LOMIRIAPPLAUNCH
auto app_id = lomiri::app_launch::AppID::discover("com.lomiri.calendar");
- return std::string(app_id) + ".desktop";
+
+ if (!app_id.empty())
+ return std::string(app_id) + ".desktop";
+ else
+ return std::string();
+
#else
- return "";
+ return std::string();
#endif
}