diff --git a/usr/lib/linuxmint/mintMenu/mintRemove.glade b/usr/lib/linuxmint/mintMenu/mintRemove.glade
index 6335aed..ad3b5a2 100644
--- a/usr/lib/linuxmint/mintMenu/mintRemove.glade
+++ b/usr/lib/linuxmint/mintMenu/mintRemove.glade
@@ -1,8 +1,8 @@
-
+
-
+
+
False
False
1
-
+
False
False
@@ -81,7 +81,7 @@
-
+
True
True
GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
@@ -89,34 +89,34 @@
automatic
etched-in
-
+
120
True
True
GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
False
False
-
+
-
+
1
-
+
True
10
spread
-
+
gtk-cancel
True
True
False
True
-
-
+
+
False
False
@@ -124,22 +124,22 @@
-
+
gtk-remove
True
True
True
GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
True
-
-
+
+
False
False
1
-
+
False
False
@@ -147,7 +147,7 @@
2
-
+
-
-
+
+
diff --git a/usr/lib/linuxmint/mintMenu/mintRemove.glade.old b/usr/lib/linuxmint/mintMenu/mintRemove.glade.old
new file mode 100644
index 0000000..6335aed
--- /dev/null
+++ b/usr/lib/linuxmint/mintMenu/mintRemove.glade.old
@@ -0,0 +1,153 @@
+
+
+
+
+
+ 6
+ mintMenu
+ False
+ True
+ center
+ True
+ True
+
+
+ True
+ 6
+
+
+ True
+
+
+ 48
+ 48
+ True
+ 0
+ 0
+ gtk-dialog-warning
+ 6
+
+
+ False
+ False
+ 9
+ 0
+
+
+
+
+ True
+ 2
+ 19
+ 11
+
+
+ True
+ 0
+ Name
+ center
+
+
+ GTK_FILL
+
+
+
+
+
+ True
+ 0
+ Guidance
+
+
+ 1
+ 2
+ GTK_FILL
+
+
+
+
+
+ False
+ False
+ 1
+
+
+
+
+ False
+ False
+ 2
+ 0
+
+
+
+
+ True
+ True
+ GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
+ automatic
+ automatic
+ etched-in
+
+
+ 120
+ True
+ True
+ GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
+ False
+ False
+
+
+
+
+ 1
+
+
+
+
+ True
+ 10
+ spread
+
+
+ gtk-cancel
+ True
+ True
+ False
+ True
+
+
+
+ False
+ False
+ 0
+
+
+
+
+ gtk-remove
+ True
+ True
+ True
+ GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
+ True
+
+
+
+ False
+ False
+ 1
+
+
+
+
+ False
+ False
+ 5
+ 2
+
+
+
+
+
+
diff --git a/usr/lib/linuxmint/mintMenu/mintRemove.py b/usr/lib/linuxmint/mintMenu/mintRemove.py
index d97f340..b94831d 100755
--- a/usr/lib/linuxmint/mintMenu/mintRemove.py
+++ b/usr/lib/linuxmint/mintMenu/mintRemove.py
@@ -1,15 +1,13 @@
#!/usr/bin/env python
-try:
- import pygtk
- pygtk.require("2.0")
-except:
- pass
+import gi
+gi.require_version("Gtk", "2.0")
+
+from gi.repository import Gtk, Gdk
+
try:
import sys
import string
- import gtk
- import gtk.glade
import os
import commands
import threading
@@ -22,7 +20,7 @@ except Exception, detail:
from subprocess import Popen, PIPE
-gtk.gdk.threads_init()
+Gdk.threads_init()
# i18n
gettext.install("mintmenu", "/usr/share/linuxmint/locale")
@@ -30,126 +28,127 @@ gettext.install("mintmenu", "/usr/share/linuxmint/locale")
class RemoveExecuter(threading.Thread):
def __init__(self, window_id, package):
- threading.Thread.__init__(self)
- self.window_id = window_id
- self.package = package
+ threading.Thread.__init__(self)
+ self.window_id = window_id
+ self.package = package
def execute(self, command):
- #print "Executing: " + command
- os.system(command)
- ret = commands.getoutput("echo $?")
- return ret
+ #print "Executing: " + command
+ os.system(command)
+ ret = commands.getoutput("echo $?")
+ return ret
- def run(self):
- removePackages = string.split(self.package)
- cmd = ["sudo", "/usr/sbin/synaptic", "--hide-main-window", \
- "--non-interactive", "--parent-window-id", self.window_id]
- cmd.append("--progress-str")
- cmd.append("\"" + _("Please wait, this can take some time") + "\"")
- cmd.append("--finish-str")
- cmd.append("\"" + _("Application removed successfully") + "\"")
- f = tempfile.NamedTemporaryFile()
- for pkg in removePackages:
+ def run(self):
+ removePackages = string.split(self.package)
+ cmd = ["sudo", "/usr/sbin/synaptic", "--hide-main-window", \
+ "--non-interactive", "--parent-window-id", self.window_id]
+ cmd.append("--progress-str")
+ cmd.append("\"" + _("Please wait, this can take some time") + "\"")
+ cmd.append("--finish-str")
+ cmd.append("\"" + _("Application removed successfully") + "\"")
+ f = tempfile.NamedTemporaryFile()
+ for pkg in removePackages:
f.write("%s\tdeinstall\n" % pkg)
- cmd.append("--set-selections-file")
- cmd.append("%s" % f.name)
- f.flush()
- comnd = Popen(' '.join(cmd), shell=True)
- returnCode = comnd.wait()
- f.close()
- gtk.main_quit()
- sys.exit(0)
-
+ cmd.append("--set-selections-file")
+ cmd.append("%s" % f.name)
+ f.flush()
+ comnd = Popen(' '.join(cmd), shell=True)
+ returnCode = comnd.wait()
+ f.close()
+ Gtk.main_quit()
+ sys.exit(0)
+
class mintRemoveWindow:
def __init__(self, desktopFile):
- self.desktopFile = desktopFile
+ self.desktopFile = desktopFile
- #Set the Glade file
- self.gladefile = "/usr/lib/linuxmint/mintMenu/mintRemove.glade"
- wTree = gtk.glade.XML(self.gladefile,"main_window")
- wTree.get_widget("main_window").set_icon_from_file("/usr/lib/linuxmint/mintMenu/icon.svg")
- wTree.get_widget("main_window").set_title("")
- wTree.get_widget("main_window").connect("destroy", self.giveUp)
+ #Set the Glade file
- # Get the window socket (needed for synaptic later on)
- vbox = wTree.get_widget("vbox1")
- socket = gtk.Socket()
- vbox.pack_start(socket)
- socket.show()
- window_id = repr(socket.get_id())
+
+ self.builder = Gtk.Builder()
+ self.builder.add_from_file ("/usr/lib/linuxmint/mintMenu/mintRemove.glade")
+ self.builder.get_object("main_window").set_icon_from_file("/usr/lib/linuxmint/mintMenu/icon.svg")
+ self.builder.get_object("main_window").set_title("")
+ self.builder.get_object("main_window").connect("destroy", self.giveUp)
+
+ # Get the window socket (needed for synaptic later on)
+ vbox = self.builder.get_object("vbox1")
+ socket = Gtk.Socket()
+ vbox.pack_start(socket, False, False, 0)
+ socket.show()
+ window_id = repr(socket.get_id())
+
+ package = commands.getoutput("dpkg -S " + self.desktopFile)
+ package = package[:package.find(":")]
+ if package == "dpkg":
+ warnDlg = Gtk.Dialog("MintMenu", None, 0,
+ Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
+ Gtk.STOCK_REMOVE, Gtk.ResponseType.OK)
+ warnDlg.vbox.set_spacing(10)
+ warnDlg.set_icon_from_file("/usr/share/linuxmint/logo.png")
+ labelSpc = Gtk.Label(" ")
+ warnDlg.vbox.pack_start(labelSpc, False, False, 0)
+ labelSpc.show()
+ warnText = "" + _("No matching package found") + ""
+ infoText = _("Do you want to remove this menu entry?") + " (" + self.desktopFile + ")"
+ label = Gtk.Label(warnText)
+ lblInfo = Gtk.Label(infoText)
+ label.set_use_markup(True)
+ lblInfo.set_use_markup(True)
+ warnDlg.vbox.pack_start(label)
+ warnDlg.vbox.pack_start(lblInfo)
+ label.show()
+ lblInfo.show()
+ response = warnDlg.run()
+ if response == Gtk.ResponseType.OK :
+ print "removing " + self.desktopFile + "*.desktop"
+ os.system("rm -f " + self.desktopFile)
+ os.system("rm -f " + self.desktopFile + "*.desktop")
+ warnDlg.destroy()
+ Gtk.main_quit()
+ sys.exit(0)
+
+ self.builder.get_object("txt_name").set_text("" + _("Remove %s?") % package + "")
+ self.builder.get_object("txt_name").set_use_markup(True)
+
+ self.builder.get_object("txt_guidance").set_text(_("The following packages will be removed:"))
-
-
- package = commands.getoutput("dpkg -S " + self.desktopFile)
- package = package[:package.find(":")]
- if package == "dpkg":
- warnDlg = gtk.Dialog(title="MintMenu", parent=None, flags=0, buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
- warnDlg.add_button(gtk.STOCK_REMOVE, gtk.RESPONSE_OK)
- warnDlg.vbox.set_spacing(10)
- warnDlg.set_icon_from_file("/usr/share/linuxmint/logo.png")
- labelSpc = gtk.Label(" ")
- warnDlg.vbox.pack_start(labelSpc)
- labelSpc.show()
- warnText = "" + _("No matching package found") + ""
- infoText = _("Do you want to remove this menu entry?") + " (" + self.desktopFile + ")"
- label = gtk.Label(warnText)
- lblInfo = gtk.Label(infoText)
- label.set_use_markup(True)
- lblInfo.set_use_markup(True)
- warnDlg.vbox.pack_start(label)
- warnDlg.vbox.pack_start(lblInfo)
- label.show()
- lblInfo.show()
- response = warnDlg.run()
- if response == gtk.RESPONSE_OK :
- print "removing " + self.desktopFile + "*.desktop"
- os.system("rm -f " + self.desktopFile)
- os.system("rm -f " + self.desktopFile + "*.desktop")
- warnDlg.destroy()
- gtk.main_quit()
- sys.exit(0)
+ treeview = self.builder.get_object("tree")
+ column1 = Gtk.TreeViewColumn(_("Packages to be removed"))
+ renderer = Gtk.CellRendererText()
+ column1.pack_start(renderer, False)
+ column1.add_attribute(renderer, "text", 0)
+ treeview.append_column(column1)
- wTree.get_widget("txt_name").set_text("" + _("Remove %s?") % package + "")
- wTree.get_widget("txt_name").set_use_markup(True)
-
- wTree.get_widget("txt_guidance").set_text(_("The following packages will be removed:"))
-
- treeview = wTree.get_widget("tree")
- column1 = gtk.TreeViewColumn(_("Packages to be removed"))
- renderer = gtk.CellRendererText()
- column1.pack_start(renderer, False)
- column1.set_attributes(renderer, text = 0)
- treeview.append_column(column1)
-
- model = gtk.ListStore(str)
- dependenciesString = commands.getoutput("apt-get -s -q remove " + package + " | grep Remv")
- dependencies = string.split(dependenciesString, "\n")
- for dependency in dependencies:
- dependency = dependency.replace("Remv ", "")
- model.append([dependency])
- treeview.set_model(model)
- treeview.show()
-
- dic = {"on_remove_button_clicked" : (self.MainButtonClicked, window_id, package, wTree),
- "on_cancel_button_clicked" : (self.giveUp) }
- wTree.signal_autoconnect(dic)
-
- wTree.get_widget("main_window").show()
+ model = Gtk.ListStore(str)
+ dependenciesString = commands.getoutput("apt-get -s -q remove " + package + " | grep Remv")
+ dependencies = string.split(dependenciesString, "\n")
+ for dependency in dependencies:
+ dependency = dependency.replace("Remv ", "")
+ model.append([dependency])
+ treeview.set_model(model)
+ treeview.show()
- def MainButtonClicked(self, widget, window_id, package, wTree):
- wTree.get_widget("main_window").window.set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH))
- wTree.get_widget("main_window").set_sensitive(False)
- executer = RemoveExecuter(window_id, package)
- executer.start()
- return True
+ self.builder.get_object("remove_button").connect ("clicked", self.MainButtonClicked, window_id, package)
+ self.builder.get_object("cancel_button").connect ("clicked", self.giveUp)
+
+ self.builder.get_object("main_window").show()
+
+
+ def MainButtonClicked(self, widget, window_id, package):
+ self.builder.get_object("main_window").window.set_cursor(Gdk.Cursor(Gdk.CursorType.WATCH))
+ self.builder.get_object("main_window").set_sensitive(False)
+ executer = RemoveExecuter(window_id, package)
+ executer.start()
+ return True
def giveUp(self, widget):
- gtk.main_quit()
- sys.exit(0)
+ Gtk.main_quit()
+ sys.exit(0)
if __name__ == "__main__":
mainwin = mintRemoveWindow(sys.argv[1])
- gtk.main()
+ Gtk.main()