Convert mintremove
This commit is contained in:
parent
9289b7a0e0
commit
1fa7cd8817
@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<glade-interface>
|
<interface>
|
||||||
<!-- interface-requires gtk+ 2.16 -->
|
<!-- interface-requires gtk+ 2.16 -->
|
||||||
<!-- interface-naming-policy toplevel-contextual -->
|
<!-- interface-naming-policy toplevel-contextual -->
|
||||||
<widget class="GtkWindow" id="main_window">
|
<object class="GtkWindow" id="main_window">
|
||||||
<property name="border_width">6</property>
|
<property name="border_width">6</property>
|
||||||
<property name="title" translatable="yes">mintMenu</property>
|
<property name="title" translatable="yes">mintMenu</property>
|
||||||
<property name="resizable">False</property>
|
<property name="resizable">False</property>
|
||||||
@ -11,14 +11,14 @@
|
|||||||
<property name="skip_taskbar_hint">True</property>
|
<property name="skip_taskbar_hint">True</property>
|
||||||
<property name="skip_pager_hint">True</property>
|
<property name="skip_pager_hint">True</property>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkVBox" id="vbox1">
|
<object class="GtkVBox" id="vbox1">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="spacing">6</property>
|
<property name="spacing">6</property>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkHBox" id="hbox2">
|
<object class="GtkHBox" id="hbox2">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkImage" id="image_icon">
|
<object class="GtkImage" id="image_icon">
|
||||||
<property name="width_request">48</property>
|
<property name="width_request">48</property>
|
||||||
<property name="height_request">48</property>
|
<property name="height_request">48</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
@ -26,7 +26,7 @@
|
|||||||
<property name="yalign">0</property>
|
<property name="yalign">0</property>
|
||||||
<property name="stock">gtk-dialog-warning</property>
|
<property name="stock">gtk-dialog-warning</property>
|
||||||
<property name="icon-size">6</property>
|
<property name="icon-size">6</property>
|
||||||
</widget>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
<property name="fill">False</property>
|
<property name="fill">False</property>
|
||||||
@ -35,44 +35,44 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkTable" id="table1">
|
<object class="GtkTable" id="table1">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="n_rows">2</property>
|
<property name="n_rows">2</property>
|
||||||
<property name="column_spacing">19</property>
|
<property name="column_spacing">19</property>
|
||||||
<property name="row_spacing">11</property>
|
<property name="row_spacing">11</property>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkLabel" id="txt_name">
|
<object class="GtkLabel" id="txt_name">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="xalign">0</property>
|
<property name="xalign">0</property>
|
||||||
<property name="label" translatable="yes">Name</property>
|
<property name="label" translatable="yes">Name</property>
|
||||||
<property name="justify">center</property>
|
<property name="justify">center</property>
|
||||||
</widget>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="x_options">GTK_FILL</property>
|
<property name="x_options">GTK_FILL</property>
|
||||||
<property name="y_options"></property>
|
<property name="y_options"/>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkLabel" id="txt_guidance">
|
<object class="GtkLabel" id="txt_guidance">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="xalign">0</property>
|
<property name="xalign">0</property>
|
||||||
<property name="label" translatable="yes">Guidance</property>
|
<property name="label" translatable="yes">Guidance</property>
|
||||||
</widget>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="top_attach">1</property>
|
<property name="top_attach">1</property>
|
||||||
<property name="bottom_attach">2</property>
|
<property name="bottom_attach">2</property>
|
||||||
<property name="x_options">GTK_FILL</property>
|
<property name="x_options">GTK_FILL</property>
|
||||||
<property name="y_options"></property>
|
<property name="y_options"/>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
<property name="fill">False</property>
|
<property name="fill">False</property>
|
||||||
<property name="position">1</property>
|
<property name="position">1</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
<property name="fill">False</property>
|
<property name="fill">False</property>
|
||||||
@ -81,7 +81,7 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkScrolledWindow" id="scrolledwindow1">
|
<object class="GtkScrolledWindow" id="scrolledwindow1">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
@ -89,34 +89,34 @@
|
|||||||
<property name="vscrollbar_policy">automatic</property>
|
<property name="vscrollbar_policy">automatic</property>
|
||||||
<property name="shadow_type">etched-in</property>
|
<property name="shadow_type">etched-in</property>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkTreeView" id="tree">
|
<object class="GtkTreeView" id="tree">
|
||||||
<property name="height_request">120</property>
|
<property name="height_request">120</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
<property name="headers_visible">False</property>
|
<property name="headers_visible">False</property>
|
||||||
<property name="headers_clickable">False</property>
|
<property name="headers_clickable">False</property>
|
||||||
</widget>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="position">1</property>
|
<property name="position">1</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkHButtonBox" id="hbuttonbox1">
|
<object class="GtkHButtonBox" id="hbuttonbox1">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="spacing">10</property>
|
<property name="spacing">10</property>
|
||||||
<property name="layout_style">spread</property>
|
<property name="layout_style">spread</property>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkButton" id="cancel_button">
|
<object class="GtkButton" id="cancel_button">
|
||||||
<property name="label">gtk-cancel</property>
|
<property name="label">gtk-cancel</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="receives_default">False</property>
|
<property name="receives_default">False</property>
|
||||||
<property name="use_stock">True</property>
|
<property name="use_stock">True</property>
|
||||||
<signal name="clicked" handler="on_cancel_button_clicked"/>
|
<signal handler="on_cancel_button_clicked" name="clicked"/>
|
||||||
</widget>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
<property name="fill">False</property>
|
<property name="fill">False</property>
|
||||||
@ -124,22 +124,22 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkButton" id="remove_button">
|
<object class="GtkButton" id="remove_button">
|
||||||
<property name="label" translatable="yes">gtk-remove</property>
|
<property name="label" translatable="yes">gtk-remove</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="receives_default">True</property>
|
<property name="receives_default">True</property>
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
<property name="use_stock">True</property>
|
<property name="use_stock">True</property>
|
||||||
<signal name="clicked" handler="on_remove_button_clicked"/>
|
<signal handler="on_remove_button_clicked" name="clicked"/>
|
||||||
</widget>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
<property name="fill">False</property>
|
<property name="fill">False</property>
|
||||||
<property name="position">1</property>
|
<property name="position">1</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
<property name="fill">False</property>
|
<property name="fill">False</property>
|
||||||
@ -147,7 +147,7 @@
|
|||||||
<property name="position">2</property>
|
<property name="position">2</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</object>
|
||||||
</glade-interface>
|
</interface>
|
||||||
|
153
usr/lib/linuxmint/mintMenu/mintRemove.glade.old
Normal file
153
usr/lib/linuxmint/mintMenu/mintRemove.glade.old
Normal file
@ -0,0 +1,153 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<glade-interface>
|
||||||
|
<!-- interface-requires gtk+ 2.16 -->
|
||||||
|
<!-- interface-naming-policy toplevel-contextual -->
|
||||||
|
<widget class="GtkWindow" id="main_window">
|
||||||
|
<property name="border_width">6</property>
|
||||||
|
<property name="title" translatable="yes">mintMenu</property>
|
||||||
|
<property name="resizable">False</property>
|
||||||
|
<property name="modal">True</property>
|
||||||
|
<property name="window_position">center</property>
|
||||||
|
<property name="skip_taskbar_hint">True</property>
|
||||||
|
<property name="skip_pager_hint">True</property>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkVBox" id="vbox1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="spacing">6</property>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkHBox" id="hbox2">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkImage" id="image_icon">
|
||||||
|
<property name="width_request">48</property>
|
||||||
|
<property name="height_request">48</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
|
<property name="yalign">0</property>
|
||||||
|
<property name="stock">gtk-dialog-warning</property>
|
||||||
|
<property name="icon-size">6</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
<property name="padding">9</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkTable" id="table1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="n_rows">2</property>
|
||||||
|
<property name="column_spacing">19</property>
|
||||||
|
<property name="row_spacing">11</property>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkLabel" id="txt_name">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
|
<property name="label" translatable="yes">Name</property>
|
||||||
|
<property name="justify">center</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="x_options">GTK_FILL</property>
|
||||||
|
<property name="y_options"></property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkLabel" id="txt_guidance">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
|
<property name="label" translatable="yes">Guidance</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="top_attach">1</property>
|
||||||
|
<property name="bottom_attach">2</property>
|
||||||
|
<property name="x_options">GTK_FILL</property>
|
||||||
|
<property name="y_options"></property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
<property name="padding">2</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkScrolledWindow" id="scrolledwindow1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
|
<property name="hscrollbar_policy">automatic</property>
|
||||||
|
<property name="vscrollbar_policy">automatic</property>
|
||||||
|
<property name="shadow_type">etched-in</property>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkTreeView" id="tree">
|
||||||
|
<property name="height_request">120</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
|
<property name="headers_visible">False</property>
|
||||||
|
<property name="headers_clickable">False</property>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkHButtonBox" id="hbuttonbox1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="spacing">10</property>
|
||||||
|
<property name="layout_style">spread</property>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkButton" id="cancel_button">
|
||||||
|
<property name="label">gtk-cancel</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">False</property>
|
||||||
|
<property name="use_stock">True</property>
|
||||||
|
<signal name="clicked" handler="on_cancel_button_clicked"/>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkButton" id="remove_button">
|
||||||
|
<property name="label" translatable="yes">gtk-remove</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">True</property>
|
||||||
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
|
<property name="use_stock">True</property>
|
||||||
|
<signal name="clicked" handler="on_remove_button_clicked"/>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
<property name="padding">5</property>
|
||||||
|
<property name="position">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</glade-interface>
|
@ -1,15 +1,13 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
try:
|
import gi
|
||||||
import pygtk
|
gi.require_version("Gtk", "2.0")
|
||||||
pygtk.require("2.0")
|
|
||||||
except:
|
from gi.repository import Gtk, Gdk
|
||||||
pass
|
|
||||||
try:
|
try:
|
||||||
import sys
|
import sys
|
||||||
import string
|
import string
|
||||||
import gtk
|
|
||||||
import gtk.glade
|
|
||||||
import os
|
import os
|
||||||
import commands
|
import commands
|
||||||
import threading
|
import threading
|
||||||
@ -22,7 +20,7 @@ except Exception, detail:
|
|||||||
|
|
||||||
from subprocess import Popen, PIPE
|
from subprocess import Popen, PIPE
|
||||||
|
|
||||||
gtk.gdk.threads_init()
|
Gdk.threads_init()
|
||||||
|
|
||||||
# i18n
|
# i18n
|
||||||
gettext.install("mintmenu", "/usr/share/linuxmint/locale")
|
gettext.install("mintmenu", "/usr/share/linuxmint/locale")
|
||||||
@ -30,126 +28,127 @@ gettext.install("mintmenu", "/usr/share/linuxmint/locale")
|
|||||||
class RemoveExecuter(threading.Thread):
|
class RemoveExecuter(threading.Thread):
|
||||||
|
|
||||||
def __init__(self, window_id, package):
|
def __init__(self, window_id, package):
|
||||||
threading.Thread.__init__(self)
|
threading.Thread.__init__(self)
|
||||||
self.window_id = window_id
|
self.window_id = window_id
|
||||||
self.package = package
|
self.package = package
|
||||||
|
|
||||||
def execute(self, command):
|
def execute(self, command):
|
||||||
#print "Executing: " + command
|
#print "Executing: " + command
|
||||||
os.system(command)
|
os.system(command)
|
||||||
ret = commands.getoutput("echo $?")
|
ret = commands.getoutput("echo $?")
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
removePackages = string.split(self.package)
|
removePackages = string.split(self.package)
|
||||||
cmd = ["sudo", "/usr/sbin/synaptic", "--hide-main-window", \
|
cmd = ["sudo", "/usr/sbin/synaptic", "--hide-main-window", \
|
||||||
"--non-interactive", "--parent-window-id", self.window_id]
|
"--non-interactive", "--parent-window-id", self.window_id]
|
||||||
cmd.append("--progress-str")
|
cmd.append("--progress-str")
|
||||||
cmd.append("\"" + _("Please wait, this can take some time") + "\"")
|
cmd.append("\"" + _("Please wait, this can take some time") + "\"")
|
||||||
cmd.append("--finish-str")
|
cmd.append("--finish-str")
|
||||||
cmd.append("\"" + _("Application removed successfully") + "\"")
|
cmd.append("\"" + _("Application removed successfully") + "\"")
|
||||||
f = tempfile.NamedTemporaryFile()
|
f = tempfile.NamedTemporaryFile()
|
||||||
for pkg in removePackages:
|
for pkg in removePackages:
|
||||||
f.write("%s\tdeinstall\n" % pkg)
|
f.write("%s\tdeinstall\n" % pkg)
|
||||||
cmd.append("--set-selections-file")
|
cmd.append("--set-selections-file")
|
||||||
cmd.append("%s" % f.name)
|
cmd.append("%s" % f.name)
|
||||||
f.flush()
|
f.flush()
|
||||||
comnd = Popen(' '.join(cmd), shell=True)
|
comnd = Popen(' '.join(cmd), shell=True)
|
||||||
returnCode = comnd.wait()
|
returnCode = comnd.wait()
|
||||||
f.close()
|
f.close()
|
||||||
gtk.main_quit()
|
Gtk.main_quit()
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
class mintRemoveWindow:
|
class mintRemoveWindow:
|
||||||
|
|
||||||
def __init__(self, desktopFile):
|
def __init__(self, desktopFile):
|
||||||
self.desktopFile = desktopFile
|
self.desktopFile = desktopFile
|
||||||
|
|
||||||
#Set the Glade file
|
#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)
|
|
||||||
|
|
||||||
# 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)
|
||||||
|
|
||||||
package = commands.getoutput("dpkg -S " + self.desktopFile)
|
# Get the window socket (needed for synaptic later on)
|
||||||
package = package[:package.find(":")]
|
vbox = self.builder.get_object("vbox1")
|
||||||
if package == "dpkg":
|
socket = Gtk.Socket()
|
||||||
warnDlg = gtk.Dialog(title="MintMenu", parent=None, flags=0, buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
|
vbox.pack_start(socket, False, False, 0)
|
||||||
warnDlg.add_button(gtk.STOCK_REMOVE, gtk.RESPONSE_OK)
|
socket.show()
|
||||||
warnDlg.vbox.set_spacing(10)
|
window_id = repr(socket.get_id())
|
||||||
warnDlg.set_icon_from_file("/usr/share/linuxmint/logo.png")
|
|
||||||
labelSpc = gtk.Label(" ")
|
|
||||||
warnDlg.vbox.pack_start(labelSpc)
|
|
||||||
labelSpc.show()
|
|
||||||
warnText = "<b>" + _("No matching package found") + "</b>"
|
|
||||||
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)
|
|
||||||
|
|
||||||
wTree.get_widget("txt_name").set_text("<big><b>" + _("Remove %s?") % package + "</b></big>")
|
package = commands.getoutput("dpkg -S " + self.desktopFile)
|
||||||
wTree.get_widget("txt_name").set_use_markup(True)
|
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 = "<b>" + _("No matching package found") + "</b>"
|
||||||
|
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)
|
||||||
|
|
||||||
wTree.get_widget("txt_guidance").set_text(_("The following packages will be removed:"))
|
self.builder.get_object("txt_name").set_text("<big><b>" + _("Remove %s?") % package + "</b></big>")
|
||||||
|
self.builder.get_object("txt_name").set_use_markup(True)
|
||||||
|
|
||||||
treeview = wTree.get_widget("tree")
|
self.builder.get_object("txt_guidance").set_text(_("The following packages will be removed:"))
|
||||||
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)
|
treeview = self.builder.get_object("tree")
|
||||||
dependenciesString = commands.getoutput("apt-get -s -q remove " + package + " | grep Remv")
|
column1 = Gtk.TreeViewColumn(_("Packages to be removed"))
|
||||||
dependencies = string.split(dependenciesString, "\n")
|
renderer = Gtk.CellRendererText()
|
||||||
for dependency in dependencies:
|
column1.pack_start(renderer, False)
|
||||||
dependency = dependency.replace("Remv ", "")
|
column1.add_attribute(renderer, "text", 0)
|
||||||
model.append([dependency])
|
treeview.append_column(column1)
|
||||||
treeview.set_model(model)
|
|
||||||
treeview.show()
|
|
||||||
|
|
||||||
dic = {"on_remove_button_clicked" : (self.MainButtonClicked, window_id, package, wTree),
|
model = Gtk.ListStore(str)
|
||||||
"on_cancel_button_clicked" : (self.giveUp) }
|
dependenciesString = commands.getoutput("apt-get -s -q remove " + package + " | grep Remv")
|
||||||
wTree.signal_autoconnect(dic)
|
dependencies = string.split(dependenciesString, "\n")
|
||||||
|
for dependency in dependencies:
|
||||||
wTree.get_widget("main_window").show()
|
dependency = dependency.replace("Remv ", "")
|
||||||
|
model.append([dependency])
|
||||||
|
treeview.set_model(model)
|
||||||
|
treeview.show()
|
||||||
|
|
||||||
|
|
||||||
def MainButtonClicked(self, widget, window_id, package, wTree):
|
self.builder.get_object("remove_button").connect ("clicked", self.MainButtonClicked, window_id, package)
|
||||||
wTree.get_widget("main_window").window.set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH))
|
self.builder.get_object("cancel_button").connect ("clicked", self.giveUp)
|
||||||
wTree.get_widget("main_window").set_sensitive(False)
|
|
||||||
executer = RemoveExecuter(window_id, package)
|
self.builder.get_object("main_window").show()
|
||||||
executer.start()
|
|
||||||
return True
|
|
||||||
|
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):
|
def giveUp(self, widget):
|
||||||
gtk.main_quit()
|
Gtk.main_quit()
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
mainwin = mintRemoveWindow(sys.argv[1])
|
mainwin = mintRemoveWindow(sys.argv[1])
|
||||||
gtk.main()
|
Gtk.main()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user