diff --git a/Cargo.toml b/Cargo.toml index 1d51a7f..b2c3015 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rgtk" version = "0.0.1" -authors = ["letang.jeremy@gmail.com", "mathijs.henquet@gmail.com", "guillaume1.gomez@gmail.com", "bpgarman@fastmail.fm"] +authors = ["letang.jeremy@gmail.com", "mathijs.henquet@gmail.com", "guillaume1.gomez@gmail.com", "bpgarman@fastmail.fm", "me@bstr.eu"] build = "sh cargobuild.sh" [features] diff --git a/Makefile.in b/Makefile.in index 091dfa6..df66641 100644 --- a/Makefile.in +++ b/Makefile.in @@ -32,7 +32,7 @@ examples: gtktest cairotest .PHONY: rgtk-build rgtk-build: src/* @$(ECHO) "$(OK_COLOR) Building rgtk.rlib $(NO_COLOR)" - $(RUSTC) src/$(LIBNAME).rs --cfg $(GTK_VERSION) -L $(GLUE_DST) --out-dir target/ + $(RUSTC) src/$(LIBNAME).rs --cfg feature=\"$(GTK_VERSION)\" -L $(GLUE_DST) --out-dir target/ .PHONY: glue : $(GLUE_DST)/$(GLUE_LIBNAME).a @@ -90,7 +90,7 @@ $(EXAMPLE_DIR)text_viewer: rgtk examples/text_viewer.rs | $(EXAMPLE_DIR) .PHONY: doc doc: - rustdoc --cfg $(GTK_VERSION) -o doc/ src/rgtk.rs + rustdoc --cfg feature=\"$(GTK_VERSION)\" -o doc/ src/rgtk.rs chmod -R 755 doc/ $(GLUE_DST)/ $(EXAMPLE_DIR) target/: diff --git a/src/gtk/mod.rs b/src/gtk/mod.rs index 05d0316..04bcb56 100644 --- a/src/gtk/mod.rs +++ b/src/gtk/mod.rs @@ -150,14 +150,14 @@ pub use self::widgets::{ RecentChooserWidget }; -#[cfg(any(GTK_3_6, GTK_3_8, GTK_3_10, GTK_3_12))] +#[cfg(any(feature = "GTK_3_6", feature = "GTK_3_8", feature = "GTK_3_10", feature = "GTK_3_12"))] /// GTK Widgets for versions since GTK 3.6 pub use self::widgets::{ MenuButton, LevelBar, }; -#[cfg(any(GTK_3_10, GTK_3_12))] +#[cfg(any(feature = "GTK_3_10", feature = "GTK_3_12"))] /// GTK Widgets for versions since GTK 3.10 pub use self::widgets::{ SearchEntry, @@ -170,7 +170,7 @@ pub use self::widgets::{ ListBoxRow, }; -#[cfg(GTK_3_12)] +#[cfg(feature = "GTK_3_12")] /// GTK Widgets for versions since GTK 3.12 pub use self::widgets::{ FlowBox, diff --git a/src/gtk/traits/button.rs b/src/gtk/traits/button.rs index fb0529e..1f1d45e 100644 --- a/src/gtk/traits/button.rs +++ b/src/gtk/traits/button.rs @@ -158,7 +158,7 @@ pub trait Button: Widget + Container { } } - #[cfg(any(GTK_3_6, GTK_3_8, GTK_3_10, GTK_3_12))] + #[cfg(any(feature = "GTK_3_6", feature = "GTK_3_8", feature = "GTK_3_10", feature = "GTK_3_12"))] fn set_always_show_image(&mut self, always_show: bool) -> () { match always_show { true => unsafe { ffi::gtk_button_set_always_show_image(GTK_BUTTON(self.get_widget()), ffi::GTRUE) }, @@ -166,7 +166,7 @@ pub trait Button: Widget + Container { } } - #[cfg(any(GTK_3_6, GTK_3_8, GTK_3_10, GTK_3_12))] + #[cfg(any(feature = "GTK_3_6", feature = "GTK_3_8", feature = "GTK_3_10", feature = "GTK_3_12"))] fn get_always_show_image(&self) -> bool { match unsafe { ffi::gtk_button_get_always_show_image(GTK_BUTTON(self.get_widget())) } { ffi::GFALSE => false, diff --git a/src/gtk/traits/dialog.rs b/src/gtk/traits/dialog.rs index f9d1f38..4bf8e00 100644 --- a/src/gtk/traits/dialog.rs +++ b/src/gtk/traits/dialog.rs @@ -107,7 +107,7 @@ pub trait Dialog: traits::Widget + traits::Container + traits::Bin + traits::Win } } - #[cfg(GTK_3_12)] + #[cfg(feature = "GTK_3_12")] fn get_header_bar(&self) -> Option { let tmp_pointer = unsafe { ffi::gtk_dialog_get_header_bar(GTK_DIALOG(self.get_widget())) }; diff --git a/src/gtk/traits/label.rs b/src/gtk/traits/label.rs index 3092316..6628919 100644 --- a/src/gtk/traits/label.rs +++ b/src/gtk/traits/label.rs @@ -102,14 +102,14 @@ pub trait Label : Widget { } } - #[cfg(any(GTK_3_10, GTK_3_12))] + #[cfg(any(feature = "GTK_3_10",feature = "GTK_3_12"))] fn set_lines(&mut self, lines: i32) -> () { unsafe { ffi::gtk_label_set_lines(GTK_LABEL(self.get_widget()), lines as c_int); } } - #[cfg(any(GTK_3_10, GTK_3_12))] + #[cfg(any(feature = "GTK_3_10",feature = "GTK_3_12"))] fn get_lines(&self) -> i32 { unsafe { ffi::gtk_label_get_lines(GTK_LABEL(self.get_widget())) as c_int diff --git a/src/gtk/widgets/button.rs b/src/gtk/widgets/button.rs index d8cf3f4..32f86a9 100644 --- a/src/gtk/widgets/button.rs +++ b/src/gtk/widgets/button.rs @@ -59,7 +59,7 @@ impl Button { check_pointer!(tmp_pointer, Button) } - #[cfg(any(GTK_3_10, GTK_3_12))] + #[cfg(any(feature = "GTK_3_10",feature = "GTK_3_12"))] pub fn new_from_icon_name(icon_name: &str, size: IconSize) -> Option