ScheduleBox

1. Overview

The ScheduleBox module configures snapshot schedules and retention counts.

Its principal responsibilities are:

  • Controls boot, hourly, daily, weekly, and monthly schedules
  • Stores the number of snapshots retained per schedule
  • Configures Cron email suppression
  • Displays the effective scheduling state

2. Class Structure and Dependencies

public class ScheduleBox : Gtk.Box

The source imports:

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

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 principal fields declared by the module include:

  • Gtk.Image img_shield – image used to represent shield
  • Gtk.Label lbl_shield – label used to display shield information
  • Gtk.Label lbl_shield_subnote – label used to display shield subnote information
  • Gtk.SizeGroup sg_title – size group used to align title controls
  • Gtk.SizeGroup sg_subtitle – size group used to align subtitle controls
  • Gtk.SizeGroup sg_count – size group used to align count controls
  • Gtk.CheckButton chk_cron – check button controlling cron
  • Gtk.Window parent_window – parent GTK window used for transient dialogs

4. User Interface Composition

The module directly constructs the following GTK widget types:

  • Gtk.Box – layout containers
  • Gtk.Image – themed icons and state illustrations
  • Gtk.Label – headings, descriptions, and status text
  • Gtk.ScrolledWindow – scrollable content regions
  • Gtk.SizeGroup – consistent alignment across labels and values

Event-driven behavior is connected through signals such as:

toggled
value_changed

5. Initialization

ScheduleBox()

public ScheduleBox(Gtk.Window _parent_window)

Initializes the class instance, creates its GTK controls, and prepares the initial state. It reads or updates central state through App.count_boot, App.count_daily, App.count_hourly, App.count_monthly, App.count_weekly, App.schedule_boot, App.schedule_daily, App.schedule_hourly. It creates Gtk.Box, Gtk.Image, Gtk.Label, Gtk.ScrolledWindow where required. It connects the toggled, value_changed signals.


6. Central Controller Integration

The module reads or modifies the following Main controller members through the global App object:

  • App.count_boot
  • App.count_daily
  • App.count_hourly
  • App.count_monthly
  • App.count_weekly
  • App.schedule_boot
  • App.schedule_daily
  • App.schedule_hourly
  • App.schedule_monthly
  • App.schedule_weekly
  • App.scheduled
  • App.stop_cron_emails

7. Method Reference

set_shield_label()

private void set_shield_label(string text, bool is_bold = true, bool is_italic = false, bool is_large = true)

Sets shield label and updates dependent UI state.

set_shield_subnote()

private void set_shield_subnote(string text, bool is_bold = false, bool is_italic = true, bool is_large = false)

Sets shield subnote and updates dependent UI state.

add_schedule_option()

private void add_schedule_option(Gtk.Box box, string period, string period_desc, out Gtk.CheckButton chk, out Gtk.SpinButton spin)

Adds or constructs schedule option for the current interface or model. It creates Gtk.Box, Gtk.SizeGroup where required.

update_statusbar()

public void update_statusbar()

Updates statusbar to reflect the current state. It reads or updates central state through App.schedule_boot, App.schedule_daily, App.schedule_hourly, App.schedule_monthly, App.schedule_weekly, App.scheduled.


8. External Resources and Paths

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


9. Data and Event Flow

  1. Construct the component and initialize its child controls
  2. React to GTK signals generated by navigation, selections, and action controls
  3. Read or update central backup and restore state through the global controller

10. Runtime and Security Considerations

  • Shared controller state: the component reads and modifies the global App controller used by the surrounding workflow.
  • Signal-driven behavior: GTK callbacks update the model and interface when controls are activated or changed.
  • Schedule persistence: changes can require regeneration of the application Cron configuration.

11. Implementation Considerations

  • Global coupling: the class depends on the process-wide App object rather than receiving a controller through dependency injection.

12. Licensing

The source header contains the following copyright notices:

Copyright 2012-2018 Tony George <teejeetech@gmail.com>

The file is distributed under the GNU General Public License version 2 or later.