From 93ccda449f13a7235d7cdb44ee31bdde64445757 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Commaille?= Date: Thu, 10 Apr 2025 09:43:48 +0200 Subject: [PATCH] utils: Rename DummyObject to PlaceholderObject "dummy" can be viewed as offensive --- .../account_settings/notifications_page.rs | 4 ++-- .../room_details/addresses_subpage/mod.rs | 4 ++-- src/utils/mod.rs | 5 +++-- ...{dummy_object.rs => placeholder_object.rs} | 21 ++++++++++--------- 4 files changed, 18 insertions(+), 16 deletions(-) rename src/utils/{dummy_object.rs => placeholder_object.rs} (52%) diff --git a/src/session/view/account_settings/notifications_page.rs b/src/session/view/account_settings/notifications_page.rs index f6b9defd..47f6f9c5 100644 --- a/src/session/view/account_settings/notifications_page.rs +++ b/src/session/view/account_settings/notifications_page.rs @@ -8,7 +8,7 @@ use crate::{ i18n::gettext_f, session::model::{NotificationsGlobalSetting, NotificationsSettings}, spawn, toast, - utils::{BoundObjectWeakRef, DummyObject, SingleItemListModel}, + utils::{BoundObjectWeakRef, PlaceholderObject, SingleItemListModel}, }; mod imp { @@ -123,7 +123,7 @@ mod imp { ], ); - let extra_items = SingleItemListModel::new(&DummyObject::new("add")); + let extra_items = SingleItemListModel::new(&PlaceholderObject::new("add")); let all_items = gio::ListStore::new::(); all_items.append(&settings.keywords_list()); diff --git a/src/session/view/content/room_details/addresses_subpage/mod.rs b/src/session/view/content/room_details/addresses_subpage/mod.rs index 2337ba14..b8f40654 100644 --- a/src/session/view/content/room_details/addresses_subpage/mod.rs +++ b/src/session/view/content/room_details/addresses_subpage/mod.rs @@ -14,7 +14,7 @@ use crate::{ prelude::*, session::model::{AddAltAliasError, RegisterLocalAliasError, Room}, spawn, toast, - utils::{DummyObject, SingleItemListModel}, + utils::{PlaceholderObject, SingleItemListModel}, }; mod imp { @@ -83,7 +83,7 @@ mod imp { fn constructed(&self) { self.parent_constructed(); - let add_item = SingleItemListModel::new(&DummyObject::new("add")); + let add_item = SingleItemListModel::new(&PlaceholderObject::new("add")); // Public addresses. let public_items = gio::ListStore::new::(); diff --git a/src/utils/mod.rs b/src/utils/mod.rs index 7f4b2b1f..90ec4f66 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -18,15 +18,16 @@ use gtk::{gio, glib, prelude::*}; use regex::Regex; use tempfile::NamedTempFile; -mod dummy_object; pub(crate) mod expression; mod expression_list_model; +mod grouping_list_model; pub(crate) mod key_bindings; mod location; mod macros; pub(crate) mod matrix; pub(crate) mod media; pub(crate) mod notifications; +mod placeholder_object; mod single_item_list_model; pub(crate) mod sourceview; pub(crate) mod string; @@ -34,9 +35,9 @@ mod template_callbacks; pub(crate) mod toast; pub(crate) use self::{ - dummy_object::DummyObject, expression_list_model::ExpressionListModel, location::{Location, LocationError, LocationExt}, + placeholder_object::PlaceholderObject, single_item_list_model::SingleItemListModel, template_callbacks::TemplateCallbacks, }; diff --git a/src/utils/dummy_object.rs b/src/utils/placeholder_object.rs similarity index 52% rename from src/utils/dummy_object.rs rename to src/utils/placeholder_object.rs index 7d12a52b..4648814c 100644 --- a/src/utils/dummy_object.rs +++ b/src/utils/placeholder_object.rs @@ -6,31 +6,32 @@ mod imp { use super::*; #[derive(Debug, Default, glib::Properties)] - #[properties(wrapper_type = super::DummyObject)] - pub struct DummyObject { + #[properties(wrapper_type = super::PlaceholderObject)] + pub struct PlaceholderObject { /// The identifier of this item. #[property(get, set)] id: RefCell, } #[glib::object_subclass] - impl ObjectSubclass for DummyObject { - const NAME: &'static str = "DummyObject"; - type Type = super::DummyObject; + impl ObjectSubclass for PlaceholderObject { + const NAME: &'static str = "PlaceholderObject"; + type Type = super::PlaceholderObject; } #[glib::derived_properties] - impl ObjectImpl for DummyObject {} + impl ObjectImpl for PlaceholderObject {} } glib::wrapper! { - /// A dummy GObject. + /// A GObject to use as a placeholder. /// - /// It can be used for example to add extra widgets in a list model and can be identified with its ID. - pub struct DummyObject(ObjectSubclass); + /// It can be used for example to add extra widgets in a list model and can + /// be identified with its ID. + pub struct PlaceholderObject(ObjectSubclass); } -impl DummyObject { +impl PlaceholderObject { pub fn new(id: &str) -> Self { glib::Object::builder().property("id", id).build() }