CustomMessageDialog

1. Overview

The CustomMessageDialog module provides custom GTK message dialog for BastionGuard Backup. It renders configurable informational, warning, question, or error messages with GTK response buttons and a synchronous modal run helper.

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:

  • Gtk
  • Gee
  • TeeJee.Logging
  • TeeJee.FileSystem
  • TeeJee.JsonHelper
  • TeeJee.ProcessHelper
  • TeeJee.GtkHelper
  • TeeJee.System
  • TeeJee.Misc

Key runtime integrations include:

  • GTK – graphical widgets, dialogs, images, event processing, or window lifecycle

3. Declared Types

3.1 CustomMessageDialog

public class CustomMessageDialog : Gtk.Dialog

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


4. State, Properties, Constants, and Signals

Internal state

  • private Gtk.Box vbox_main – GTK/VTE presentation object retained by the component.
  • private Gtk.Label lbl_msg – GTK/VTE presentation object retained by the component.
  • private Gtk.ScrolledWindow sw_msg – GTK/VTE presentation object retained by the component.
  • private Gtk.Button btn_ok – GTK/VTE presentation object retained by the component.
  • private Gtk.Button btn_cancel – GTK/VTE presentation object retained by the component.
  • private Gtk.Button btn_yes – GTK/VTE presentation object retained by the component.
  • private Gtk.Button btn_no – GTK/VTE presentation object retained by the component.
  • private string msg_title – Runtime state used by the module.
  • private string msg_body – Runtime state used by the module.
  • private Gtk.MessageType msg_type – GTK/VTE presentation object retained by the component.
  • private Gtk.ButtonsType buttons_type – GTK/VTE presentation object retained by the component.

5. Public API and Operational Methods

5.1 CustomMessageDialog()

public CustomMessageDialog(string _msg_title, string _msg_body, Gtk.MessageType _msg_type, Window? parent, Gtk.ButtonsType _buttons_type)

Initializes the object state, allocates required collections or widgets, and applies constructor parameters.

5.2 init_window()

public void init_window ()

Initializes window and prepares it for use.

  • Interacts with GTK/VTE objects and must execute UI changes on the graphical main context.

5.3 run()

public int run()

Presents the dialog and returns the selected GTK response through a local modal main loop.

  • Interacts with GTK/VTE objects and must execute UI changes on the graphical main context.

6. Operational Flow

  1. Initialize object state, widgets, regular expressions, paths, or generated scripts.

7. Error Handling and Diagnostics

  • Boolean, nullable, or empty-string return values communicate recoverable failures to callers.

8. Runtime and Security Considerations

  • GTK lifecycle: widgets and local main loops require a valid graphical context and careful close/destroy handling.

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>