1
0
mirror of synced 2024-12-27 23:21:33 +01:00

Minor cleanup of the Nautilus extension's code

This commit is contained in:
jvoisin 2018-07-18 23:20:51 +02:00
parent 0cd510938a
commit 2f670651cf

View File

@ -1,13 +1,13 @@
#!/usr/bin/env python3
import os
from urllib.parse import unquote
import gi
gi.require_version('Nautilus', '3.0')
gi.require_version('Gtk', '3.0')
from gi.repository import Nautilus, GObject, Gtk, Gio
from urllib.parse import unquote
import mimetypes
import os
from libmat2 import parser_factory
@ -34,7 +34,7 @@ class StatusWindow(Gtk.Window):
hb.pack_start(cancel)
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)
hb.pack_end(self.remove)
@ -52,7 +52,7 @@ class StatusWindow(Gtk.Window):
hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
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)
hbox.pack_start(select_image, False, False, 0)
@ -106,7 +106,7 @@ class StatusWindow(Gtk.Window):
def remove_btn(self, button):
failed = []
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():
continue
failed.append(i)