Skip to content

Commit

Permalink
Replace CONST_* with *::CONST
Browse files Browse the repository at this point in the history
  • Loading branch information
fengalin authored and bilelmoussaoui committed Nov 4, 2021
1 parent a1c9efe commit 50f3384
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions examples/clipboard/main.rs
Expand Up @@ -64,7 +64,7 @@ fn build_ui(application: &gtk::Application) {

let paste_btn = gtk::Button::with_label("Paste");
paste_btn.connect_clicked(clone!(@weak clipboard, @weak into_entry => move |_btn| {
clipboard.read_text_async(gio::NONE_CANCELLABLE, clone!(@weak into_entry => move|res| {
clipboard.read_text_async(gio::Cancellable::NONE, clone!(@weak into_entry => move|res| {
if let Ok(Some(text)) = res {
into_entry.set_text(&text);
}
Expand Down Expand Up @@ -115,7 +115,7 @@ fn build_ui(application: &gtk::Application) {
.valign(gtk::Align::Center)
.build();
paste_texture_btn.connect_clicked(clone!(@weak clipboard => move |_btn| {
clipboard.read_texture_async(gio::NONE_CANCELLABLE, clone!(@weak image_into => move |res| {
clipboard.read_texture_async(gio::Cancellable::NONE, clone!(@weak image_into => move |res| {
if let Ok(Some(texture)) = res {
image_into.set_paintable(Some(&texture));
}
Expand Down
2 changes: 1 addition & 1 deletion examples/video_player/video_player_window/imp.rs
Expand Up @@ -19,7 +19,7 @@ impl ObjectSubclass for VideoPlayerWindow {
fn new() -> Self {
let dialog = gtk::FileChooserNative::new(
Some("Open File"),
gtk::NONE_WINDOW,
gtk::Window::NONE,
gtk::FileChooserAction::Open,
Some("Open"),
Some("Cancel"),
Expand Down
4 changes: 2 additions & 2 deletions gdk4/src/event.rs
Expand Up @@ -19,8 +19,6 @@ glib::wrapper! {
}
}

pub const NONE_EVENT: Option<&Event> = None;

impl StaticType for Event {
#[doc(alias = "gdk_event_get_type")]
fn static_type() -> Type {
Expand All @@ -29,6 +27,8 @@ impl StaticType for Event {
}

impl Event {
pub const NONE: Option<&'static Event> = None;

pub fn downcast<T: EventKind>(self) -> Result<T, Event> {
unsafe {
if T::event_types().contains(&self.event_type()) {
Expand Down
2 changes: 1 addition & 1 deletion gdk4/src/lib.rs
Expand Up @@ -107,7 +107,7 @@ pub use crossing_event::CrossingEvent;
pub use delete_event::DeleteEvent;
pub use display::Backend;
pub use dnd_event::DNDEvent;
pub use event::{Event, EventKind, NONE_EVENT};
pub use event::{Event, EventKind};
pub use focus_event::FocusEvent;
pub use grab_broken_event::GrabBrokenEvent;
pub use key_event::KeyEvent;
Expand Down
2 changes: 1 addition & 1 deletion gsk4/src/lib.rs
Expand Up @@ -93,7 +93,7 @@ pub use opacity_node::OpacityNode;
pub use outset_shadow_node::OutsetShadowNode;
pub use parse_location::ParseLocation;
pub use radial_gradient_node::RadialGradientNode;
pub use render_node::{IsRenderNode, RenderNode, NONE_RENDER_NODE};
pub use render_node::{IsRenderNode, RenderNode};
pub use repeat_node::RepeatNode;
pub use repeating_linear_gradient_node::RepeatingLinearGradientNode;
pub use repeating_radial_gradient_node::RepeatingRadialGradientNode;
Expand Down
4 changes: 2 additions & 2 deletions gsk4/src/render_node.rs
Expand Up @@ -27,6 +27,8 @@ impl StaticType for RenderNode {
}

impl RenderNode {
pub const NONE: Option<&'static RenderNode> = None;

#[doc(alias = "gsk_render_node_deserialize")]
pub fn deserialize(bytes: &glib::Bytes) -> Option<Self> {
assert_initialized_main_thread!();
Expand Down Expand Up @@ -154,8 +156,6 @@ pub unsafe trait IsRenderNode:
fn upcast_ref(&self) -> &RenderNode;
}

pub const NONE_RENDER_NODE: Option<&RenderNode> = None;

impl fmt::Display for RenderNode {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.write_str("RenderNode")
Expand Down
4 changes: 2 additions & 2 deletions gtk4/src/expression.rs
Expand Up @@ -30,8 +30,6 @@ impl AsRef<Expression> for Expression {
}
}

pub const NONE_EXPRESSION: Option<&Expression> = None;

// rustdoc-stripper-ignore-next
/// A common trait implemented by the various [`gtk::Expression`] types.
///
Expand All @@ -44,6 +42,8 @@ pub unsafe trait IsExpression:
}

impl Expression {
pub const NONE: Option<&'static Expression> = None;

pub fn downcast<E: IsExpression>(self) -> Result<E, Expression> {
unsafe {
if self.type_() == E::static_type() {
Expand Down
2 changes: 1 addition & 1 deletion gtk4/src/lib.rs
Expand Up @@ -200,7 +200,7 @@ pub use closure_expression::ClosureExpression;
pub use constant_expression::ConstantExpression;
pub use css_location::CssLocation;
pub use directory_list::DirectoryListBuilder;
pub use expression::{Expression, NONE_EXPRESSION};
pub use expression::Expression;
pub use expression_watch::ExpressionWatch;
pub use functions::*;
pub use glib::signal::Inhibit;
Expand Down
4 changes: 2 additions & 2 deletions gtk4/src/property_expression.rs
Expand Up @@ -76,15 +76,15 @@ impl PropertyExpression {
#[cfg(test)]
mod tests {
use super::*;
use crate::{test_synced, NONE_EXPRESSION};
use crate::test_synced;
use glib::StaticType;

#[test]
fn test_property_expression() {
test_synced(move || {
let _prop_expr = PropertyExpression::new(
crate::StringObject::static_type(),
NONE_EXPRESSION,
crate::Expression::NONE,
"string",
);
});
Expand Down

0 comments on commit 50f3384

Please sign in to comment.