main.cpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * GnomeSettingsVault - A high-integrity GNOME configuration backup utility.
  3. * Copyright (C) 2026 Nicole Portas, nicole@equalmass.com
  4. */
  5. #include "MainWindow.hpp"
  6. #include <gtkmm/application.h>
  7. #include <gtk/gtk.h>
  8. #include <iostream>
  9. #include <cstdlib>
  10. #include <sys/stat.h>
  11. #include <string>
  12. int main(int argc, char *argv[]) {
  13. // --- Environment Hijack for Fontconfig ---
  14. const char* user = std::getenv("USER");
  15. std::string safe_cache_dir = std::string("/tmp/gnome-vault-cache-") + (user ? user : "default");
  16. mkdir(safe_cache_dir.c_str(), 0777);
  17. setenv("XDG_CACHE_HOME", safe_cache_dir.c_str(), 1);
  18. const std::string app_id = "gnome-vault";
  19. g_set_prgname(app_id.c_str());
  20. g_set_application_name("GnomeSettingsVault");
  21. if (!gtk_init_check(&argc, &argv)) {
  22. std::cerr << "Bloody hell: GTK failed to initialize." << std::endl;
  23. return 1;
  24. }
  25. try {
  26. auto app = Gtk::Application::create(argc, argv, "com.equalmass.gnomevault");
  27. MainWindow window;
  28. // Identity is now handled in MainWindow constructor[cite: 2]
  29. return app->run(window);
  30. } catch (const Glib::Error& ex) {
  31. std::cerr << "GTK Error: " << ex.what() << std::endl;
  32. return 1;
  33. } catch (const std::exception& ex) {
  34. std::cerr << "Standard Exception: " << ex.what() << std::endl;
  35. return 1;
  36. }
  37. }