mirror of
https://gitlab.freedesktop.org/dabrain34/GstPipelineStudio.git
synced 2024-11-25 10:30:59 +00:00
settings: remove get prefix
Remove "get_" whenever possible
This commit is contained in:
parent
435e7bfd0d
commit
16fee2a289
2 changed files with 7 additions and 7 deletions
|
@ -30,7 +30,7 @@ pub struct Settings {
|
||||||
|
|
||||||
impl Settings {
|
impl Settings {
|
||||||
fn settings_file_exist() {
|
fn settings_file_exist() {
|
||||||
let s = Settings::get_settings_file_path();
|
let s = Settings::settings_file_path();
|
||||||
|
|
||||||
if !s.exists() {
|
if !s.exists() {
|
||||||
if let Some(parent_dir) = s.parent() {
|
if let Some(parent_dir) = s.parent() {
|
||||||
|
@ -47,7 +47,7 @@ impl Settings {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_settings_file_path() -> PathBuf {
|
fn settings_file_path() -> PathBuf {
|
||||||
let mut path = glib::user_config_dir();
|
let mut path = glib::user_config_dir();
|
||||||
path.push(config::APP_ID);
|
path.push(config::APP_ID);
|
||||||
path.push("settings.toml");
|
path.push("settings.toml");
|
||||||
|
@ -80,7 +80,7 @@ impl Settings {
|
||||||
Settings::save_settings(&settings);
|
Settings::save_settings(&settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_favorites_list() -> Vec<String> {
|
pub fn favorites_list() -> Vec<String> {
|
||||||
let mut favorites = Vec::new();
|
let mut favorites = Vec::new();
|
||||||
let settings = Settings::load_settings();
|
let settings = Settings::load_settings();
|
||||||
for fav in settings.favorites {
|
for fav in settings.favorites {
|
||||||
|
@ -92,7 +92,7 @@ impl Settings {
|
||||||
// Save the provided settings to the settings path
|
// Save the provided settings to the settings path
|
||||||
pub fn save_settings(settings: &Settings) {
|
pub fn save_settings(settings: &Settings) {
|
||||||
Settings::settings_file_exist();
|
Settings::settings_file_exist();
|
||||||
let s = Settings::get_settings_file_path();
|
let s = Settings::settings_file_path();
|
||||||
if let Err(e) = serde_any::to_file(&s, settings) {
|
if let Err(e) = serde_any::to_file(&s, settings) {
|
||||||
GPS_ERROR!("Error while trying to save file: {} {}", s.display(), e);
|
GPS_ERROR!("Error while trying to save file: {} {}", s.display(), e);
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ impl Settings {
|
||||||
|
|
||||||
// Load the current settings
|
// Load the current settings
|
||||||
pub fn load_settings() -> Settings {
|
pub fn load_settings() -> Settings {
|
||||||
let s = Settings::get_settings_file_path();
|
let s = Settings::settings_file_path();
|
||||||
if s.exists() && s.is_file() {
|
if s.exists() && s.is_file() {
|
||||||
match serde_any::from_file::<Settings, _>(&s) {
|
match serde_any::from_file::<Settings, _>(&s) {
|
||||||
Ok(s) => s,
|
Ok(s) => s,
|
||||||
|
|
|
@ -19,7 +19,7 @@ use gtk::{gio, glib};
|
||||||
pub fn reset_favorite_list(favorite_list: &TreeView) {
|
pub fn reset_favorite_list(favorite_list: &TreeView) {
|
||||||
let model = ListStore::new(&[String::static_type()]);
|
let model = ListStore::new(&[String::static_type()]);
|
||||||
favorite_list.set_model(Some(&model));
|
favorite_list.set_model(Some(&model));
|
||||||
let favorites = Settings::get_favorites_list();
|
let favorites = Settings::favorites_list();
|
||||||
for favorite in favorites {
|
for favorite in favorites {
|
||||||
model.insert_with_values(None, &[(0, &favorite)]);
|
model.insert_with_values(None, &[(0, &favorite)]);
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ pub fn setup_favorite_list(app: &GPSApp) {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_to_favorite_list(app: &GPSApp, element_name: String) {
|
pub fn add_to_favorite_list(app: &GPSApp, element_name: String) {
|
||||||
let mut favorites = Settings::get_favorites_list();
|
let mut favorites = Settings::favorites_list();
|
||||||
favorites.sort();
|
favorites.sort();
|
||||||
if !favorites.contains(&element_name) {
|
if !favorites.contains(&element_name) {
|
||||||
let favorite_list: TreeView = app
|
let favorite_list: TreeView = app
|
||||||
|
|
Loading…
Reference in a new issue