Skip to content
Snippets Groups Projects
Commit 2f670651 authored by Julien (jvoisin) Voisin's avatar Julien (jvoisin) Voisin
Browse files

Minor cleanup of the Nautilus extension's code

parent 0cd51093
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python3 #!/usr/bin/env python3
import os
from urllib.parse import unquote
import gi import gi
gi.require_version('Nautilus', '3.0') gi.require_version('Nautilus', '3.0')
gi.require_version('Gtk', '3.0') gi.require_version('Gtk', '3.0')
from gi.repository import Nautilus, GObject, Gtk, Gio from gi.repository import Nautilus, GObject, Gtk, Gio
from urllib.parse import unquote
import mimetypes
import os
from libmat2 import parser_factory from libmat2 import parser_factory
...@@ -34,7 +34,7 @@ class StatusWindow(Gtk.Window): ...@@ -34,7 +34,7 @@ class StatusWindow(Gtk.Window):
hb.pack_start(cancel) hb.pack_start(cancel)
self.remove = Gtk.Button("Remove") self.remove = Gtk.Button("Remove")
self.remove.get_style_context().add_class(Gtk.STYLE_CLASS_SUGGESTED_ACTION); self.remove.get_style_context().add_class(Gtk.STYLE_CLASS_SUGGESTED_ACTION)
self.remove.connect("clicked", self.remove_btn) self.remove.connect("clicked", self.remove_btn)
hb.pack_end(self.remove) hb.pack_end(self.remove)
...@@ -52,7 +52,7 @@ class StatusWindow(Gtk.Window): ...@@ -52,7 +52,7 @@ class StatusWindow(Gtk.Window):
hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL) hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
row.add(hbox) row.add(hbox)
icon = Gio.content_type_get_icon ('text/plain' if not mtype else mtype) icon = Gio.content_type_get_icon('text/plain' if not mtype else mtype)
select_image = Gtk.Image.new_from_gicon(icon, Gtk.IconSize.BUTTON) select_image = Gtk.Image.new_from_gicon(icon, Gtk.IconSize.BUTTON)
hbox.pack_start(select_image, False, False, 0) hbox.pack_start(select_image, False, False, 0)
...@@ -106,7 +106,7 @@ class StatusWindow(Gtk.Window): ...@@ -106,7 +106,7 @@ class StatusWindow(Gtk.Window):
def remove_btn(self, button): def remove_btn(self, button):
failed = [] failed = []
for i in self.items: for i in self.items:
p, mtype = parser_factory.get_parser(i) p, _ = parser_factory.get_parser(i)
if p is not None and p.remove_all(): if p is not None and p.remove_all():
continue continue
failed.append(i) failed.append(i)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment