| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- /*
- * GnomeSettingsVault - A GNOME configuration backup utility.
- * Copyright (C) 2026 Nicole Portas, nicole@equalmass.com
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- */
- #pragma once
- #include <gtkmm.h>
- #include <string>
- #include <fstream>
- #include <thread>
- #include <mutex>
- #include <queue>
- #include <atomic>
- struct JobConfig {
- bool themes;
- bool icons;
- bool wallpapers;
- bool extensions;
- bool dconf;
- bool dry_run;
- std::string vault_name;
- std::string custom_restore_path;
- };
- class MainWindow : public Gtk::Window {
- public:
- MainWindow();
- virtual ~MainWindow();
- private:
- Gtk::HeaderBar m_HeaderBar;
- Gtk::Box m_MainLayout;
- Gtk::Notebook m_Notebook;
- Gtk::ScrolledWindow m_ScrolledWindow;
- Gtk::TextView m_LogView;
- Glib::RefPtr<Gtk::TextBuffer> m_RefTextBuffer;
-
- Gtk::Box m_BottomBox;
- Gtk::Label m_StatusLabel;
- Gtk::CheckButton m_CheckDebugMode;
- Gtk::Box m_VBoxBackup;
- Gtk::Label m_LabelBackupInstruction;
- Gtk::CheckButton m_CheckThemesBackup;
- Gtk::CheckButton m_CheckIconsBackup;
- Gtk::CheckButton m_CheckWallpapersBackup;
- Gtk::CheckButton m_CheckExtensionsBackup;
- Gtk::CheckButton m_CheckDconfBackup;
- Gtk::Button m_ButtonBackup;
- Gtk::Box m_VBoxRestore;
- Gtk::Label m_LabelRestoreInstruction;
- Gtk::Button m_ButtonSelectVault;
- Gtk::Label m_LabelSelectedVault;
- Gtk::CheckButton m_CheckThemesRestore;
- Gtk::CheckButton m_CheckIconsRestore;
- Gtk::CheckButton m_CheckWallpapersRestore;
- Gtk::CheckButton m_CheckExtensionsRestore;
- Gtk::CheckButton m_CheckDconfRestore;
- Gtk::CheckButton m_CheckDryRunRestore;
- Gtk::Button m_ButtonRestore;
- Glib::Dispatcher m_Dispatcher;
- std::mutex m_LogMutex;
- std::queue<std::string> m_LogQueue;
- std::atomic<bool> m_WorkerRunning;
- std::atomic<bool> m_JobSuccess;
- std::atomic<bool> m_IsDebugMode;
- std::atomic<bool> m_LastJobWasRestore;
- std::string m_SelectedVaultPath;
- void on_button_backup_clicked();
- void on_button_restore_clicked();
- void on_button_select_vault_clicked();
- void on_dispatcher_ping();
- void add_log_ui(const std::string& message);
- void set_ui_locked(bool locked);
- void queue_log(const std::string& message);
- void scan_vault_contents(const std::string& path);
- void run_backup_job(JobConfig config, std::string home_dir);
- void run_restore_job(JobConfig config, std::string home_dir);
- bool create_tar_archive(const std::string& source_dir, const std::string& out_filename, bool strip_path);
- bool extract_tar_archive(const std::string& archive_path, const std::string& dest_dir, bool dry_run, bool use_absolute);
- std::string get_wallpaper_directory();
- };
|