summaryrefslogtreecommitdiff
path: root/examples/block-size-column.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/block-size-column.py')
-rw-r--r--examples/block-size-column.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/examples/block-size-column.py b/examples/block-size-column.py
new file mode 100644
index 0000000..6f94158
--- /dev/null
+++ b/examples/block-size-column.py
@@ -0,0 +1,22 @@
+import os
+import urllib
+
+import caja
+
+class ColumnExtension(caja.ColumnProvider, caja.InfoProvider):
+ def __init__(self):
+ pass
+
+ def get_columns(self):
+ return caja.Column("CajaPython::block_size_column",
+ "block_size",
+ "Block size",
+ "Get the block size"),
+
+ def update_file_info(self, file):
+ if file.get_uri_scheme() != 'file':
+ return
+
+ filename = urllib.unquote(file.get_uri()[7:])
+
+ file.add_string_attribute('block_size', str(os.stat(filename).st_blksize))