Commit 208e93c9 authored by Nong Hoang Tu's avatar Nong Hoang Tu
Browse files

Create sperate module for kill app for anonsurf-gtk

Fix don't kill button
parent b942e2f0
Pipeline #3777 canceled with stages
import killapps / [kill_apps_cli, kill_apps_gtk]
import killapps / [kill_apps_cli, kill_apps_gtk, kill_apps_dialog]
import ansurf_types
......@@ -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
import gintro / [gtk, gobject]
import .. / ansurf_types
import kill_apps_activities
# proc onClickExit(w: Window) =
# mainQuit()
proc do_not_kill(b: Button, d: Dialog) =
d.destroy()
proc do_kill(b: Button, callback_send_msg: callback_send_messenger) =
ansurf_kill_apps(callback_send_msg)
# d.destroy()
# proc do_exit(b: Button) =
# mainQuit()
# # TODO do not start anonsurf instead of just call
proc box_kill_app(callback_send_msg: callback_send_messenger, d: Dialog): Box =
let
boxAppKill = newBox(Orientation.vertical, 3)
labelAsk = newLabel("Do you want to kill apps and clear cache?")
boxButtons = newBox(Orientation.horizontal, 3)
btnKill = newButton("Kill")
btnDoNotKill = newButton("Don't kill")
# btnCancel = newButton("Cancel")
btnKill.connect("clicked", do_kill, callback_send_msg)
boxButtons.add(btnKill)
btnDoNotKill.connect("clicked", do_not_kill, d)
boxButtons.packEnd(btnDoNotKill, false, true, 3)
# btnCancel.connect("clicked", do_exit)
# boxButtons.add(btnCancel)
boxAppKill.add(labelAsk)
boxAppkill.add(boxButtons)
return boxAppKill
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)
retDialog.setTitle("Kill dangerous application")
dialogArea.add(boxDialog)
retDialog.showAll()
discard retDialog.run()
retDialog.destroy()
......@@ -62,32 +62,32 @@ proc window_kill_app*(callback_send_msg: callback_send_messenger) =
# 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.showAll()
mainBoard.connect("destroy", onClickExit)
gtk.main()
mainQuit()
# 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()
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()
# 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()
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