mirror of
https://github.com/nmap/nmap.git
synced 2026-01-04 13:49:03 +00:00
Fix file permissions again for zenmap.conf. Handle it in one place only.
This commit is contained in:
@@ -156,7 +156,7 @@ from zenmapCore.RecentScans import recent_scans
|
||||
from zenmapCore.UmitLogging import log
|
||||
import zenmapCore.I18N
|
||||
import zenmapGUI.Print
|
||||
from zenmapCore.UmitConf import SearchConfig, is_maemo, WindowConfig
|
||||
from zenmapCore.UmitConf import SearchConfig, is_maemo, WindowConfig, config_parser
|
||||
from zenmapCore.NetworkInventory import FilteredNetworkInventory
|
||||
|
||||
UmitScanWindow = None
|
||||
@@ -906,23 +906,19 @@ This scan has not been run yet. Start the scan with the "Scan" button first.'))
|
||||
return True
|
||||
|
||||
window = WindowConfig()
|
||||
try:
|
||||
window.x, window.y = self.get_position()
|
||||
window.width, window.height = self.get_size()
|
||||
window.save_changes()
|
||||
except IOError as e:
|
||||
if e.errno == errno.EACCES:
|
||||
alert = HIGAlertDialog(
|
||||
message_format=_("Can't save Zenmap configuration"),
|
||||
# newline before path to help avoid weird line wrapping
|
||||
secondary_text=_(
|
||||
'Permission denied when writing to\n%s'
|
||||
'\nMake sure the file exists and is writable.'
|
||||
) % (Path.user_config_file))
|
||||
alert.run()
|
||||
alert.destroy()
|
||||
else:
|
||||
raise
|
||||
window.x, window.y = self.get_position()
|
||||
window.width, window.height = self.get_size()
|
||||
window.save_changes()
|
||||
if config_parser.failed:
|
||||
alert = HIGAlertDialog(
|
||||
message_format=_("Can't save Zenmap configuration"),
|
||||
# newline before path to help avoid weird line wrapping
|
||||
secondary_text=_(
|
||||
'An error occurred when saving to\n%s'
|
||||
'\nThe error was: %s.'
|
||||
) % (Path.user_config_file, config_parser.failed))
|
||||
alert.run()
|
||||
alert.destroy()
|
||||
|
||||
self.destroy()
|
||||
|
||||
|
||||
@@ -126,7 +126,6 @@ import gtk
|
||||
import gtk.gdk
|
||||
import pango
|
||||
import re
|
||||
import errno
|
||||
|
||||
import zenmapCore.I18N
|
||||
from zenmapCore.UmitLogging import log
|
||||
@@ -264,20 +263,7 @@ class NmapOutputViewer (gtk.VBox):
|
||||
self.nmap_highlight.__setattr__(widget.property_name, wid_props)
|
||||
|
||||
nmap_out_prop.destroy()
|
||||
try:
|
||||
self.nmap_highlight.save_changes()
|
||||
except IOError as e:
|
||||
if e.errno == errno.EACCES:
|
||||
alert = HIGAlertDialog(
|
||||
message_format=_("Can't save Zenmap configuration"),
|
||||
secondary_text=_(
|
||||
'Permission denied when writing to \n%s'
|
||||
'\nMake sure the file exists and is writable.'
|
||||
) % (Path.user_config_file))
|
||||
alert.run()
|
||||
alert.destroy()
|
||||
else:
|
||||
raise
|
||||
self.nmap_highlight.save_changes()
|
||||
self.apply_highlighting()
|
||||
|
||||
def apply_highlighting(self, start_iter=None, end_iter=None):
|
||||
|
||||
Reference in New Issue
Block a user