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 gdk_pixbuf; 6 use gio; 7 use glib; 8 use glib::object::Cast; 9 use glib::object::IsA; 10 use glib::object::ObjectExt; 11 use glib::signal::connect_raw; 12 use glib::signal::SignalHandlerId; 13 use glib::translate::*; 14 use glib::GString; 15 use glib_sys; 16 use gobject_sys; 17 use gtk_source_sys; 18 use std::boxed::Box as Box_; 19 use std::fmt; 20 use std::mem::transmute; 21 22 glib_wrapper! { 23 pub struct CompletionProposal(Interface<gtk_source_sys::GtkSourceCompletionProposal>); 24 25 match fn { 26 get_type => || gtk_source_sys::gtk_source_completion_proposal_get_type(), 27 } 28 } 29 30 pub const NONE_COMPLETION_PROPOSAL: Option<&CompletionProposal> = None; 31 32 pub trait CompletionProposalExt: 'static { changed(&self)33 fn changed(&self); 34 equal<P: IsA<CompletionProposal>>(&self, other: &P) -> bool35 fn equal<P: IsA<CompletionProposal>>(&self, other: &P) -> bool; 36 get_gicon(&self) -> Option<gio::Icon>37 fn get_gicon(&self) -> Option<gio::Icon>; 38 get_icon(&self) -> Option<gdk_pixbuf::Pixbuf>39 fn get_icon(&self) -> Option<gdk_pixbuf::Pixbuf>; 40 get_icon_name(&self) -> Option<GString>41 fn get_icon_name(&self) -> Option<GString>; 42 get_info(&self) -> Option<GString>43 fn get_info(&self) -> Option<GString>; 44 get_label(&self) -> Option<GString>45 fn get_label(&self) -> Option<GString>; 46 get_markup(&self) -> Option<GString>47 fn get_markup(&self) -> Option<GString>; 48 get_text(&self) -> Option<GString>49 fn get_text(&self) -> Option<GString>; 50 hash(&self) -> u3251 fn hash(&self) -> u32; 52 connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId53 fn connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 54 emit_changed(&self)55 fn emit_changed(&self); 56 } 57 58 impl<O: IsA<CompletionProposal>> CompletionProposalExt for O { changed(&self)59 fn changed(&self) { 60 unsafe { 61 gtk_source_sys::gtk_source_completion_proposal_changed(self.as_ref().to_glib_none().0); 62 } 63 } 64 equal<P: IsA<CompletionProposal>>(&self, other: &P) -> bool65 fn equal<P: IsA<CompletionProposal>>(&self, other: &P) -> bool { 66 unsafe { 67 from_glib(gtk_source_sys::gtk_source_completion_proposal_equal(self.as_ref().to_glib_none().0, other.as_ref().to_glib_none().0)) 68 } 69 } 70 get_gicon(&self) -> Option<gio::Icon>71 fn get_gicon(&self) -> Option<gio::Icon> { 72 unsafe { 73 from_glib_none(gtk_source_sys::gtk_source_completion_proposal_get_gicon(self.as_ref().to_glib_none().0)) 74 } 75 } 76 get_icon(&self) -> Option<gdk_pixbuf::Pixbuf>77 fn get_icon(&self) -> Option<gdk_pixbuf::Pixbuf> { 78 unsafe { 79 from_glib_none(gtk_source_sys::gtk_source_completion_proposal_get_icon(self.as_ref().to_glib_none().0)) 80 } 81 } 82 get_icon_name(&self) -> Option<GString>83 fn get_icon_name(&self) -> Option<GString> { 84 unsafe { 85 from_glib_none(gtk_source_sys::gtk_source_completion_proposal_get_icon_name(self.as_ref().to_glib_none().0)) 86 } 87 } 88 get_info(&self) -> Option<GString>89 fn get_info(&self) -> Option<GString> { 90 unsafe { 91 from_glib_full(gtk_source_sys::gtk_source_completion_proposal_get_info(self.as_ref().to_glib_none().0)) 92 } 93 } 94 get_label(&self) -> Option<GString>95 fn get_label(&self) -> Option<GString> { 96 unsafe { 97 from_glib_full(gtk_source_sys::gtk_source_completion_proposal_get_label(self.as_ref().to_glib_none().0)) 98 } 99 } 100 get_markup(&self) -> Option<GString>101 fn get_markup(&self) -> Option<GString> { 102 unsafe { 103 from_glib_full(gtk_source_sys::gtk_source_completion_proposal_get_markup(self.as_ref().to_glib_none().0)) 104 } 105 } 106 get_text(&self) -> Option<GString>107 fn get_text(&self) -> Option<GString> { 108 unsafe { 109 from_glib_full(gtk_source_sys::gtk_source_completion_proposal_get_text(self.as_ref().to_glib_none().0)) 110 } 111 } 112 hash(&self) -> u32113 fn hash(&self) -> u32 { 114 unsafe { 115 gtk_source_sys::gtk_source_completion_proposal_hash(self.as_ref().to_glib_none().0) 116 } 117 } 118 connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId119 fn connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 120 unsafe extern "C" fn changed_trampoline<P, F: Fn(&P) + 'static>(this: *mut gtk_source_sys::GtkSourceCompletionProposal, f: glib_sys::gpointer) 121 where P: IsA<CompletionProposal> 122 { 123 let f: &F = &*(f as *const F); 124 f(&CompletionProposal::from_glib_borrow(this).unsafe_cast()) 125 } 126 unsafe { 127 let f: Box_<F> = Box_::new(f); 128 connect_raw(self.as_ptr() as *mut _, b"changed\0".as_ptr() as *const _, 129 Some(transmute(changed_trampoline::<Self, F> as usize)), Box_::into_raw(f)) 130 } 131 } 132 emit_changed(&self)133 fn emit_changed(&self) { 134 let _ = unsafe { glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject).emit("changed", &[]).unwrap() }; 135 } 136 } 137 138 impl fmt::Display for CompletionProposal { fmt(&self, f: &mut fmt::Formatter) -> fmt::Result139 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 140 write!(f, "CompletionProposal") 141 } 142 } 143