Created
August 4, 2012 04:00
-
-
Save Katharine/3254294 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -r 39932e2ec204 indra/newview/exonotificationmanager.cpp | |
--- a/indra/newview/exonotificationmanager.cpp Fri Aug 03 07:52:38 2012 -0400 | |
+++ b/indra/newview/exonotificationmanager.cpp Sat Aug 04 00:00:13 2012 -0400 | |
@@ -39,6 +39,8 @@ | |
// Platform-specific includes | |
#ifdef LL_DARWIN | |
#include "exonotifiermacosx.h" | |
+#elif LL_LINUX | |
+#include "exonotifierlinux.h" | |
#endif | |
exoNotificationManager::exoNotificationManager() : LLEventTimer(EXO_NOTIFICATION_THROTTLE_CLEANUP_PERIOD) | |
@@ -46,6 +48,8 @@ | |
// Create a notifier appropriate to the platform. | |
#ifdef LL_DARWIN | |
mNotifier = new exoNotifierMacOSX(); | |
+#elif LL_LINUX | |
+ mNotifier = new exoNotifierLinux(); | |
#else | |
mNotifier = new exoNotifier(); | |
LL_INFOS("exoNotifications") << "Created generic exoNotifier." << LL_ENDL; | |
diff -r 39932e2ec204 indra/newview/exonotifierlinux.cpp | |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
+++ b/indra/newview/exonotifierlinux.cpp Sat Aug 04 00:00:13 2012 -0400 | |
@@ -0,0 +1,46 @@ | |
+/** | |
+ * @file exonotifierlinux.cpp | |
+ * @brief Displays notifications via libnotify | |
+ * | |
+ * $LicenseInfo:firstyear=2012&license=viewerlgpl$ | |
+ * Copyright (C) 2012 Katharine Berry | |
+ * | |
+ * This library is free software; you can redistribute it and/or | |
+ * modify it under the terms of the GNU Lesser General Public | |
+ * License as published by the Free Software Foundation; | |
+ * version 2.1 of the License only. | |
+ * | |
+ * This library is distributed in the hope that it will be useful, | |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
+ * Lesser General Public License for more details. | |
+ * $/LicenseInfo$ | |
+ */ | |
+ | |
+#include "llviewerprecompiledheaders.h" | |
+ | |
+#include "exonotifierlinux.h" | |
+#include "libnotify/notify.h" | |
+ | |
+exoNotifierLinux::exoNotifierLinux() | |
+: mIsUsable(false) | |
+{ } | |
+ | |
+exoNotifierLinux::~exoNotifierLinux() | |
+{ | |
+ notify_uninit(); | |
+} | |
+ | |
+void exoNotifierLinux::registerApplication(const std::string& application, const std::set<std::string>&) | |
+{ | |
+ mIsUsable = notify_init(application.c_str()); | |
+} | |
+ | |
+void exoNotifierLinux::showNotification(const std::string& notification_title, const std::string& notification_message, const std::string& notification_type) | |
+{ | |
+ NotifyNotification* notification = notify_notification_new(notification_title.c_str(), notification_message.c_str(), NULL, NULL); | |
+ notify_notification_set_timeout(notification, NOTIFY_EXPIRES_DEFAULT); | |
+ notify_notification_set_urgency(notification, NOTIFY_URGENCY_LOW); | |
+ notify_notification_show(notification, NULL); | |
+ g_object_unref(G_OBJECT(notification)); | |
+} | |
diff -r 39932e2ec204 indra/newview/exonotifierlinux.h | |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
+++ b/indra/newview/exonotifierlinux.h Sat Aug 04 00:00:13 2012 -0400 | |
@@ -0,0 +1,41 @@ | |
+/** | |
+ * @file exonotifierlinux.h | |
+ * @brief Displays notifications via libnotify | |
+ * | |
+ * $LicenseInfo:firstyear=2012&license=viewerlgpl$ | |
+ * Copyright (C) 2012 Katharine Berry | |
+ * | |
+ * This library is free software; you can redistribute it and/or | |
+ * modify it under the terms of the GNU Lesser General Public | |
+ * License as published by the Free Software Foundation; | |
+ * version 2.1 of the License only. | |
+ * | |
+ * This library is distributed in the hope that it will be useful, | |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
+ * Lesser General Public License for more details. | |
+ * $/LicenseInfo$ | |
+ */ | |
+ | |
+#ifndef EXONOTIFIERLINUX_H | |
+#define EXONOTIFIERLINUX_H | |
+ | |
+#include <string> | |
+#include <set> | |
+#include "exonotifier.h" | |
+ | |
+class exoNotifierLinux : public exoNotifier | |
+{ | |
+public: | |
+ exoNotifierLinux(); | |
+ ~exoNotifierLinux(); | |
+ /* virtual */ void showNotification(const std::string& notification_title, const std::string& notification_message, const std::string& notification_type); | |
+ /* virtual */ bool isUsable() { return mIsUsable; } | |
+ /* virtual */ void registerApplication(const std::string& application, const std::set<std::string>& notificationTypes); | |
+ /* virtual */ bool needsThrottle() { return false; } | |
+private: | |
+ bool mIsUsable; | |
+}; | |
+ | |
+ | |
+#endif // EXONOTIFIERLINUX_H |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment