OSDNotify

1. Overview

The OSDNotify module provides desktop notification delivery for BastionGuard Backup. It wraps notify-send capability detection and emits desktop notifications with duration, urgency, and icon selection.

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:

  • TeeJee.Logging
  • TeeJee.FileSystem
  • TeeJee.ProcessHelper

3. Declared Types

3.1 OSDNotify

public class OSDNotify : GLib.Object

This class encapsulates the state and operations described by this source file.


4. State, Properties, Constants, and Signals

Public and protected state

  • public const int NOTIFICATION_INTERVAL – Compile-time constant used by this module.

Internal state

  • private static DateTime dt_last_notification – Runtime state used by the module.

5. Public API and Operational Methods

5.1 notify_send()

public static int notify_send ( string title, string message, int durationMillis, string urgency = "low", string dialog_type = "info" )

Constructs and executes a notify-send command with timeout, urgency, and icon parameters.

  • Uses asynchronous callbacks, child watches, or worker-thread behavior.

5.2 is_supported()

public static bool is_supported()

Evaluates is supported and returns a Boolean capability or state result.


6. External Commands and System Interfaces

The module constructs, checks, or parses commands containing:

notify-send
notify-send -t %d -u %s -i %s \"%s\" \"%s\" -h %s

Execution success is determined from command exit status and, where applicable, parsed standard output or standard error.


7. Operational Flow

  1. Apply the requested operation and update runtime or persistent state.

8. Error Handling and Diagnostics

  • The module contains data declarations and does not perform an operation that requires local exception handling.

9. Runtime and Security Considerations

  • Concurrency: callbacks and worker state must remain synchronized with object destruction and GTK main-loop ownership.
  • Shared state: static caches and global switches are shared by all callers and are not automatically thread-isolated.

10. 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>