You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Either change the avatar storage permantly to .cache or add option in GUI for user to do so.
Reasoning for privacy or distro specific like using Dino on TailsOS. Or for users that have .cache mounted to tmpfs. Most XMPP client aplications stores avatars in .cache.
Step 1: Modify avatar_manager.vala
publicclassAvatarManager {
privatestring avatar_directory;
publicAvatarManager() {
// Change the path to store avatars in .cache instead of .local/share
avatar_directory =GLib.get_home_dir() +"/.cache/dino/avatars";
// Ensure the directory existsGLib.file_test(avatar_directory, GLib.FileTest.IS_DIR) ||GLib.mkdir(avatar_directory, 0755);
}
publicvoidsave_avatar(stringuser_id, Imageavatar) {
string avatar_path = avatar_directory +"/"+ user_id +".png";
// Save the avatar image to the new path
avatar.save(avatar_path);
}
publicImageload_avatar(stringuser_id) {
string avatar_path = avatar_directory +"/"+ user_id +".png";
// Load the avatar image from the new pathreturnImage.load(avatar_path);
}
}
Step 2: Update GUI Options settings.vala
publicclassSettingsWindow:Gtk.Window {
privateGtk.CheckButton cache_option;
privatebool use_cache;
publicSettingsWindow() {
// Initialize the settings windowthis.title ="Settings";
this.set_default_size(400, 300);
// Create a vertical box to hold the settingsvar vbox =newGtk.Box(Gtk.Orientation.VERTICAL, 10);
this.add(vbox);
// Create a checkbox for the cache option
cache_option =newGtk.CheckButton.with_label("Store avatars in .cache");
// Load the current setting (default to false if not set)
use_cache = load_use_cache_setting();
cache_option.set_active(use_cache);
// Connect the toggle signal to update the storage path
cache_option.signal_toggled().connect(() => {
use_cache = cache_option.get_active();
update_avatar_storage_path(use_cache);
save_use_cache_setting(use_cache);
});
// Add the checkbox to the settings window
vbox.append(cache_option);
// Add a button to close the settings windowvar close_button =newGtk.Button.with_label("Close");
close_button.signal_clicked().connect(() => {
this.close();
});
vbox.append(close_button);
}
privateboolload_use_cache_setting() {
// Load the setting from a configuration file or use a default value// This is a placeholder; implement actual loading logicreturnfalse; // Default to false (not using cache)
}
privatevoidsave_use_cache_setting(booluse_cache) {
// Save the setting to a configuration file// This is a placeholder; implement actual saving logic
}
privatevoidupdate_avatar_storage_path(booluse_cache) {
if (use_cache) {
AvatarManager.set_storage_path(GLib.get_home_dir() +"/.cache/dino/avatars");
} else {
AvatarManager.set_storage_path(GLib.get_home_dir() +"/.local/share/dino/avatars");
}
}
}
(or like this):
publicclassSettingsWindow:Gtk.Window {
privateGtk.CheckButton cache_option;
publicSettingsWindow() {
// Create a checkbox for the cache option
cache_option =newGtk.CheckButton.with_label("Store avatars in .cache");
cache_option.set_active(true); // Default to true// Connect the toggle signal to update the storage path
cache_option.signal_toggled().connect(() => {
if (cache_option.get_active()) {
// Update the avatar manager to use .cacheAvatarManager.set_storage_path(GLib.get_home_dir() +"/.cache/dino/avatars");
} else {
// Revert to the default pathAvatarManager.set_storage_path(GLib.get_home_dir() +"/.local/share/dino/avatars");
}
});
// Add the checkbox to the settings windowthis.add(cache_option);
}
}
The text was updated successfully, but these errors were encountered:
Either change the avatar storage permantly to .cache or add option in GUI for user to do so.
Reasoning for privacy or distro specific like using Dino on TailsOS. Or for users that have .cache mounted to tmpfs. Most XMPP client aplications stores avatars in .cache.
Step 1: Modify
avatar_manager.vala
Step 2: Update GUI Options
settings.vala
(or like this):
The text was updated successfully, but these errors were encountered: