aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugeni Dodonov <eugeni@mandriva.com>2011-01-16 15:07:55 -0200
committerEugeni Dodonov <eugeni@mandriva.com>2011-01-16 15:07:55 -0200
commitc310f8a59a199b3b1487f5d3c208c265cd269e0b (patch)
treef4d0aa8877478ace0ff1047d90feffb68b2f419a
parent94d93f98fa69fcca2b9743bdf43429f22b528a70 (diff)
downloadnet_monitor-c310f8a59a199b3b1487f5d3c208c265cd269e0b.tar
net_monitor-c310f8a59a199b3b1487f5d3c208c265cd269e0b.tar.gz
net_monitor-c310f8a59a199b3b1487f5d3c208c265cd269e0b.tar.bz2
net_monitor-c310f8a59a199b3b1487f5d3c208c265cd269e0b.tar.xz
net_monitor-c310f8a59a199b3b1487f5d3c208c265cd269e0b.zip
move check_network_accounting to monitor.py
-rw-r--r--src/monitor.py8
-rwxr-xr-xsrc/net_monitor14
2 files changed, 11 insertions, 11 deletions
diff --git a/src/monitor.py b/src/monitor.py
index 8cf3138..53bfdd0 100644
--- a/src/monitor.py
+++ b/src/monitor.py
@@ -213,6 +213,14 @@ class Monitor:
traceback.print_exc()
return net
+ def check_network_accounting(self, iface):
+ """Checks if network accounting was enabled on interface"""
+ try:
+ os.stat("/var/lib/vnstat/%s" % iface)
+ return True
+ except:
+ return False
+
def get_traffic(self, iface, net=None):
"""Get traffic information"""
device_exists=False
diff --git a/src/net_monitor b/src/net_monitor
index c9a025c..6934741 100755
--- a/src/net_monitor
+++ b/src/net_monitor
@@ -325,7 +325,7 @@ class MonitorGui:
cur_page = self.notebook.append_page(iface_stat, iface_label)
if default_iface and iface == default_iface:
select_page = cur_page
- if self.check_network_accounting(iface):
+ if self.monitor.check_network_accounting(iface):
self.enabled_ifaces.append(iface)
# finally, we have tabs for network connections
@@ -496,14 +496,6 @@ class MonitorGui:
self.ifaces[iface][widget].set_text(str(value))
gobject.timeout_add_seconds(interval, self.update)
- def check_network_accounting(self, iface):
- """Checks if network accounting was enabled on interface"""
- try:
- os.stat("/var/lib/vnstat/%s" % iface)
- return True
- except:
- return False
-
def show_statistics_dialog(self, widget, iface):
"""Shows statistics dialog"""
dialog = gtk.Dialog(_("Network statistics for %s") % iface,
@@ -512,7 +504,7 @@ class MonitorGui:
)
# statistics vbox
stats_vbox = dialog.vbox
- if self.check_network_accounting(iface):
+ if self.monitor.check_network_accounting(iface):
# graph
graph_vnstat = gtk.Image()
pixbuf = self.load_graph_from_vnstat(iface, type="summary")
@@ -739,7 +731,7 @@ class MonitorGui:
frame_accounting = gtk.Frame(_("Traffic accounting"))
vbox = gtk.VBox()
frame_accounting.add(vbox)
- if self.check_network_accounting(iface):
+ if self.monitor.check_network_accounting(iface):
iface_u, iface_uptime = self.build_value_pair(sizegroup1, _("Connection time:"))
self.ifaces[iface]["widget_uptime"] = iface_uptime
vbox.pack_start(iface_u, False, False)