Index: src/OptionsWindows.h =================================================================== --- src/OptionsWindows.h (revisión: 254) +++ src/OptionsWindows.h (copia de trabajo) @@ -529,6 +529,7 @@ }; + class NotificationsWindow: public OptionsWindowsBase, public Gtk::ScrolledWindow { private: @@ -549,6 +550,7 @@ NotificationsWindow(OptionsTab *); ~NotificationsWindow(); +#if HAVE_LIBNOTIFY // Get options bool getActivateNotificationsCheckButton() { return activateNotificationsCheckButton.get_active(); }; bool getNotifyFinishedTorrentsCheckButton() { return notifyFinishedTorrentsCheckButton.get_active(); }; @@ -570,6 +572,7 @@ void setNotifyAddedTorrentsCheckButton(bool value) { notifyAddedTorrentsCheckButton.set_active(value); }; void setNotifyRemovedTorrentsCheckButton(bool value) { notifyRemovedTorrentsCheckButton.set_active(value); }; void setNotifyShowFromSystrayCheckButton(bool value) { notifyShowFromSystrayCheckButton.set_active(value); }; +#endif }; class QueueWindow: public OptionsWindowsBase, public Gtk::ScrolledWindow Index: src/NoteBookManager.cc =================================================================== --- src/NoteBookManager.cc (revisión: 254) +++ src/NoteBookManager.cc (copia de trabajo) @@ -28,7 +28,11 @@ using namespace Lince; +#if HAVE_LIBNOTIFY NoteBookManager::NoteBookManager(MainWindow *m, MenuBar *mb, Notifications *nf): +#else +NoteBookManager::NoteBookManager(MainWindow *m, MenuBar *mb): +#endif Gtk::Notebook(), TT(m, mb), OT(this), @@ -48,7 +52,10 @@ property_can_focus() = true; menuBar = mb; + +#if HAVE_LIBNOTIFY notifications = nf; +#endif last_page = -1; page_positions.reserve(LAST_TAB); Index: src/NoteBookManager.h =================================================================== --- src/NoteBookManager.h (revisión: 254) +++ src/NoteBookManager.h (copia de trabajo) @@ -43,7 +43,10 @@ class MainWindow; class MenuBar; + +#if HAVE_LIBNOTIFY class Notifications; +#endif typedef std::list TorrentsInfoTab; @@ -57,7 +60,9 @@ TorrentsInfoTab TIT; class MenuBar *menuBar; +#if HAVE_LIBNOTIFY class Notifications *notifications; +#endif int last_page; std::vector page_positions; @@ -67,7 +72,12 @@ bool isInfoTabListed(const libtorrent::sha1_hash &, TorrentsInfoTab::iterator &); public: +#if HAVE_LIBNOTIFY NoteBookManager(MainWindow *, MenuBar *, Notifications *); +#else + NoteBookManager(MainWindow *, MenuBar *); +#endif + ~NoteBookManager(); enum TabsPositions { FIRST_TAB, TORRENTS_TAB=FIRST_TAB, OPTIONS_TAB, STATISTICS_TAB, LOG_TAB, SEARCH_TAB, LAST_TAB }; @@ -153,10 +163,12 @@ bool isLogTabShown(void) { return LT.isTabShown(); }; // Notifications +#if HAVE_LIBNOTIFY void setShowNotifications(bool value) { notifications->showNotifications(value); }; void setNotifyMessage(int type, bool value) { notifications->setNotifyMessage(type, value); }; void setNotifyFromSystray(bool value) { notifications->showNotificationsFromSystray(value); }; void flushNotification(void) { notifications->flushNotification(); }; +#endif // Search Tab void addSearchTab(void); Index: src/MainWindow.h =================================================================== --- src/MainWindow.h (revisión: 254) +++ src/MainWindow.h (copia de trabajo) @@ -35,7 +35,9 @@ #include "MenuBar.h" #include "NoteBookManager.h" +#if HAVE_LIBNOTIFY #include "Notifications.h" +#endif #include "StatusBar.h" #include "GuiSetupManager.h" #include "MakeTorrent.h" @@ -76,8 +78,10 @@ // SystemTray SystemTray systray; +#if HAVE_LIBNOTIFY // Notifications Notifications notifications; +#endif // isShown bool isShown; Index: src/main.cc =================================================================== --- src/main.cc (revisión: 254) +++ src/main.cc (copia de trabajo) @@ -88,14 +88,6 @@ { } -void add_uri(Glib::ustring &uri) -{ - if (Utils::isAMagnetLink(uri)) - sig_to_add_a_magnet_link(uri); - else - sig_to_add_a_torrent_file.emit(uri); -} - #if HAVE_DBUS DBusConnection* conn; @@ -182,6 +174,14 @@ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } +void add_uri(Glib::ustring &uri) +{ + if (Utils::isAMagnetLink(uri)) + sig_to_add_a_magnet_link(uri); + else + sig_to_add_a_torrent_file.emit(uri); +} + #else void set_lockup_file() { @@ -220,7 +220,9 @@ // Add the files to the session. else { +#if HAVE_DBUS add_uri(uri); +#endif } } }; Index: src/MainWindow.cc =================================================================== --- src/MainWindow.cc (revisión: 254) +++ src/MainWindow.cc (copia de trabajo) @@ -65,8 +65,12 @@ vbox(false, 0), menuBar(this), systray(this), +#if HAVE_LIBNOTIFY notifications(&systray), noteBookManager(this, &menuBar, ¬ifications) +#else + noteBookManager(this, &menuBar) +#endif { set_title("Lince"); set_default_size(740, 540); @@ -214,8 +218,10 @@ // Show log messages noteBookManager.flushLogMessages(); +#if HAVE_LIBNOTIFY // Show notification noteBookManager.flushNotification(); +#endif return true; } Index: src/OptionsTab.cc =================================================================== --- src/OptionsTab.cc (revisión: 254) +++ src/OptionsTab.cc (copia de trabajo) @@ -98,9 +98,11 @@ row[m_Columns.m_col_id] = 9; row[m_Columns.m_col_name] = _("Log"); +#if HAVE_LIBNOTIFY row = *(refTreeModel->append()); row[m_Columns.m_col_id] = 10; row[m_Columns.m_col_name] = _("Notifications"); +#endif row = *(refTreeModel->append()); row[m_Columns.m_col_id] = 11; @@ -358,6 +360,7 @@ lw.setBufferSizeButton(gsm->get(GuiSetupManager::LOG_SIZE)); lw.setLogLevel(gsm->get(GuiSetupManager::LOG_LEVEL)); +#if HAVE_LIBNOTIFY // NotifyWindow nw.setActivateNotificationsCheckButton(gsm->getBool(GuiSetupManager::USE_NOTIFICATIONS)); nw.setNotifyFinishedTorrentsCheckButton(gsm->getBool(GuiSetupManager::NOTIFY_FINISHED_TORRENTS)); @@ -368,6 +371,7 @@ nw.setNotifyQueuedTorrentsCheckButton(gsm->getBool(GuiSetupManager::NOTIFY_QUEUED_TORRENTS)); nw.setNotifyUnqueuedTorrentsCheckButton(gsm->getBool(GuiSetupManager::NOTIFY_UNQUEUED_TORRENTS)); nw.setNotifyShowFromSystrayCheckButton(gsm->getBool(GuiSetupManager::NOTIFY_SHOW_FROM_SYSTRAY)); +#endif // QueueWindow qw.setActiveDownloadsQueueButton(csm->get(SetupManager::ACTIVE_DOWNLOADS_VALUE)); @@ -909,6 +913,7 @@ nb->setLogLevel(lw.getLogLevel()); } +#if HAVE_LIBNOTIFY // NOTIFICATIONS WINDOW void OptionsTab::setActivateNotificationsConfigValue() { @@ -963,6 +968,7 @@ gsm->set(GuiSetupManager::NOTIFY_SHOW_FROM_SYSTRAY, nw.getNotifyShowFromSystrayCheckButton()); nb->setNotifyFromSystray(nw.getNotifyShowFromSystrayCheckButton()); } +#endif // QUEUE WINDOW void OptionsTab::setActiveDownloadsConfigValue() Index: src/OptionsTab.h =================================================================== --- src/OptionsTab.h (revisión: 254) +++ src/OptionsTab.h (copia de trabajo) @@ -179,6 +179,7 @@ void setAutoScrollCheckButtonConfigValue(); void setLogLevelConfigValue(); +#if HAVE_LIBNOTIFY // NotificationsWindow void setActivateNotificationsConfigValue(); void setNotifyFinishedTorrentsConfigValue(); @@ -189,6 +190,7 @@ void setNotifyQueuedTorrentsConfigValue(); void setNotifyUnqueuedTorrentsConfigValue(); void setNotifyShowFromSystrayConfigValue(); +#endif // QueueWindow void setActiveDownloadsConfigValue(); Index: src/OptionsWindows.cc =================================================================== --- src/OptionsWindows.cc (revisión: 254) +++ src/OptionsWindows.cc (copia de trabajo) @@ -1242,6 +1242,7 @@ vbox.pack_start(*notificationsRow, Gtk::PACK_SHRINK, 5); // Signals +#if HAVE_LIBNOTIFY activateNotificationsCheckButton.signal_toggled().connect( sigc::mem_fun(oT, &OptionsTab::setActivateNotificationsConfigValue) ); notifyAddedTorrentsCheckButton.signal_toggled().connect( sigc::mem_fun(oT, &OptionsTab::setNotifyAddedTorrentsConfigValue) ); notifyRemovedTorrentsCheckButton.signal_toggled().connect( sigc::mem_fun(oT, &OptionsTab::setNotifyRemovedTorrentsConfigValue) ); @@ -1251,6 +1252,7 @@ notifyUnqueuedTorrentsCheckButton.signal_toggled().connect( sigc::mem_fun(oT, &OptionsTab::setNotifyUnqueuedTorrentsConfigValue) ); notifyFinishedTorrentsCheckButton.signal_toggled().connect( sigc::mem_fun(oT, &OptionsTab::setNotifyFinishedTorrentsConfigValue) ); notifyShowFromSystrayCheckButton.signal_toggled().connect( sigc::mem_fun(oT, &OptionsTab::setNotifyShowFromSystrayConfigValue) ); +#endif add(vbox); } @@ -1267,6 +1269,7 @@ { } + QueueWindow::QueueWindow(OptionsTab * oT): OptionsWindowsBase(_("Queue")), activeDownloadsQueueLabel(_("Active torrents [0: without limit]")), Index: src/Makefile.am =================================================================== --- src/Makefile.am (revisión: 254) +++ src/Makefile.am (copia de trabajo) @@ -13,6 +13,7 @@ bin_PROGRAMS = lince +if HAVE_LIBNOTIFY lince_SOURCES = \ BaseTab.cc \ BaseTab.h \ @@ -79,6 +80,72 @@ LoadOneTorrentDialog.cc \ SearchTabResults.h \ SearchTabResults.cc +else +lince_SOURCES = \ + BaseTab.cc \ + BaseTab.h \ + ClientsInfoNoteBookTab.cc \ + ClientsInfoNoteBookTab.h \ + FilesInfoNoteBookTab.cc \ + FilesInfoNoteBookTab.h \ + GeneralInfoNoteBookTab.cc \ + GeneralInfoNoteBookTab.h \ + GuiSetupManager.cc \ + GuiSetupManager.h \ + InfoNoteBook.cc \ + InfoNoteBook.h \ + LoadTorrentDialog.cc \ + LoadTorrentDialog.h \ + LogTab.cc \ + LogTab.h \ + main.cc \ + MainWindow.cc \ + MainWindow.h \ + MakeTorrent.cc \ + MakeTorrent.h \ + MenuBar.cc \ + MenuBar.h \ + NoteBookManager.cc \ + NoteBookManager.h \ + OptionsInfoNoteBookTab.cc \ + OptionsInfoNoteBookTab.h \ + OptionsTab.cc \ + OptionsTab.h \ + OptionsWindows.h \ + OptionsWindows.cc \ + PiecesInfoNoteBookTab.cc \ + PiecesInfoNoteBookTab.h \ + StatisticsTab.cc \ + StatisticsTab.h \ + StatusBar.cc \ + StatusBar.h \ + TorrentInfoTab.cc \ + TorrentInfoTab.h \ + TorrentsTab.cc \ + TorrentsTab.h \ + TorrentsWindow.cc \ + TorrentsWindow.h \ + Utils.cc \ + Utils.h \ + XMLReader.cc \ + XMLReader.h \ + XMLWriter.cc \ + XMLWriter.h \ + GraphStatsTab.h \ + GraphStatsTab.cc \ + DataStatsTab.cc \ + DataStatsTab.h \ + SystemTray.h \ + SystemTray.cc \ + EditTrackersDialog.h \ + EditTrackersDialog.cc \ + SearchTab.h \ + SearchTab.cc \ + LoadOneTorrentDialog.h \ + LoadOneTorrentDialog.cc \ + SearchTabResults.h \ + SearchTabResults.cc +endif lince_LDFLAGS = Index: configure.ac =================================================================== --- configure.ac (revisión: 254) +++ configure.ac (copia de trabajo) @@ -49,9 +49,9 @@ AC_SUBST(CAIRO_LIBS) dnl Check for Libnotify -PKG_CHECK_MODULES(LIBNOTIFY, [libnotify]) -AC_SUBST(LIBNOTIFY_CFLAGS) -AC_SUBST(LIBNOTIFY_LIBS) +dnl PKG_CHECK_MODULES(LIBNOTIFY, [libnotify]) +dnl AC_SUBST(LIBNOTIFY_CFLAGS) +dnl AC_SUBST(LIBNOTIFY_LIBS) dnl Check for Libtorrent library PKG_CHECK_MODULES(LIBTORRENT, [libtorrent-rasterbar >= 0.14.1]) @@ -81,6 +81,26 @@ AC_SUBST(DBUS_CFLAGS) AC_SUBST(DBUS_LIBS) +AC_ARG_WITH([libnotify], + [AS_HELP_STRING([--with-libnotify], + [libnotify support @<:@default=check@:>@])], + [], + [with_libnotify=check]) +AS_IF([test "x$with_libnotify" != xno], + [PKG_CHECK_MODULES(LIBNOTIFY, [libnotify], + AC_DEFINE([HAVE_LIBNOTIFY], [1], [Have LIBNOTIFY]), + AM_CONDITIONAL([HAVE_LIBNOTIFY], true) + [if test "x$with_libnotify" != xcheck; then + AC_MSG_FAILURE([--with-libnotify was given, but test for LIBNOTIFY failed.]) + else + AC_DEFINE([HAVE_LIBNOTIFY], [0], [Have LIBNOTIFY]) + AM_CONDITIONAL([HAVE_LIBNOTIFY], false) + fi])], + AC_DEFINE([HAVE_LIBNOTIFY], [0], [Have LIBNOTIFY])) + AM_CONDITIONAL([HAVE_LIBNOTIFY], false) +AC_SUBST(LIBNOTIFY_CFLAGS) +AC_SUBST(LIBNOTIFY_LIBS) + test x$prefix = "xNONE" && prefix="$ac_default_prefix" AC_DEFINE_UNQUOTED([FLAG_DIR], ["${prefix}/share/lince/flags"], [Flag directory]) AC_DEFINE_UNQUOTED([ICON_DIR], ["${prefix}/share/lince/icons"], [Icons directory])