From 2d58aab7df91b7d19c022dfaddfe43320835ee7d Mon Sep 17 00:00:00 2001 From: Sebastian Schulze Date: Mon, 13 Oct 2014 10:39:59 +0200 Subject: [PATCH 1/2] Change cfg(GTK_3_x) to cfg(feature = "GTK_3_x") to make cargo build work Master branch doesn't let me specify rgtk as dependency in Cargo.toml because features are not matching. Master checks with cfg for GTK_3_12 but it should be feature="GTK_3_12". --- Makefile.in | 4 ++-- src/gtk/mod.rs | 6 ++--- src/gtk/traits/button.rs | 4 ++-- src/gtk/traits/dialog.rs | 2 +- src/gtk/traits/label.rs | 4 ++-- src/gtk/widgets/button.rs | 2 +- src/gtk/widgets/grid.rs | 8 +++---- src/gtk/widgets/infobar.rs | 4 ++-- src/gtk/widgets/levelbar.rs | 4 ++-- src/gtk/widgets/mod.rs | 44 ++++++++++++++++++------------------- src/gtk/widgets/treeview.rs | 6 ++--- 11 files changed, 44 insertions(+), 44 deletions(-) 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