Skip to content
This repository has been archived by the owner on Jun 8, 2021. It is now read-only.

Commit

Permalink
Fix converting generated enums to i32
Browse files Browse the repository at this point in the history
  • Loading branch information
EPashkin committed Apr 25, 2016
1 parent acd0598 commit 8ef85e0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions src/gtktest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@ fn main() {
button_recent.connect_clicked(clone!(window => move |_| {
let dialog = gtk::RecentChooserDialog::new(Some("Recent chooser test"), Some(&window));
dialog.add_buttons(&[
("Ok", gtk::ResponseType::Ok as i32),
("Cancel", gtk::ResponseType::Cancel as i32)
("Ok", gtk::ResponseType::Ok.into()),
("Cancel", gtk::ResponseType::Cancel.into())
]);

dialog.run();
Expand All @@ -188,8 +188,8 @@ fn main() {
let dialog = gtk::FileChooserDialog::new(Some("Choose a file"), Some(&window),
gtk::FileChooserAction::Open);
dialog.add_buttons(&[
("Open", gtk::ResponseType::Ok as i32),
("Cancel", gtk::ResponseType::Cancel as i32)
("Open", gtk::ResponseType::Ok.into()),
("Cancel", gtk::ResponseType::Cancel.into())
]);

dialog.set_select_multiple(true);
Expand Down
2 changes: 1 addition & 1 deletion src/menu_bar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ fn main() {
let p = Dialog::new_with_buttons(Some("About"),
Some(&window),
gtk::DIALOG_MODAL,
&[("Ok", gtk::ResponseType::Ok as i32)]);
&[("Ok", gtk::ResponseType::Ok.into())]);
let area = p.get_content_area();
let label = Label::new(Some("MenuBar example"));
area.add(&label);
Expand Down
2 changes: 1 addition & 1 deletion src/notebook.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ impl Notebook {

fn create_tab(&mut self, title: &str, widget: Widget) -> u32 {
let close_image = gtk::Image::new_from_icon_name("window-close",
IconSize::Button as i32);
IconSize::Button.into());
let button = gtk::Button::new();
let label = gtk::Label::new(Some(title));
let tab = gtk::Box::new(Orientation::Horizontal, 0);
Expand Down
8 changes: 4 additions & 4 deletions src/text_viewer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ fn main() {
let toolbar = gtk::Toolbar::new();

let open_icon = gtk::Image::new_from_icon_name("document-open",
gtk::IconSize::SmallToolbar as i32);
gtk::IconSize::SmallToolbar.into());
let text_view = gtk::TextView::new();

let open_button = gtk::ToolButton::new::<gtk::Image>(Some(&open_icon), Some("Open"));
Expand All @@ -48,10 +48,10 @@ fn main() {
let file_chooser = gtk::FileChooserDialog::new(
Some("Open File"), Some(&window1), gtk::FileChooserAction::Open);
file_chooser.add_buttons(&[
("Open", gtk::ResponseType::Ok as i32),
("Cancel", gtk::ResponseType::Cancel as i32),
("Open", gtk::ResponseType::Ok.into()),
("Cancel", gtk::ResponseType::Cancel.into()),
]);
if file_chooser.run() == gtk::ResponseType::Ok as i32 {
if file_chooser.run() == gtk::ResponseType::Ok.into() {
let filename = file_chooser.get_filename().unwrap();
let file = File::open(&filename).unwrap();

Expand Down

0 comments on commit 8ef85e0

Please sign in to comment.