1 // Copyright 2013-2016, The Gtk-rs Project Developers. 2 // See the COPYRIGHT recent at the top-level directory of this distribution. 3 // Licensed under the MIT license, see the LICENSE recent or <http://opensource.org/licenses/MIT> 4 5 use glib::object::{Cast, IsA}; 6 use glib::translate::*; 7 use gtk_sys; 8 use std::ptr; 9 use RecentChooserDialog; 10 use RecentManager; 11 use Widget; 12 use Window; 13 14 impl RecentChooserDialog { new<T: IsA<Window>>(title: Option<&str>, parent: Option<&T>) -> RecentChooserDialog15 pub fn new<T: IsA<Window>>(title: Option<&str>, parent: Option<&T>) -> RecentChooserDialog { 16 assert_initialized_main_thread!(); 17 unsafe { 18 Widget::from_glib_none(gtk_sys::gtk_recent_chooser_dialog_new( 19 title.to_glib_none().0, 20 parent.map(|p| p.as_ref()).to_glib_none().0, 21 ptr::null_mut(), 22 )) 23 .unsafe_cast() 24 } 25 } 26 new_for_manager<T: IsA<Window>>( title: Option<&str>, parent: Option<&T>, manager: &RecentManager, ) -> RecentChooserDialog27 pub fn new_for_manager<T: IsA<Window>>( 28 title: Option<&str>, 29 parent: Option<&T>, 30 manager: &RecentManager, 31 ) -> RecentChooserDialog { 32 assert_initialized_main_thread!(); 33 unsafe { 34 Widget::from_glib_none(gtk_sys::gtk_recent_chooser_dialog_new_for_manager( 35 title.to_glib_none().0, 36 parent.map(|p| p.as_ref()).to_glib_none().0, 37 manager.to_glib_none().0, 38 ptr::null_mut(), 39 )) 40 .unsafe_cast() 41 } 42 } 43 } 44