Commit 017b1b4b authored by Nong Hoang Tu's avatar Nong Hoang Tu
Browse files

Fix status and update some code

parent 8d7f7b47
Pipeline #3769 canceled with stages
......@@ -10,6 +10,6 @@ proc init_cli_askkill*(is_desktop: bool): callback_kill_apps =
proc init_gtk_askkill*(): callback_kill_apps =
# return dialog_kill_app
return dialog_kill_app
# return window_kill_app
return window_kill_apps_gtk
# return window_kill_apps_gtk
......@@ -3,17 +3,18 @@ import .. / ansurf_types
import kill_apps_activities
proc onClickExit(w: Window) =
mainQuit()
# proc onClickExit(w: Window) =
# mainQuit()
proc do_not_kill(b: Button) =
mainQuit()
discard
# mainQuit()
proc do_kill(b: Button, callback_send_msg: callback_send_messenger) =
ansurf_kill_apps(callback_send_msg)
mainQuit()
# mainQuit()
# proc do_exit(b: Button) =
......@@ -57,23 +58,36 @@ proc window_kill_app*(callback_send_msg: callback_send_messenger) =
mainBoard.setBorderWidth(3)
mainBoard.showAll()
mainBoard.connect("destroy", onClickExit)
# mainBoard.connect("destroy", onClickExit)
gtk.main()
mainQuit()
proc window_kill_apps_gtk*(callback_send_msg: callback_send_messenger) =
gtk.init()
let
mainBoard = newWindow()
boxMainWindow = box_kill_app(callback_send_msg)
# proc window_kill_apps_gtk*(callback_send_msg: callback_send_messenger) =
# gtk.init()
# let
# mainBoard = newWindow()
# boxMainWindow = box_kill_app(callback_send_msg)
mainBoard.setResizable(false)
mainBoard.title = "Kill dangerous application"
mainBoard.setPosition(WindowPosition.center)
mainBoard.add(boxMainWindow)
mainBoard.setBorderWidth(3)
# mainBoard.setResizable(false)
# mainBoard.title = "Kill dangerous application"
# mainBoard.setPosition(WindowPosition.center)
# mainBoard.add(boxMainWindow)
# mainBoard.setBorderWidth(3)
# mainBoard.showAll()
# mainBoard.connect("destroy", onClickExit)
# gtk.main()
# mainQuit()
mainBoard.showAll()
mainBoard.connect("destroy", onClickExit)
gtk.main()
mainQuit()
proc dialog_kill_app*(callback_send_msg: callback_send_messenger) =
# FIXME broken
let
retDialog = newDialog()
dialogArea = retDialog.getContentArea()
boxDialog = box_kill_app(callback_send_msg)
retDialog.setTitle("Kill dangerous application")
dialogArea.add(boxDialog)
retDialog.showAll()
discard retDialog.run()
retDialog.destroy()
\ No newline at end of file
......@@ -20,14 +20,14 @@ proc updateDetail*(args: DetailObjs, myStatus: Status) =
args.imgBoot.setFromPixbuf(surfImages.imgBootOff)
# Check current status of daemon services and control ports
if myStatus.isAnonSurfService == 1:
if myStatus.isAnonSurfService == 0:
# Check status of Tor
if myStatus.isTorService == 1:
if myStatus.isTorService == 0:
args.lblServices.setMarkup("Servc: <b><span background=\"#333333\" foreground=\"#00FF00\">Activated</span></b>")
elif myStatus.isTorService == 0:
elif myStatus.isTorService == 1:
# Give error msg with red color
args.lblServices.setMarkup("Servc: <b><span background=\"#333333\" foreground=\"#FF0000\">Tor is not running</span></b>")
elif myStatus.isTorService == -1:
elif myStatus.isTorService > 1:
# Give error msg with red color
args.lblServices.setMarkup("Servc: <b><span background=\"#333333\" foreground=\"#FF0000\">Can't start Tor</span></b>")
# Check status of Port
......@@ -115,11 +115,11 @@ proc updateMain*(args: MainObjs, myStatus: Status) =
to show correct state of buttons
]#
# args.btnRestart.label = "Restart"
if myStatus.isAnonSurfService == 1:
if myStatus.isAnonSurfService == 0:
# Idea: Restart when AnonSurf is failed
args.btnRestart.setSensitive(true)
# Check status of tor service
if myStatus.isTorService == 1:
if myStatus.isTorService == 0:
let myPorts = getStatusPorts()
# If everything (except DNS port) is okay
if myPorts.isControlPort and myPorts.isSocksPort and myPorts.isTransPort and
......@@ -150,16 +150,21 @@ proc updateMain*(args: MainObjs, myStatus: Status) =
args.btnRun.label = "Stop"
else:
if myStatus.isAnonSurfService == -1:
if myStatus.isAnonSurfService == 1:
args.btnRestart.setSensitive(false)
args.lDetails.setText("AnonSurf start failed") # Fix me
# args.imgStatus.setFromIconName("security-low", 6)
args.imgStatus.setFromPixBuf(surfImages.imgSecLow)
else:
elif myStatus.isAnonSurfService == 3:
args.btnRestart.setSensitive(false)
args.lDetails.setText("AnonSurf is not running")
# args.imgStatus.setFromIconName("security-medium", 6)
args.imgStatus.setFromPixBuf(surfImages.imgSecMed)
else:
args.btnRestart.setSensitive(false)
args.lDetails.setText("AnonSurf service is broken")
# args.imgStatus.setFromIconName("security-medium", 6)
args.imgStatus.setFromPixBuf(surfImages.imgSecMed)
args.btnRun.label = "Start"
args.btnID.setSensitive(false)
args.btnStatus.setSensitive(false)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment