HeaderFactory

1. Overview

The HeaderFactory module creates a reusable application header bar.

Its principal responsibilities are:

  • Builds a consistent GTK header layout
  • Provides a title area and close action
  • Centralizes header dimensions and styling

2. Class Structure and Dependencies

public class HeaderFactory : Object

The source imports:

  • Gtk

The GTK inheritance and imported modules allow the component to participate in the application event loop, share the central backup state, and construct native GTK4 controls.


3. Primary Runtime State

The class is stateless and exposes its behavior through helper methods.


4. User Interface Composition

The module directly constructs the following GTK widget types:

  • Gtk.Box – layout containers
  • Gtk.Button – action and navigation buttons
  • Gtk.HeaderBar – window title and header actions

Event-driven behavior is connected through signals such as:

clicked

5. Initialization

The file does not expose an instance constructor beyond the default object initialization path.


6. Central Controller Integration

The module does not directly access the global App controller and instead operates through its own inputs or child objects.


7. Method Reference

create_main_headerbar()

public static Gtk.HeaderBar create_main_headerbar(Gtk.Window win, int left_width = 215)

Creates main headerbar required by the workflow. It creates Gtk.Box, Gtk.Button, Gtk.HeaderBar where required. It connects the clicked signal.


8. External Resources and Paths

The component does not directly define protected filesystem paths or external command strings.


9. Data and Event Flow

  1. React to GTK signals generated by navigation, selections, and action controls

10. Runtime and Security Considerations

  • Signal-driven behavior: GTK callbacks update the model and interface when controls are activated or changed.

11. Implementation Considerations

  • State synchronization: refresh and save methods must keep visible controls consistent with the underlying application model.

12. Licensing

The applicable licensing terms are defined by the source-file header and the containing BastionGuard Backup project.