Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix builders #764

Merged
merged 7 commits into from May 15, 2019

Conversation

Projects
None yet
2 participants
@EPashkin
Copy link
Member

commented May 14, 2019

Part of #763
Makes minor fixes after #757

cc @antoyo

@EPashkin EPashkin force-pushed the EPashkin:fix_builders branch from 47440c9 to bd50579 May 14, 2019

@EPashkin

This comment has been minimized.

Copy link
Member Author

commented May 14, 2019

Now builder's build looks like this:

    pub fn build(self) -> Viewport {
        let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
        if let Some(ref shadow_type) = self.shadow_type {
            properties.push(("shadow-type", shadow_type));
        }
        if let Some(ref border_width) = self.border_width {
            properties.push(("border-width", border_width));
        }
        if let Some(ref child) = self.child {
            properties.push(("child", child));
        }
        if let Some(ref resize_mode) = self.resize_mode {
            properties.push(("resize-mode", resize_mode));
        }
        if let Some(ref app_paintable) = self.app_paintable {
            properties.push(("app-paintable", app_paintable));
        }
        if let Some(ref can_default) = self.can_default {
            properties.push(("can-default", can_default));
        }
        if let Some(ref can_focus) = self.can_focus {
            properties.push(("can-focus", can_focus));
        }
        if let Some(ref events) = self.events {
            properties.push(("events", events));
        }
        if let Some(ref expand) = self.expand {
            properties.push(("expand", expand));
        }
        #[cfg(any(feature = "v3_20", feature = "dox"))]
        {
            if let Some(ref focus_on_click) = self.focus_on_click {
                properties.push(("focus-on-click", focus_on_click));
            }
        }
        if let Some(ref halign) = self.halign {
            properties.push(("halign", halign));
        }
        if let Some(ref has_default) = self.has_default {
            properties.push(("has-default", has_default));
        }
        if let Some(ref has_focus) = self.has_focus {
            properties.push(("has-focus", has_focus));
        }
        if let Some(ref has_tooltip) = self.has_tooltip {
            properties.push(("has-tooltip", has_tooltip));
        }
        if let Some(ref height_request) = self.height_request {
            properties.push(("height-request", height_request));
        }
        if let Some(ref hexpand) = self.hexpand {
            properties.push(("hexpand", hexpand));
        }
        if let Some(ref hexpand_set) = self.hexpand_set {
            properties.push(("hexpand-set", hexpand_set));
        }
        if let Some(ref is_focus) = self.is_focus {
            properties.push(("is-focus", is_focus));
        }
        if let Some(ref margin) = self.margin {
            properties.push(("margin", margin));
        }
        if let Some(ref margin_bottom) = self.margin_bottom {
            properties.push(("margin-bottom", margin_bottom));
        }
        if let Some(ref margin_end) = self.margin_end {
            properties.push(("margin-end", margin_end));
        }
        if let Some(ref margin_start) = self.margin_start {
            properties.push(("margin-start", margin_start));
        }
        if let Some(ref margin_top) = self.margin_top {
            properties.push(("margin-top", margin_top));
        }
        if let Some(ref name) = self.name {
            properties.push(("name", name));
        }
        if let Some(ref no_show_all) = self.no_show_all {
            properties.push(("no-show-all", no_show_all));
        }
        if let Some(ref opacity) = self.opacity {
            properties.push(("opacity", opacity));
        }
        if let Some(ref parent) = self.parent {
            properties.push(("parent", parent));
        }
        if let Some(ref receives_default) = self.receives_default {
            properties.push(("receives-default", receives_default));
        }
        if let Some(ref sensitive) = self.sensitive {
            properties.push(("sensitive", sensitive));
        }
        if let Some(ref tooltip_markup) = self.tooltip_markup {
            properties.push(("tooltip-markup", tooltip_markup));
        }
        if let Some(ref tooltip_text) = self.tooltip_text {
            properties.push(("tooltip-text", tooltip_text));
        }
        if let Some(ref valign) = self.valign {
            properties.push(("valign", valign));
        }
        if let Some(ref vexpand) = self.vexpand {
            properties.push(("vexpand", vexpand));
        }
        if let Some(ref vexpand_set) = self.vexpand_set {
            properties.push(("vexpand-set", vexpand_set));
        }
        if let Some(ref visible) = self.visible {
            properties.push(("visible", visible));
        }
        if let Some(ref width_request) = self.width_request {
            properties.push(("width-request", width_request));
        }
        crate::Object::new(Viewport::static_type(), &properties).expect("object new").downcast().expect("downcast")
    }

@EPashkin EPashkin force-pushed the EPashkin:fix_builders branch from bd50579 to 7fbc5ba May 14, 2019

@EPashkin EPashkin force-pushed the EPashkin:fix_builders branch from e803e4b to 85e7945 May 14, 2019

@EPashkin EPashkin force-pushed the EPashkin:fix_builders branch from a0dde2a to d60b7ff May 14, 2019

None => continue,
};

let new_builder_properties = analyze_class(env, &super_class.properties, obj, imports);

This comment has been minimized.

Copy link
@antoyo

antoyo May 14, 2019

Member

Does this still generate useless use statements for the parent properties?
If this is the case, it might be because we pass the wrong obj here.

This comment has been minimized.

Copy link
@EPashkin

EPashkin May 14, 2019

Author Member

No its not, fixing use's was main reason to separate

@EPashkin EPashkin changed the title WIP: Fix builders Fix builders May 14, 2019

@EPashkin

This comment has been minimized.

Copy link
Member Author

commented May 14, 2019

@antoyo Its done, can you check it when you have time?

@antoyo

This comment has been minimized.

Copy link
Member

commented May 14, 2019

@EPashkin: These changes look fine to me.

@EPashkin EPashkin merged commit 37621b2 into gtk-rs:master May 15, 2019

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@EPashkin EPashkin deleted the EPashkin:fix_builders branch May 15, 2019

@EPashkin

This comment has been minimized.

Copy link
Member Author

commented May 15, 2019

@antoyo Is #[cfg(any(feature = "builders", feature = "dox"))] really necessary for something?
Builder generated with it, but uses without, as result many warning: unused import when builder generated but without "builders" feature enabled.
And currently no way to this constraint to use 😭

@antoyo

This comment has been minimized.

Copy link
Member

commented May 15, 2019

@EPashkin: No, I don't think that's needed anymore since there's now a config to specify whether we want to generate a builder.

@EPashkin

This comment has been minimized.

Copy link
Member Author

commented May 15, 2019

Good, I add PR with removal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.