diff options
| author | jvoisin | 2018-07-18 23:12:55 +0200 |
|---|---|---|
| committer | jvoisin | 2018-07-18 23:12:55 +0200 |
| commit | dc026f99add121df80bee1fcf7519d830d9c717f (patch) | |
| tree | eff301700baa7333306fcbd9edf5a81745cace4b /nautilus | |
| parent | 0aac0d644ded14fc046def106ae6c4e9e237eff0 (diff) | |
Show if files are supported or not in the Nautilus extension
Diffstat (limited to 'nautilus')
| -rw-r--r-- | nautilus/nautilus_mat2.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/nautilus/nautilus_mat2.py b/nautilus/nautilus_mat2.py index 4d8bb94..0d8df2e 100644 --- a/nautilus/nautilus_mat2.py +++ b/nautilus/nautilus_mat2.py | |||
| @@ -46,18 +46,23 @@ class StatusWindow(Gtk.Window): | |||
| 46 | self.main_box.pack_start(listbox, True, True, 0) | 46 | self.main_box.pack_start(listbox, True, True, 0) |
| 47 | listbox.set_selection_mode(Gtk.SelectionMode.NONE) | 47 | listbox.set_selection_mode(Gtk.SelectionMode.NONE) |
| 48 | for i in self.items: | 48 | for i in self.items: |
| 49 | p, mtype = parser_factory.get_parser(i) | ||
| 50 | |||
| 49 | row = Gtk.ListBoxRow() | 51 | row = Gtk.ListBoxRow() |
| 50 | hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL) | 52 | hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL) |
| 51 | row.add(hbox) | 53 | row.add(hbox) |
| 52 | mtype, _ = mimetypes.guess_type(i) | 54 | |
| 53 | if mtype is None: | 55 | icon = Gio.content_type_get_icon ('text/plain' if not mtype else mtype) |
| 54 | icon = Gio.content_type_get_icon ('text/plain') | ||
| 55 | else: | ||
| 56 | icon = Gio.content_type_get_icon (mtype) | ||
| 57 | select_image = Gtk.Image.new_from_gicon(icon, Gtk.IconSize.BUTTON) | 56 | select_image = Gtk.Image.new_from_gicon(icon, Gtk.IconSize.BUTTON) |
| 58 | hbox.pack_start(select_image, False, False, 0) | 57 | hbox.pack_start(select_image, False, False, 0) |
| 58 | |||
| 59 | image = Gtk.Image() | ||
| 60 | image.set_from_stock(Gtk.STOCK_NO if not p else Gtk.STOCK_YES, Gtk.IconSize.BUTTON) | ||
| 61 | hbox.pack_start(image, False, False, 0) | ||
| 62 | |||
| 59 | label = Gtk.Label(os.path.basename(i)) | 63 | label = Gtk.Label(os.path.basename(i)) |
| 60 | hbox.pack_start(label, True, False, 0) | 64 | hbox.pack_start(label, True, False, 0) |
| 65 | |||
| 61 | listbox.add(row) | 66 | listbox.add(row) |
| 62 | listbox.show_all() | 67 | listbox.show_all() |
| 63 | 68 | ||
