1. Overview
The FileItem module provides filesystem item metadata for BastionGuard Backup. It represents a file or directory discovered in an RSYNC log or browser view and loads ownership, permissions, content type, symbolic-link state, timestamps, status, and icons.
The implementation is written in Vala and uses GLib/GIO together with the application utility namespaces required by the file.
2. Dependencies and Integration
The module imports:
GLibGtkGeeJsonTeeJee.LoggingTeeJee.FileSystemTeeJee.JsonHelperTeeJee.ProcessHelperTeeJee.GtkHelperTeeJee.SystemTeeJee.Misc
Key runtime integrations include:
- GTK – graphical widgets, dialogs, images, event processing, or window lifecycle
- JSON-GLib – structured configuration or metadata serialization
- Gee – typed lists, maps, queues, or collection operations
3. Declared Types
3.1 FileItem
public class FileItem : GLib.Object,Gee.Comparable<FileItem>
This class encapsulates the state and operations described by this source file.
4. State, Properties, Constants, and Signals
Public and protected state
public string file_name– Final path component.public string file_location– Filesystem-related value used for file location.public string file_path– Complete filesystem path.public string file_path_prefix– Filesystem-related value used for file path prefix.public FileType file_type– Filesystem-related value used for file type.public DateTime modified– Runtime state used by the module.public string permissions– POSIX permission representation.public string owner_user– Owning user name.public string owner_group– Owning group name.public string content_type– Detected MIME/content type.public string file_status– Filesystem-related value used for file status.public bool is_selected– UI selection state.public bool is_symlink– Whether the entry is a symbolic link.public string symlink_target– Resolved symbolic-link target.public long file_count– Filesystem-related value used for file count.public long dir_count– Filesystem-related value used for dir count.public GLib.Icon icon– Runtime state used by the module.public int64 size– Size or capacity value associated with size.
Internal state
private int64 _size– Size or capacity value associated with size.
5. Public API and Operational Methods
5.1 FileItem()
public FileItem(string name)
Initializes the object state, allocates required collections or widgets, and applies constructor parameters.
5.2 FileItem.from_disk_path_with_basic_info()
public FileItem.from_disk_path_with_basic_info(string _file_path)
Initializes the object state, allocates required collections or widgets, and applies constructor parameters.
5.3 FileItem.from_path_and_type()
public FileItem.from_path_and_type(string _file_path, FileType _file_type)
Initializes the object state, allocates required collections or widgets, and applies constructor parameters.
5.4 compare_to()
public int compare_to(FileItem b)
Compares two objects to provide deterministic sorting behavior.
5.5 query_file_info()
public void query_file_info()
Loads detailed GIO metadata for the represented path, including type, timestamps, ownership, permissions, content type, size, and symbolic-link details.
- Catches runtime errors locally and reports them through the logging layer or return value.
5.6 query_file_info_basic()
public void query_file_info_basic()
Queries file info basic and refreshes the associated object state.
- Catches runtime errors locally and reports them through the logging layer or return value.
5.7 get_icon()
public Gdk.Pixbuf? get_icon(int icon_size, bool add_transparency, bool add_emblems)
Resolves an icon from GIO content metadata and optionally adds transparency and status emblems before returning a pixbuf.
6. Operational Flow
- Read or discover source data and normalize it into the module data model.
7. Error Handling and Diagnostics
- GLib and filesystem exceptions are caught locally in the operations that can fail.
- The TeeJee logging layer records errors, debug state, generated commands, and operational messages.
8. Runtime and Security Considerations
- Error handling: callers should inspect nullable returns and Boolean status values because utility methods generally log failures instead of throwing them further.
9. Licensing
The source is distributed under the GNU General Public License version 2 or any later version.
The source header identifies:
Copyright 2012-2018 Tony George <teejeetech@gmail.com>
