| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- /*
- * GnomeSettingsVault - A high-integrity GNOME configuration backup utility.
- * Copyright (C) 2026 Nicole Portas, nicole@equalmass.com
- */
- #include "MainWindow.hpp"
- #include <gtkmm/application.h>
- #include <gtk/gtk.h>
- #include <iostream>
- #include <cstdlib>
- #include <sys/stat.h>
- #include <string>
- int main(int argc, char *argv[]) {
- // --- Environment Hijack for Fontconfig ---
- // This prevents font cache collisions in restricted environments
- const char* user = std::getenv("USER");
- std::string safe_cache_dir = std::string("/tmp/gnome-vault-cache-") + (user ? user : "default");
- mkdir(safe_cache_dir.c_str(), 0777);
- setenv("XDG_CACHE_HOME", safe_cache_dir.c_str(), 1);
- // --- Identity Setup ---
- // IMPORTANT: This string MUST match the 'StartupWMClass' in your .desktop file
- // and ideally the 'Exec' binary name to ensure the icon pins correctly.
- const std::string app_id = "gnome-vault";
-
- g_set_prgname(app_id.c_str());
- g_set_application_name("GnomeSettingsVault");
- if (!gtk_init_check(&argc, &argv)) {
- std::cerr << "Bloody hell: GTK failed to initialize." << std::endl;
- return 1;
- }
- try {
- // We use a reverse-DNS style ID for the Application object,
- // but the WMClass is handled by the prgname set above.
- auto app = Gtk::Application::create(argc, argv, "com.equalmass.gnomevault");
-
- MainWindow window;
-
- // Final hammer blow to ensure the window is identified correctly
- window.set_wmclass(app_id, "GnomeSettingsVault");
- return app->run(window);
- } catch (const Glib::Error& ex) {
- std::cerr << "GTK Error: " << ex.what() << std::endl;
- return 1;
- } catch (const std::exception& ex) {
- std::cerr << "Standard Exception: " << ex.what() << std::endl;
- return 1;
- }
- }
|