1. Overview
The TeeJee.Misc module provides general formatting utilities for BastionGuard Backup. It provides locale switching, timestamp generation, duration formatting, HTML escaping, and random-string creation.
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:
GtkTeeJee.LoggingTeeJee.FileSystemTeeJee.ProcessHelper
Key runtime integrations include:
- GTK – graphical widgets, dialogs, images, event processing, or window lifecycle
3. Declared Types
3.1 TeeJee.Misc
namespace TeeJee.Misc
This namespace groups stateless utility functions and shared constants.
4. State, Properties, Constants, and Signals
The file does not maintain mutable object state. Its primary content is constants or stateless helper behavior.
5. Public API and Operational Methods
5.1 set_numeric_locale()
public void set_numeric_locale(string type)
Updates numeric locale and applies the corresponding runtime state.
5.2 timestamp()
public string timestamp (bool show_millis = false)
Implements the timestamp operation for this module.
5.3 timestamp_numeric()
public string timestamp_numeric()
Implements the timestamp numeric operation for this module.
5.4 timestamp_for_path()
public string timestamp_for_path()
Implements the timestamp for path operation for this module.
5.5 format_duration()
public string format_duration (double millis)
Builds a human-readable representation from the current object state.
5.6 escape_html()
public string escape_html(string html)
Escapes the supplied text for safe use in the target representation.
5.7 random_string()
public string random_string(int length = 8, string charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890")
Implements the random string operation for this module.
6. Operational Flow
- Transform raw values, command output, or metadata into structured or display-ready form.
7. Error Handling and Diagnostics
- The module contains data declarations and does not perform an operation that requires local exception handling.
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>
