Browse Source

utils: Rename DummyObject to PlaceholderObject

"dummy" can be viewed as offensive
merge-requests/1958/merge
Kévin Commaille 11 months ago
parent
commit
93ccda449f
No known key found for this signature in database
GPG Key ID: C971D9DBC9D678D
  1. 4
      src/session/view/account_settings/notifications_page.rs
  2. 4
      src/session/view/content/room_details/addresses_subpage/mod.rs
  3. 5
      src/utils/mod.rs
  4. 21
      src/utils/placeholder_object.rs

4
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::<glib::Object>();
all_items.append(&settings.keywords_list());

4
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::<glib::Object>();

5
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,
};

21
src/utils/dummy_object.rs → 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<String>,
}
#[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<imp::DummyObject>);
/// 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<imp::PlaceholderObject>);
}
impl DummyObject {
impl PlaceholderObject {
pub fn new(id: &str) -> Self {
glib::Object::builder().property("id", id).build()
}
Loading…
Cancel
Save