1 // This file was generated by gir (https://github.com/gtk-rs/gir) 2 // from gir-files (https://github.com/gtk-rs/gir-files) 3 // DO NOT EDIT 4 5 use crate::Buildable; 6 use crate::CellArea; 7 use crate::CellLayout; 8 use crate::TreeIter; 9 use crate::TreeModel; 10 use glib::object::Cast; 11 use glib::object::IsA; 12 use glib::signal::connect_raw; 13 use glib::signal::SignalHandlerId; 14 use glib::translate::*; 15 use glib::StaticType; 16 use glib::ToValue; 17 use std::boxed::Box as Box_; 18 use std::fmt; 19 use std::mem::transmute; 20 21 glib::wrapper! { 22 #[doc(alias = "GtkEntryCompletion")] 23 pub struct EntryCompletion(Object<ffi::GtkEntryCompletion, ffi::GtkEntryCompletionClass>) @implements Buildable, CellLayout; 24 25 match fn { 26 type_ => || ffi::gtk_entry_completion_get_type(), 27 } 28 } 29 30 impl EntryCompletion { 31 #[doc(alias = "gtk_entry_completion_new")] new() -> EntryCompletion32 pub fn new() -> EntryCompletion { 33 assert_initialized_main_thread!(); 34 unsafe { from_glib_full(ffi::gtk_entry_completion_new()) } 35 } 36 37 #[doc(alias = "gtk_entry_completion_new_with_area")] 38 #[doc(alias = "new_with_area")] with_area<P: IsA<CellArea>>(area: &P) -> EntryCompletion39 pub fn with_area<P: IsA<CellArea>>(area: &P) -> EntryCompletion { 40 skip_assert_initialized!(); 41 unsafe { 42 from_glib_full(ffi::gtk_entry_completion_new_with_area( 43 area.as_ref().to_glib_none().0, 44 )) 45 } 46 } 47 48 // rustdoc-stripper-ignore-next 49 /// Creates a new builder-pattern struct instance to construct [`EntryCompletion`] objects. 50 /// 51 /// This method returns an instance of [`EntryCompletionBuilder`] which can be used to create [`EntryCompletion`] objects. builder() -> EntryCompletionBuilder52 pub fn builder() -> EntryCompletionBuilder { 53 EntryCompletionBuilder::default() 54 } 55 } 56 57 impl Default for EntryCompletion { default() -> Self58 fn default() -> Self { 59 Self::new() 60 } 61 } 62 63 #[derive(Clone, Default)] 64 // rustdoc-stripper-ignore-next 65 /// A [builder-pattern] type to construct [`EntryCompletion`] objects. 66 /// 67 /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html 68 pub struct EntryCompletionBuilder { 69 cell_area: Option<CellArea>, 70 inline_completion: Option<bool>, 71 inline_selection: Option<bool>, 72 minimum_key_length: Option<i32>, 73 model: Option<TreeModel>, 74 popup_completion: Option<bool>, 75 popup_set_width: Option<bool>, 76 popup_single_match: Option<bool>, 77 text_column: Option<i32>, 78 } 79 80 impl EntryCompletionBuilder { 81 // rustdoc-stripper-ignore-next 82 /// Create a new [`EntryCompletionBuilder`]. new() -> Self83 pub fn new() -> Self { 84 Self::default() 85 } 86 87 // rustdoc-stripper-ignore-next 88 /// Build the [`EntryCompletion`]. build(self) -> EntryCompletion89 pub fn build(self) -> EntryCompletion { 90 let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; 91 if let Some(ref cell_area) = self.cell_area { 92 properties.push(("cell-area", cell_area)); 93 } 94 if let Some(ref inline_completion) = self.inline_completion { 95 properties.push(("inline-completion", inline_completion)); 96 } 97 if let Some(ref inline_selection) = self.inline_selection { 98 properties.push(("inline-selection", inline_selection)); 99 } 100 if let Some(ref minimum_key_length) = self.minimum_key_length { 101 properties.push(("minimum-key-length", minimum_key_length)); 102 } 103 if let Some(ref model) = self.model { 104 properties.push(("model", model)); 105 } 106 if let Some(ref popup_completion) = self.popup_completion { 107 properties.push(("popup-completion", popup_completion)); 108 } 109 if let Some(ref popup_set_width) = self.popup_set_width { 110 properties.push(("popup-set-width", popup_set_width)); 111 } 112 if let Some(ref popup_single_match) = self.popup_single_match { 113 properties.push(("popup-single-match", popup_single_match)); 114 } 115 if let Some(ref text_column) = self.text_column { 116 properties.push(("text-column", text_column)); 117 } 118 glib::Object::new::<EntryCompletion>(&properties) 119 .expect("Failed to create an instance of EntryCompletion") 120 } 121 cell_area<P: IsA<CellArea>>(mut self, cell_area: &P) -> Self122 pub fn cell_area<P: IsA<CellArea>>(mut self, cell_area: &P) -> Self { 123 self.cell_area = Some(cell_area.clone().upcast()); 124 self 125 } 126 inline_completion(mut self, inline_completion: bool) -> Self127 pub fn inline_completion(mut self, inline_completion: bool) -> Self { 128 self.inline_completion = Some(inline_completion); 129 self 130 } 131 inline_selection(mut self, inline_selection: bool) -> Self132 pub fn inline_selection(mut self, inline_selection: bool) -> Self { 133 self.inline_selection = Some(inline_selection); 134 self 135 } 136 minimum_key_length(mut self, minimum_key_length: i32) -> Self137 pub fn minimum_key_length(mut self, minimum_key_length: i32) -> Self { 138 self.minimum_key_length = Some(minimum_key_length); 139 self 140 } 141 model<P: IsA<TreeModel>>(mut self, model: &P) -> Self142 pub fn model<P: IsA<TreeModel>>(mut self, model: &P) -> Self { 143 self.model = Some(model.clone().upcast()); 144 self 145 } 146 popup_completion(mut self, popup_completion: bool) -> Self147 pub fn popup_completion(mut self, popup_completion: bool) -> Self { 148 self.popup_completion = Some(popup_completion); 149 self 150 } 151 popup_set_width(mut self, popup_set_width: bool) -> Self152 pub fn popup_set_width(mut self, popup_set_width: bool) -> Self { 153 self.popup_set_width = Some(popup_set_width); 154 self 155 } 156 popup_single_match(mut self, popup_single_match: bool) -> Self157 pub fn popup_single_match(mut self, popup_single_match: bool) -> Self { 158 self.popup_single_match = Some(popup_single_match); 159 self 160 } 161 text_column(mut self, text_column: i32) -> Self162 pub fn text_column(mut self, text_column: i32) -> Self { 163 self.text_column = Some(text_column); 164 self 165 } 166 } 167 168 pub const NONE_ENTRY_COMPLETION: Option<&EntryCompletion> = None; 169 170 pub trait EntryCompletionExt: 'static { 171 #[doc(alias = "gtk_entry_completion_complete")] complete(&self)172 fn complete(&self); 173 174 #[doc(alias = "gtk_entry_completion_compute_prefix")] compute_prefix(&self, key: &str) -> Option<glib::GString>175 fn compute_prefix(&self, key: &str) -> Option<glib::GString>; 176 177 #[doc(alias = "gtk_entry_completion_delete_action")] delete_action(&self, index_: i32)178 fn delete_action(&self, index_: i32); 179 180 #[doc(alias = "gtk_entry_completion_get_completion_prefix")] 181 #[doc(alias = "get_completion_prefix")] completion_prefix(&self) -> Option<glib::GString>182 fn completion_prefix(&self) -> Option<glib::GString>; 183 184 #[doc(alias = "gtk_entry_completion_get_inline_completion")] 185 #[doc(alias = "get_inline_completion")] is_inline_completion(&self) -> bool186 fn is_inline_completion(&self) -> bool; 187 188 #[doc(alias = "gtk_entry_completion_get_inline_selection")] 189 #[doc(alias = "get_inline_selection")] is_inline_selection(&self) -> bool190 fn is_inline_selection(&self) -> bool; 191 192 #[doc(alias = "gtk_entry_completion_get_minimum_key_length")] 193 #[doc(alias = "get_minimum_key_length")] minimum_key_length(&self) -> i32194 fn minimum_key_length(&self) -> i32; 195 196 #[doc(alias = "gtk_entry_completion_get_model")] 197 #[doc(alias = "get_model")] model(&self) -> Option<TreeModel>198 fn model(&self) -> Option<TreeModel>; 199 200 #[doc(alias = "gtk_entry_completion_get_popup_completion")] 201 #[doc(alias = "get_popup_completion")] is_popup_completion(&self) -> bool202 fn is_popup_completion(&self) -> bool; 203 204 #[doc(alias = "gtk_entry_completion_get_popup_set_width")] 205 #[doc(alias = "get_popup_set_width")] is_popup_set_width(&self) -> bool206 fn is_popup_set_width(&self) -> bool; 207 208 #[doc(alias = "gtk_entry_completion_get_popup_single_match")] 209 #[doc(alias = "get_popup_single_match")] is_popup_single_match(&self) -> bool210 fn is_popup_single_match(&self) -> bool; 211 212 #[doc(alias = "gtk_entry_completion_get_text_column")] 213 #[doc(alias = "get_text_column")] text_column(&self) -> i32214 fn text_column(&self) -> i32; 215 216 #[doc(alias = "gtk_entry_completion_insert_action_markup")] insert_action_markup(&self, index_: i32, markup: &str)217 fn insert_action_markup(&self, index_: i32, markup: &str); 218 219 #[doc(alias = "gtk_entry_completion_insert_action_text")] insert_action_text(&self, index_: i32, text: &str)220 fn insert_action_text(&self, index_: i32, text: &str); 221 222 #[doc(alias = "gtk_entry_completion_insert_prefix")] insert_prefix(&self)223 fn insert_prefix(&self); 224 225 #[doc(alias = "gtk_entry_completion_set_inline_completion")] set_inline_completion(&self, inline_completion: bool)226 fn set_inline_completion(&self, inline_completion: bool); 227 228 #[doc(alias = "gtk_entry_completion_set_inline_selection")] set_inline_selection(&self, inline_selection: bool)229 fn set_inline_selection(&self, inline_selection: bool); 230 231 #[doc(alias = "gtk_entry_completion_set_match_func")] set_match_func<P: Fn(&EntryCompletion, &str, &TreeIter) -> bool + 'static>(&self, func: P)232 fn set_match_func<P: Fn(&EntryCompletion, &str, &TreeIter) -> bool + 'static>(&self, func: P); 233 234 #[doc(alias = "gtk_entry_completion_set_minimum_key_length")] set_minimum_key_length(&self, length: i32)235 fn set_minimum_key_length(&self, length: i32); 236 237 #[doc(alias = "gtk_entry_completion_set_model")] set_model<P: IsA<TreeModel>>(&self, model: Option<&P>)238 fn set_model<P: IsA<TreeModel>>(&self, model: Option<&P>); 239 240 #[doc(alias = "gtk_entry_completion_set_popup_completion")] set_popup_completion(&self, popup_completion: bool)241 fn set_popup_completion(&self, popup_completion: bool); 242 243 #[doc(alias = "gtk_entry_completion_set_popup_set_width")] set_popup_set_width(&self, popup_set_width: bool)244 fn set_popup_set_width(&self, popup_set_width: bool); 245 246 #[doc(alias = "gtk_entry_completion_set_popup_single_match")] set_popup_single_match(&self, popup_single_match: bool)247 fn set_popup_single_match(&self, popup_single_match: bool); 248 249 #[doc(alias = "gtk_entry_completion_set_text_column")] set_text_column(&self, column: i32)250 fn set_text_column(&self, column: i32); 251 252 #[doc(alias = "cell-area")] cell_area(&self) -> Option<CellArea>253 fn cell_area(&self) -> Option<CellArea>; 254 255 #[doc(alias = "action-activated")] connect_action_activated<F: Fn(&Self, i32) + 'static>(&self, f: F) -> SignalHandlerId256 fn connect_action_activated<F: Fn(&Self, i32) + 'static>(&self, f: F) -> SignalHandlerId; 257 258 #[doc(alias = "cursor-on-match")] connect_cursor_on_match< F: Fn(&Self, &TreeModel, &TreeIter) -> glib::signal::Inhibit + 'static, >( &self, f: F, ) -> SignalHandlerId259 fn connect_cursor_on_match< 260 F: Fn(&Self, &TreeModel, &TreeIter) -> glib::signal::Inhibit + 'static, 261 >( 262 &self, 263 f: F, 264 ) -> SignalHandlerId; 265 266 #[doc(alias = "insert-prefix")] connect_insert_prefix<F: Fn(&Self, &str) -> glib::signal::Inhibit + 'static>( &self, f: F, ) -> SignalHandlerId267 fn connect_insert_prefix<F: Fn(&Self, &str) -> glib::signal::Inhibit + 'static>( 268 &self, 269 f: F, 270 ) -> SignalHandlerId; 271 272 #[doc(alias = "match-selected")] connect_match_selected< F: Fn(&Self, &TreeModel, &TreeIter) -> glib::signal::Inhibit + 'static, >( &self, f: F, ) -> SignalHandlerId273 fn connect_match_selected< 274 F: Fn(&Self, &TreeModel, &TreeIter) -> glib::signal::Inhibit + 'static, 275 >( 276 &self, 277 f: F, 278 ) -> SignalHandlerId; 279 280 #[doc(alias = "no-matches")] connect_no_matches<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId281 fn connect_no_matches<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 282 283 #[doc(alias = "inline-completion")] connect_inline_completion_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId284 fn connect_inline_completion_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 285 286 #[doc(alias = "inline-selection")] connect_inline_selection_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId287 fn connect_inline_selection_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 288 289 #[doc(alias = "minimum-key-length")] connect_minimum_key_length_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId290 fn connect_minimum_key_length_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 291 292 #[doc(alias = "model")] connect_model_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId293 fn connect_model_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 294 295 #[doc(alias = "popup-completion")] connect_popup_completion_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId296 fn connect_popup_completion_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 297 298 #[doc(alias = "popup-set-width")] connect_popup_set_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId299 fn connect_popup_set_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 300 301 #[doc(alias = "popup-single-match")] connect_popup_single_match_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId302 fn connect_popup_single_match_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 303 304 #[doc(alias = "text-column")] connect_text_column_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId305 fn connect_text_column_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 306 } 307 308 impl<O: IsA<EntryCompletion>> EntryCompletionExt for O { complete(&self)309 fn complete(&self) { 310 unsafe { 311 ffi::gtk_entry_completion_complete(self.as_ref().to_glib_none().0); 312 } 313 } 314 compute_prefix(&self, key: &str) -> Option<glib::GString>315 fn compute_prefix(&self, key: &str) -> Option<glib::GString> { 316 unsafe { 317 from_glib_full(ffi::gtk_entry_completion_compute_prefix( 318 self.as_ref().to_glib_none().0, 319 key.to_glib_none().0, 320 )) 321 } 322 } 323 delete_action(&self, index_: i32)324 fn delete_action(&self, index_: i32) { 325 unsafe { 326 ffi::gtk_entry_completion_delete_action(self.as_ref().to_glib_none().0, index_); 327 } 328 } 329 completion_prefix(&self) -> Option<glib::GString>330 fn completion_prefix(&self) -> Option<glib::GString> { 331 unsafe { 332 from_glib_none(ffi::gtk_entry_completion_get_completion_prefix( 333 self.as_ref().to_glib_none().0, 334 )) 335 } 336 } 337 is_inline_completion(&self) -> bool338 fn is_inline_completion(&self) -> bool { 339 unsafe { 340 from_glib(ffi::gtk_entry_completion_get_inline_completion( 341 self.as_ref().to_glib_none().0, 342 )) 343 } 344 } 345 is_inline_selection(&self) -> bool346 fn is_inline_selection(&self) -> bool { 347 unsafe { 348 from_glib(ffi::gtk_entry_completion_get_inline_selection( 349 self.as_ref().to_glib_none().0, 350 )) 351 } 352 } 353 minimum_key_length(&self) -> i32354 fn minimum_key_length(&self) -> i32 { 355 unsafe { ffi::gtk_entry_completion_get_minimum_key_length(self.as_ref().to_glib_none().0) } 356 } 357 model(&self) -> Option<TreeModel>358 fn model(&self) -> Option<TreeModel> { 359 unsafe { 360 from_glib_none(ffi::gtk_entry_completion_get_model( 361 self.as_ref().to_glib_none().0, 362 )) 363 } 364 } 365 is_popup_completion(&self) -> bool366 fn is_popup_completion(&self) -> bool { 367 unsafe { 368 from_glib(ffi::gtk_entry_completion_get_popup_completion( 369 self.as_ref().to_glib_none().0, 370 )) 371 } 372 } 373 is_popup_set_width(&self) -> bool374 fn is_popup_set_width(&self) -> bool { 375 unsafe { 376 from_glib(ffi::gtk_entry_completion_get_popup_set_width( 377 self.as_ref().to_glib_none().0, 378 )) 379 } 380 } 381 is_popup_single_match(&self) -> bool382 fn is_popup_single_match(&self) -> bool { 383 unsafe { 384 from_glib(ffi::gtk_entry_completion_get_popup_single_match( 385 self.as_ref().to_glib_none().0, 386 )) 387 } 388 } 389 text_column(&self) -> i32390 fn text_column(&self) -> i32 { 391 unsafe { ffi::gtk_entry_completion_get_text_column(self.as_ref().to_glib_none().0) } 392 } 393 insert_action_markup(&self, index_: i32, markup: &str)394 fn insert_action_markup(&self, index_: i32, markup: &str) { 395 unsafe { 396 ffi::gtk_entry_completion_insert_action_markup( 397 self.as_ref().to_glib_none().0, 398 index_, 399 markup.to_glib_none().0, 400 ); 401 } 402 } 403 insert_action_text(&self, index_: i32, text: &str)404 fn insert_action_text(&self, index_: i32, text: &str) { 405 unsafe { 406 ffi::gtk_entry_completion_insert_action_text( 407 self.as_ref().to_glib_none().0, 408 index_, 409 text.to_glib_none().0, 410 ); 411 } 412 } 413 insert_prefix(&self)414 fn insert_prefix(&self) { 415 unsafe { 416 ffi::gtk_entry_completion_insert_prefix(self.as_ref().to_glib_none().0); 417 } 418 } 419 set_inline_completion(&self, inline_completion: bool)420 fn set_inline_completion(&self, inline_completion: bool) { 421 unsafe { 422 ffi::gtk_entry_completion_set_inline_completion( 423 self.as_ref().to_glib_none().0, 424 inline_completion.into_glib(), 425 ); 426 } 427 } 428 set_inline_selection(&self, inline_selection: bool)429 fn set_inline_selection(&self, inline_selection: bool) { 430 unsafe { 431 ffi::gtk_entry_completion_set_inline_selection( 432 self.as_ref().to_glib_none().0, 433 inline_selection.into_glib(), 434 ); 435 } 436 } 437 set_match_func<P: Fn(&EntryCompletion, &str, &TreeIter) -> bool + 'static>(&self, func: P)438 fn set_match_func<P: Fn(&EntryCompletion, &str, &TreeIter) -> bool + 'static>(&self, func: P) { 439 let func_data: Box_<P> = Box_::new(func); 440 unsafe extern "C" fn func_func< 441 P: Fn(&EntryCompletion, &str, &TreeIter) -> bool + 'static, 442 >( 443 completion: *mut ffi::GtkEntryCompletion, 444 key: *const libc::c_char, 445 iter: *mut ffi::GtkTreeIter, 446 user_data: glib::ffi::gpointer, 447 ) -> glib::ffi::gboolean { 448 let completion = from_glib_borrow(completion); 449 let key: Borrowed<glib::GString> = from_glib_borrow(key); 450 let iter = from_glib_borrow(iter); 451 let callback: &P = &*(user_data as *mut _); 452 let res = (*callback)(&completion, key.as_str(), &iter); 453 res.into_glib() 454 } 455 let func = Some(func_func::<P> as _); 456 unsafe extern "C" fn func_notify_func< 457 P: Fn(&EntryCompletion, &str, &TreeIter) -> bool + 'static, 458 >( 459 data: glib::ffi::gpointer, 460 ) { 461 let _callback: Box_<P> = Box_::from_raw(data as *mut _); 462 } 463 let destroy_call3 = Some(func_notify_func::<P> as _); 464 let super_callback0: Box_<P> = func_data; 465 unsafe { 466 ffi::gtk_entry_completion_set_match_func( 467 self.as_ref().to_glib_none().0, 468 func, 469 Box_::into_raw(super_callback0) as *mut _, 470 destroy_call3, 471 ); 472 } 473 } 474 set_minimum_key_length(&self, length: i32)475 fn set_minimum_key_length(&self, length: i32) { 476 unsafe { 477 ffi::gtk_entry_completion_set_minimum_key_length( 478 self.as_ref().to_glib_none().0, 479 length, 480 ); 481 } 482 } 483 set_model<P: IsA<TreeModel>>(&self, model: Option<&P>)484 fn set_model<P: IsA<TreeModel>>(&self, model: Option<&P>) { 485 unsafe { 486 ffi::gtk_entry_completion_set_model( 487 self.as_ref().to_glib_none().0, 488 model.map(|p| p.as_ref()).to_glib_none().0, 489 ); 490 } 491 } 492 set_popup_completion(&self, popup_completion: bool)493 fn set_popup_completion(&self, popup_completion: bool) { 494 unsafe { 495 ffi::gtk_entry_completion_set_popup_completion( 496 self.as_ref().to_glib_none().0, 497 popup_completion.into_glib(), 498 ); 499 } 500 } 501 set_popup_set_width(&self, popup_set_width: bool)502 fn set_popup_set_width(&self, popup_set_width: bool) { 503 unsafe { 504 ffi::gtk_entry_completion_set_popup_set_width( 505 self.as_ref().to_glib_none().0, 506 popup_set_width.into_glib(), 507 ); 508 } 509 } 510 set_popup_single_match(&self, popup_single_match: bool)511 fn set_popup_single_match(&self, popup_single_match: bool) { 512 unsafe { 513 ffi::gtk_entry_completion_set_popup_single_match( 514 self.as_ref().to_glib_none().0, 515 popup_single_match.into_glib(), 516 ); 517 } 518 } 519 set_text_column(&self, column: i32)520 fn set_text_column(&self, column: i32) { 521 unsafe { 522 ffi::gtk_entry_completion_set_text_column(self.as_ref().to_glib_none().0, column); 523 } 524 } 525 cell_area(&self) -> Option<CellArea>526 fn cell_area(&self) -> Option<CellArea> { 527 unsafe { 528 let mut value = glib::Value::from_type(<CellArea as StaticType>::static_type()); 529 glib::gobject_ffi::g_object_get_property( 530 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, 531 b"cell-area\0".as_ptr() as *const _, 532 value.to_glib_none_mut().0, 533 ); 534 value 535 .get() 536 .expect("Return Value for property `cell-area` getter") 537 } 538 } 539 connect_action_activated<F: Fn(&Self, i32) + 'static>(&self, f: F) -> SignalHandlerId540 fn connect_action_activated<F: Fn(&Self, i32) + 'static>(&self, f: F) -> SignalHandlerId { 541 unsafe extern "C" fn action_activated_trampoline< 542 P: IsA<EntryCompletion>, 543 F: Fn(&P, i32) + 'static, 544 >( 545 this: *mut ffi::GtkEntryCompletion, 546 index: libc::c_int, 547 f: glib::ffi::gpointer, 548 ) { 549 let f: &F = &*(f as *const F); 550 f( 551 EntryCompletion::from_glib_borrow(this).unsafe_cast_ref(), 552 index, 553 ) 554 } 555 unsafe { 556 let f: Box_<F> = Box_::new(f); 557 connect_raw( 558 self.as_ptr() as *mut _, 559 b"action-activated\0".as_ptr() as *const _, 560 Some(transmute::<_, unsafe extern "C" fn()>( 561 action_activated_trampoline::<Self, F> as *const (), 562 )), 563 Box_::into_raw(f), 564 ) 565 } 566 } 567 connect_cursor_on_match< F: Fn(&Self, &TreeModel, &TreeIter) -> glib::signal::Inhibit + 'static, >( &self, f: F, ) -> SignalHandlerId568 fn connect_cursor_on_match< 569 F: Fn(&Self, &TreeModel, &TreeIter) -> glib::signal::Inhibit + 'static, 570 >( 571 &self, 572 f: F, 573 ) -> SignalHandlerId { 574 unsafe extern "C" fn cursor_on_match_trampoline< 575 P: IsA<EntryCompletion>, 576 F: Fn(&P, &TreeModel, &TreeIter) -> glib::signal::Inhibit + 'static, 577 >( 578 this: *mut ffi::GtkEntryCompletion, 579 model: *mut ffi::GtkTreeModel, 580 iter: *mut ffi::GtkTreeIter, 581 f: glib::ffi::gpointer, 582 ) -> glib::ffi::gboolean { 583 let f: &F = &*(f as *const F); 584 f( 585 EntryCompletion::from_glib_borrow(this).unsafe_cast_ref(), 586 &from_glib_borrow(model), 587 &from_glib_borrow(iter), 588 ) 589 .into_glib() 590 } 591 unsafe { 592 let f: Box_<F> = Box_::new(f); 593 connect_raw( 594 self.as_ptr() as *mut _, 595 b"cursor-on-match\0".as_ptr() as *const _, 596 Some(transmute::<_, unsafe extern "C" fn()>( 597 cursor_on_match_trampoline::<Self, F> as *const (), 598 )), 599 Box_::into_raw(f), 600 ) 601 } 602 } 603 connect_insert_prefix<F: Fn(&Self, &str) -> glib::signal::Inhibit + 'static>( &self, f: F, ) -> SignalHandlerId604 fn connect_insert_prefix<F: Fn(&Self, &str) -> glib::signal::Inhibit + 'static>( 605 &self, 606 f: F, 607 ) -> SignalHandlerId { 608 unsafe extern "C" fn insert_prefix_trampoline< 609 P: IsA<EntryCompletion>, 610 F: Fn(&P, &str) -> glib::signal::Inhibit + 'static, 611 >( 612 this: *mut ffi::GtkEntryCompletion, 613 prefix: *mut libc::c_char, 614 f: glib::ffi::gpointer, 615 ) -> glib::ffi::gboolean { 616 let f: &F = &*(f as *const F); 617 f( 618 EntryCompletion::from_glib_borrow(this).unsafe_cast_ref(), 619 &glib::GString::from_glib_borrow(prefix), 620 ) 621 .into_glib() 622 } 623 unsafe { 624 let f: Box_<F> = Box_::new(f); 625 connect_raw( 626 self.as_ptr() as *mut _, 627 b"insert-prefix\0".as_ptr() as *const _, 628 Some(transmute::<_, unsafe extern "C" fn()>( 629 insert_prefix_trampoline::<Self, F> as *const (), 630 )), 631 Box_::into_raw(f), 632 ) 633 } 634 } 635 connect_match_selected< F: Fn(&Self, &TreeModel, &TreeIter) -> glib::signal::Inhibit + 'static, >( &self, f: F, ) -> SignalHandlerId636 fn connect_match_selected< 637 F: Fn(&Self, &TreeModel, &TreeIter) -> glib::signal::Inhibit + 'static, 638 >( 639 &self, 640 f: F, 641 ) -> SignalHandlerId { 642 unsafe extern "C" fn match_selected_trampoline< 643 P: IsA<EntryCompletion>, 644 F: Fn(&P, &TreeModel, &TreeIter) -> glib::signal::Inhibit + 'static, 645 >( 646 this: *mut ffi::GtkEntryCompletion, 647 model: *mut ffi::GtkTreeModel, 648 iter: *mut ffi::GtkTreeIter, 649 f: glib::ffi::gpointer, 650 ) -> glib::ffi::gboolean { 651 let f: &F = &*(f as *const F); 652 f( 653 EntryCompletion::from_glib_borrow(this).unsafe_cast_ref(), 654 &from_glib_borrow(model), 655 &from_glib_borrow(iter), 656 ) 657 .into_glib() 658 } 659 unsafe { 660 let f: Box_<F> = Box_::new(f); 661 connect_raw( 662 self.as_ptr() as *mut _, 663 b"match-selected\0".as_ptr() as *const _, 664 Some(transmute::<_, unsafe extern "C" fn()>( 665 match_selected_trampoline::<Self, F> as *const (), 666 )), 667 Box_::into_raw(f), 668 ) 669 } 670 } 671 connect_no_matches<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId672 fn connect_no_matches<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 673 unsafe extern "C" fn no_matches_trampoline<P: IsA<EntryCompletion>, F: Fn(&P) + 'static>( 674 this: *mut ffi::GtkEntryCompletion, 675 f: glib::ffi::gpointer, 676 ) { 677 let f: &F = &*(f as *const F); 678 f(EntryCompletion::from_glib_borrow(this).unsafe_cast_ref()) 679 } 680 unsafe { 681 let f: Box_<F> = Box_::new(f); 682 connect_raw( 683 self.as_ptr() as *mut _, 684 b"no-matches\0".as_ptr() as *const _, 685 Some(transmute::<_, unsafe extern "C" fn()>( 686 no_matches_trampoline::<Self, F> as *const (), 687 )), 688 Box_::into_raw(f), 689 ) 690 } 691 } 692 connect_inline_completion_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId693 fn connect_inline_completion_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 694 unsafe extern "C" fn notify_inline_completion_trampoline< 695 P: IsA<EntryCompletion>, 696 F: Fn(&P) + 'static, 697 >( 698 this: *mut ffi::GtkEntryCompletion, 699 _param_spec: glib::ffi::gpointer, 700 f: glib::ffi::gpointer, 701 ) { 702 let f: &F = &*(f as *const F); 703 f(EntryCompletion::from_glib_borrow(this).unsafe_cast_ref()) 704 } 705 unsafe { 706 let f: Box_<F> = Box_::new(f); 707 connect_raw( 708 self.as_ptr() as *mut _, 709 b"notify::inline-completion\0".as_ptr() as *const _, 710 Some(transmute::<_, unsafe extern "C" fn()>( 711 notify_inline_completion_trampoline::<Self, F> as *const (), 712 )), 713 Box_::into_raw(f), 714 ) 715 } 716 } 717 connect_inline_selection_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId718 fn connect_inline_selection_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 719 unsafe extern "C" fn notify_inline_selection_trampoline< 720 P: IsA<EntryCompletion>, 721 F: Fn(&P) + 'static, 722 >( 723 this: *mut ffi::GtkEntryCompletion, 724 _param_spec: glib::ffi::gpointer, 725 f: glib::ffi::gpointer, 726 ) { 727 let f: &F = &*(f as *const F); 728 f(EntryCompletion::from_glib_borrow(this).unsafe_cast_ref()) 729 } 730 unsafe { 731 let f: Box_<F> = Box_::new(f); 732 connect_raw( 733 self.as_ptr() as *mut _, 734 b"notify::inline-selection\0".as_ptr() as *const _, 735 Some(transmute::<_, unsafe extern "C" fn()>( 736 notify_inline_selection_trampoline::<Self, F> as *const (), 737 )), 738 Box_::into_raw(f), 739 ) 740 } 741 } 742 connect_minimum_key_length_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId743 fn connect_minimum_key_length_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 744 unsafe extern "C" fn notify_minimum_key_length_trampoline< 745 P: IsA<EntryCompletion>, 746 F: Fn(&P) + 'static, 747 >( 748 this: *mut ffi::GtkEntryCompletion, 749 _param_spec: glib::ffi::gpointer, 750 f: glib::ffi::gpointer, 751 ) { 752 let f: &F = &*(f as *const F); 753 f(EntryCompletion::from_glib_borrow(this).unsafe_cast_ref()) 754 } 755 unsafe { 756 let f: Box_<F> = Box_::new(f); 757 connect_raw( 758 self.as_ptr() as *mut _, 759 b"notify::minimum-key-length\0".as_ptr() as *const _, 760 Some(transmute::<_, unsafe extern "C" fn()>( 761 notify_minimum_key_length_trampoline::<Self, F> as *const (), 762 )), 763 Box_::into_raw(f), 764 ) 765 } 766 } 767 connect_model_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId768 fn connect_model_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 769 unsafe extern "C" fn notify_model_trampoline< 770 P: IsA<EntryCompletion>, 771 F: Fn(&P) + 'static, 772 >( 773 this: *mut ffi::GtkEntryCompletion, 774 _param_spec: glib::ffi::gpointer, 775 f: glib::ffi::gpointer, 776 ) { 777 let f: &F = &*(f as *const F); 778 f(EntryCompletion::from_glib_borrow(this).unsafe_cast_ref()) 779 } 780 unsafe { 781 let f: Box_<F> = Box_::new(f); 782 connect_raw( 783 self.as_ptr() as *mut _, 784 b"notify::model\0".as_ptr() as *const _, 785 Some(transmute::<_, unsafe extern "C" fn()>( 786 notify_model_trampoline::<Self, F> as *const (), 787 )), 788 Box_::into_raw(f), 789 ) 790 } 791 } 792 connect_popup_completion_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId793 fn connect_popup_completion_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 794 unsafe extern "C" fn notify_popup_completion_trampoline< 795 P: IsA<EntryCompletion>, 796 F: Fn(&P) + 'static, 797 >( 798 this: *mut ffi::GtkEntryCompletion, 799 _param_spec: glib::ffi::gpointer, 800 f: glib::ffi::gpointer, 801 ) { 802 let f: &F = &*(f as *const F); 803 f(EntryCompletion::from_glib_borrow(this).unsafe_cast_ref()) 804 } 805 unsafe { 806 let f: Box_<F> = Box_::new(f); 807 connect_raw( 808 self.as_ptr() as *mut _, 809 b"notify::popup-completion\0".as_ptr() as *const _, 810 Some(transmute::<_, unsafe extern "C" fn()>( 811 notify_popup_completion_trampoline::<Self, F> as *const (), 812 )), 813 Box_::into_raw(f), 814 ) 815 } 816 } 817 connect_popup_set_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId818 fn connect_popup_set_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 819 unsafe extern "C" fn notify_popup_set_width_trampoline< 820 P: IsA<EntryCompletion>, 821 F: Fn(&P) + 'static, 822 >( 823 this: *mut ffi::GtkEntryCompletion, 824 _param_spec: glib::ffi::gpointer, 825 f: glib::ffi::gpointer, 826 ) { 827 let f: &F = &*(f as *const F); 828 f(EntryCompletion::from_glib_borrow(this).unsafe_cast_ref()) 829 } 830 unsafe { 831 let f: Box_<F> = Box_::new(f); 832 connect_raw( 833 self.as_ptr() as *mut _, 834 b"notify::popup-set-width\0".as_ptr() as *const _, 835 Some(transmute::<_, unsafe extern "C" fn()>( 836 notify_popup_set_width_trampoline::<Self, F> as *const (), 837 )), 838 Box_::into_raw(f), 839 ) 840 } 841 } 842 connect_popup_single_match_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId843 fn connect_popup_single_match_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 844 unsafe extern "C" fn notify_popup_single_match_trampoline< 845 P: IsA<EntryCompletion>, 846 F: Fn(&P) + 'static, 847 >( 848 this: *mut ffi::GtkEntryCompletion, 849 _param_spec: glib::ffi::gpointer, 850 f: glib::ffi::gpointer, 851 ) { 852 let f: &F = &*(f as *const F); 853 f(EntryCompletion::from_glib_borrow(this).unsafe_cast_ref()) 854 } 855 unsafe { 856 let f: Box_<F> = Box_::new(f); 857 connect_raw( 858 self.as_ptr() as *mut _, 859 b"notify::popup-single-match\0".as_ptr() as *const _, 860 Some(transmute::<_, unsafe extern "C" fn()>( 861 notify_popup_single_match_trampoline::<Self, F> as *const (), 862 )), 863 Box_::into_raw(f), 864 ) 865 } 866 } 867 connect_text_column_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId868 fn connect_text_column_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 869 unsafe extern "C" fn notify_text_column_trampoline< 870 P: IsA<EntryCompletion>, 871 F: Fn(&P) + 'static, 872 >( 873 this: *mut ffi::GtkEntryCompletion, 874 _param_spec: glib::ffi::gpointer, 875 f: glib::ffi::gpointer, 876 ) { 877 let f: &F = &*(f as *const F); 878 f(EntryCompletion::from_glib_borrow(this).unsafe_cast_ref()) 879 } 880 unsafe { 881 let f: Box_<F> = Box_::new(f); 882 connect_raw( 883 self.as_ptr() as *mut _, 884 b"notify::text-column\0".as_ptr() as *const _, 885 Some(transmute::<_, unsafe extern "C" fn()>( 886 notify_text_column_trampoline::<Self, F> as *const (), 887 )), 888 Box_::into_raw(f), 889 ) 890 } 891 } 892 } 893 894 impl fmt::Display for EntryCompletion { fmt(&self, f: &mut fmt::Formatter) -> fmt::Result895 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 896 f.write_str("EntryCompletion") 897 } 898 } 899