diff options
| author | jvoisin | 2018-04-15 13:59:44 +0200 |
|---|---|---|
| committer | jvoisin | 2018-04-15 13:59:44 +0200 |
| commit | 6893de6e585edbbc065c9d92f286d58608ab08c2 (patch) | |
| tree | 99ce643e2297ba02ccf883b462d0ca0012b17b72 | |
| parent | 3bf82af20583cc5881c237396046518a57f795fd (diff) | |
Add a prototype for the nautilus extension
| -rw-r--r-- | nautilus/nautilus_mat2.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/nautilus/nautilus_mat2.py b/nautilus/nautilus_mat2.py new file mode 100644 index 0000000..1216470 --- /dev/null +++ b/nautilus/nautilus_mat2.py | |||
| @@ -0,0 +1,29 @@ | |||
| 1 | #!/usr/bin/env python3 | ||
| 2 | |||
| 3 | import gi | ||
| 4 | gi.require_version('Nautilus', '3.0') | ||
| 5 | from gi.repository import Nautilus, GObject | ||
| 6 | |||
| 7 | class ColumnExtension(GObject.GObject, Nautilus.MenuProvider): | ||
| 8 | def menu_activate_cb(self, menu, file): | ||
| 9 | print "menu_activate_cb", file | ||
| 10 | # TODO: clean metadata here | ||
| 11 | |||
| 12 | def get_background_items(self, window, file): | ||
| 13 | """ https://bugzilla.gnome.org/show_bug.cgi?id=784278 """ | ||
| 14 | return None | ||
| 15 | |||
| 16 | def get_file_items(self, window, files): | ||
| 17 | if len(files) != 1: # we're not supporting multiple files for now | ||
| 18 | return | ||
| 19 | |||
| 20 | file = files[0] | ||
| 21 | |||
| 22 | item = Nautilus.MenuItem( | ||
| 23 | name="MAT2::Remove_metadata", | ||
| 24 | label="Remove metadata from %s" % file.get_name(), | ||
| 25 | tip="Remove metadata from %s" % file.get_name() | ||
| 26 | ) | ||
| 27 | item.connect('activate', self.menu_activate_cb, file) | ||
| 28 | |||
| 29 | return [item] | ||
