=== modified file 'SConstruct' --- SConstruct 2009-06-16 23:54:40 +0000 +++ SConstruct 2009-10-04 17:47:00 +0000 @@ -128,6 +128,11 @@ print '\tlibglade-2.0 >= 2.4 not found.' print '\tNote: You might have the lib but not the headers' Exit(1) + + if not conf.CheckPKG('libnotify >= 0.2'): + print '\tlibnotify >= 0.2 not found.' + print '\tNote: You might have the lib but not the headers' + Exit(1) if not conf.CheckCXXHeader('boost/version.hpp', '<>'): print '\tboost not found.' @@ -217,6 +222,7 @@ env.ParseConfig('pkg-config --libs libglade-2.0') env.ParseConfig('pkg-config --libs gthread-2.0') + env.ParseConfig('pkg-config --libs libnotify') env.Append(LIBPATH = BUILD_PATH + 'dcpp') env.Prepend(LIBS = 'dcpp') === modified file 'linux/mainwindow.cc' --- linux/mainwindow.cc 2009-09-12 00:20:16 +0000 +++ linux/mainwindow.cc 2009-10-09 03:43:29 +0000 @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -537,8 +538,13 @@ } if (!message.empty()) + { dynamic_cast(entry)->addMessage_gui(message); + if (WGETI("notify-pm") && !isActive_gui()) + showNotification(_("Private Message"), WulforUtil::getNicks(cid) + " says " + message); + } + if (raise) raisePage_gui(entry->getContainer()); } @@ -1198,6 +1204,26 @@ WulforManager::get()->dispatchGuiFunc(func); } +void MainWindow::showNotification(string title, string body) +{ + GtkIconTheme *iconTheme; + GdkPixbuf *icon; + + iconTheme = gtk_icon_theme_get_default (); + icon = gtk_icon_theme_load_icon (iconTheme, "linuxdcpp", 48, GTK_ICON_LOOKUP_FORCE_SIZE, NULL); + + if (!notify_is_initted()) + notify_init(_("LinuxDC++")); + + NotifyNotification *notification; + notification = notify_notification_new_with_status_icon (title.c_str(), body.c_str(), NULL, statusIcon); + notify_notification_set_icon_from_pixbuf (notification, icon); + notify_notification_show (notification, NULL); + + g_object_unref(notification); + g_object_unref (icon); +} + string MainWindow::getFilename_client(Transfer *t) { string filename; @@ -1230,6 +1256,13 @@ F4 *func = new F4(this, &MainWindow::showShareBrowser_gui, user, listName, dir, TRUE); WulforManager::get()->dispatchGuiFunc(func); } + + else if (WGETI("notify-download")) + { + typedef Func2 F2; + F2 *f2 = new F2(this, &MainWindow::showNotification, _("Download Finished"), item->getTargetFileName()); + WulforManager::get()->dispatchGuiFunc(f2); + } } void MainWindow::on(TimerManagerListener::Second, uint32_t ticks) throw() === modified file 'linux/mainwindow.hh' --- linux/mainwindow.hh 2009-09-12 00:20:16 +0000 +++ linux/mainwindow.hh 2009-10-08 07:54:23 +0000 @@ -74,6 +74,7 @@ void showShareBrowser_gui(dcpp::UserPtr user, std::string file, std::string dir, bool useSetting); Search *addSearch_gui(); void setMainStatus_gui(std::string text, time_t t = time(NULL)); + void showNotification(std::string title, std::string body); // Client functions void openOwnList_client(bool useSetting); === modified file 'linux/settingsdialog.cc' --- linux/settingsdialog.cc 2009-08-15 16:59:22 +0000 +++ linux/settingsdialog.cc 2009-10-06 16:40:46 +0000 @@ -547,6 +547,8 @@ addOption_gui(appearanceStore, _("Only show joins / parts for favorite users"), SettingsManager::FAV_SHOW_JOINS); addOption_gui(appearanceStore, _("Use OEM monospaced font for chat windows"), SettingsManager::USE_OEM_MONOFONT); addOption_gui(appearanceStore, _("Use system icons"), "use-system-icons"); + addOption_gui(appearanceStore, _("Enable notification when a download finishes"), "notify-download"); + addOption_gui(appearanceStore, _("Enable notification when a private message is received"),"notify-pm"); /// @todo: Uncomment when implemented //addOption_gui(appearanceStore, _("Minimize to tray"), SettingsManager::MINIMIZE_TRAY); //addOption_gui(appearanceStore, _("Use system icons"), SettingsManager::USE_SYSTEM_ICONS); === modified file 'linux/settingsmanager.cc' --- linux/settingsmanager.cc 2009-08-23 22:13:35 +0000 +++ linux/settingsmanager.cc 2009-10-05 17:03:36 +0000 @@ -44,6 +44,8 @@ defaultInt["use-system-icons"] = 0; defaultInt["tab-position"] = 0; defaultInt["toolbar-style"] = 5; + defaultInt["notify-download"] = 1; + defaultInt["notify-pm"] = 1; defaultString["downloadqueue-order"] = ""; defaultString["downloadqueue-width"] = ""; defaultString["downloadqueue-visibility"] = "";