mirror of
https://github.com/gryf/wicd.git
synced 2025-12-19 20:38:00 +01:00
added support for disabling notifications in setup.py
This commit is contained in:
@@ -71,6 +71,7 @@ no_install_kde = %NO_INSTALL_KDE%
|
||||
no_install_acpi = %NO_INSTALL_ACPI%
|
||||
no_install_docs = %NO_INSTALL_DOCS%
|
||||
no_install_ncurses = %NO_INSTALL_NCURSES%
|
||||
no_use_notifications = %NO_USE_NOTIFICATIONS%
|
||||
|
||||
def chdir(file):
|
||||
"""Change directory to the location of the specified file.
|
||||
|
||||
4
setup.py
4
setup.py
@@ -92,7 +92,8 @@ class configure(Command):
|
||||
('no-install-acpi', None, 'do not install the suspend.d and resume.d acpi scripts'),
|
||||
('no-install-pmutils', None, 'do not install the pm-utils hooks'),
|
||||
('no-install-docs', None, 'do not install the auxiliary documentation'),
|
||||
('no-install-ncurses', None, 'do not install the ncurses client')
|
||||
('no-install-ncurses', None, 'do not install the ncurses client'),
|
||||
('no-use-notifications', None, 'do not ever allow the use of libnotify notifications')
|
||||
]
|
||||
|
||||
def initialize_options(self):
|
||||
@@ -127,6 +128,7 @@ class configure(Command):
|
||||
self.no_install_pmutils = False
|
||||
self.no_install_docs = False
|
||||
self.no_install_ncurses = False
|
||||
self.no_use_notifications = False
|
||||
|
||||
# Determine the default init file location on several different distros
|
||||
|
||||
|
||||
@@ -157,6 +157,12 @@ class PreferencesDialog(object):
|
||||
self.notificationscheckbox.set_active(False)
|
||||
self.notificationscheckbox.set_sensitive(False)
|
||||
|
||||
# if notifications were disabled with the configure flag
|
||||
if wpath.no_use_notifications:
|
||||
self.notificationscheckbox.set_active(False)
|
||||
self.notificationscheckbox.hide()
|
||||
self.wTree.get_widget('label2').hide()
|
||||
|
||||
self.wTree.get_widget("notebook2").set_current_page(0)
|
||||
|
||||
def run(self):
|
||||
|
||||
@@ -75,6 +75,9 @@ if not hasattr(gtk, "StatusIcon"):
|
||||
|
||||
print "Has notifications support", HAS_NOTIFY
|
||||
|
||||
if wpath.no_use_notifications:
|
||||
print 'Notifications disabled during setup.py configure'
|
||||
|
||||
misc.RenameProcess("wicd-client")
|
||||
|
||||
if __name__ == '__main__':
|
||||
@@ -266,8 +269,11 @@ class TrayIcon(object):
|
||||
if not state or not info:
|
||||
[state, info] = daemon.GetConnectionStatus()
|
||||
|
||||
self.should_notify = (self.last_state != state) and \
|
||||
HAS_NOTIFY and self.use_notify
|
||||
# should this state change display a notification?
|
||||
self.should_notify = not wpath.no_use_notifications and \
|
||||
(self.last_state != state) and \
|
||||
HAS_NOTIFY and \
|
||||
self.use_notify
|
||||
|
||||
self.last_state = state
|
||||
|
||||
|
||||
Reference in New Issue
Block a user