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

Commit

Permalink
Merge pull request #400 from EPashkin/trampoline_transform_borrow
Browse files Browse the repository at this point in the history
Trampoline transform
  • Loading branch information
GuillaumeGomez committed Jan 6, 2017
2 parents dbde47a + 1438490 commit df64887
Show file tree
Hide file tree
Showing 174 changed files with 660 additions and 764 deletions.
69 changes: 55 additions & 14 deletions Gir.toml
Original file line number Diff line number Diff line change
Expand Up @@ -361,8 +361,20 @@ status = "generate"
name = "event"
const = true
[[object.signal]]
pattern = ".+" #tree_path #manual
ignore = true
name = "add-editable"
[[object.signal.parameter]]
name = "path"
transformation = "treepath"
[[object.signal]]
name = "apply-attributes"
[[object.signal.parameter]]
name = "iter"
transformation = "borrow"
[[object.signal]]
name = "focus-changed"
[[object.signal.parameter]]
name = "path"
transformation = "treepath"

[[object]]
name = "Gtk.CellEditable"
Expand Down Expand Up @@ -393,36 +405,57 @@ status = "generate"
name = "event"
const = true
[[object.signal]]
pattern = ".+" #tree_path
ignore = true
name = "editing-started"
[[object.signal.parameter]]
name = "path"
transformation = "treepath"

[[object]]
name = "Gtk.CellRendererAccel"
status = "generate"
[[object.signal]]
name = "accel-edited" #tree_path #manual
ignore = true
name = "accel-cleared"
[[object.signal.parameter]]
name = "path_string"
transformation = "treepath"
new_name = "path"
[[object.signal]]
name = "accel-edited"
[[object.signal.parameter]]
name = "path_string"
transformation = "treepath"
new_name = "path"

[[object]]
name = "Gtk.CellRendererCombo"
status = "generate"
[[object.signal]]
pattern = ".+" #tree_path #manual
ignore = true
name = "changed"
[[object.signal.parameter]]
name = "new_iter"
transformation = "borrow"
[[object.signal.parameter]]
name = "path_string"
transformation = "treepath"
new_name = "path"

[[object]]
name = "Gtk.CellRendererText"
status = "generate"
[[object.signal]]
pattern = ".+" #tree_path #manual
ignore = true
name = "edited"
[[object.signal.parameter]]
name = "path"
transformation = "treepath"

[[object]]
name = "Gtk.CellRendererToggle"
status = "generate"
[[object.signal]]
pattern = ".+" #tree_path #manual
ignore = true
name = "toggled"
[[object.signal.parameter]]
name = "path"
transformation = "treepath"

[[object]]
name = "Gtk.Clipboard"
Expand Down Expand Up @@ -1198,8 +1231,16 @@ status = "generate"
[object.function.return]
nullable = false
[[object.signal]]
pattern = ".+" #borrow
ignore = true
pattern = ".+"
[[object.signal.parameter]]
name = "iter"
transformation = "borrow"
[[object.signal.parameter]]
name = "path"
transformation = "borrow"
[[object.signal]]
pattern = "test-.+"
inhibit = true

[[object]]
name = "Gtk.TreeViewColumn"
Expand Down
2 changes: 1 addition & 1 deletion src/auto/about_dialog.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file was generated by gir (25bba39) from gir-files (71d73f0)
// This file was generated by gir (e48471c) from gir-files (71d73f0)
// DO NOT EDIT

use Bin;
Expand Down
2 changes: 1 addition & 1 deletion src/auto/accel_group.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file was generated by gir (25bba39) from gir-files (71d73f0)
// This file was generated by gir (e48471c) from gir-files (71d73f0)
// DO NOT EDIT

use ffi;
Expand Down
2 changes: 1 addition & 1 deletion src/auto/action_bar.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file was generated by gir (25bba39) from gir-files (71d73f0)
// This file was generated by gir (e48471c) from gir-files (71d73f0)
// DO NOT EDIT

use Bin;
Expand Down
2 changes: 1 addition & 1 deletion src/auto/actionable.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file was generated by gir (25bba39) from gir-files (71d73f0)
// This file was generated by gir (e48471c) from gir-files (71d73f0)
// DO NOT EDIT

use Widget;
Expand Down
2 changes: 1 addition & 1 deletion src/auto/adjustment.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file was generated by gir (25bba39) from gir-files (71d73f0)
// This file was generated by gir (e48471c) from gir-files (71d73f0)
// DO NOT EDIT

use ffi;
Expand Down
2 changes: 1 addition & 1 deletion src/auto/alignment.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file was generated by gir (25bba39) from gir-files (71d73f0)
// This file was generated by gir (e48471c) from gir-files (71d73f0)
// DO NOT EDIT

use Bin;
Expand Down
2 changes: 1 addition & 1 deletion src/auto/app_chooser_dialog.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file was generated by gir (25bba39) from gir-files (71d73f0)
// This file was generated by gir (e48471c) from gir-files (71d73f0)
// DO NOT EDIT

use AppChooser;
Expand Down
2 changes: 1 addition & 1 deletion src/auto/app_chooser_widget.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file was generated by gir (25bba39) from gir-files (71d73f0)
// This file was generated by gir (e48471c) from gir-files (71d73f0)
// DO NOT EDIT

use AppChooser;
Expand Down
2 changes: 1 addition & 1 deletion src/auto/application.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file was generated by gir (25bba39) from gir-files (71d73f0)
// This file was generated by gir (e48471c) from gir-files (71d73f0)
// DO NOT EDIT

use ApplicationInhibitFlags;
Expand Down
2 changes: 1 addition & 1 deletion src/auto/application_window.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file was generated by gir (25bba39) from gir-files (71d73f0)
// This file was generated by gir (e48471c) from gir-files (71d73f0)
// DO NOT EDIT

use Application;
Expand Down
2 changes: 1 addition & 1 deletion src/auto/arrow.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file was generated by gir (25bba39) from gir-files (71d73f0)
// This file was generated by gir (e48471c) from gir-files (71d73f0)
// DO NOT EDIT

use ArrowType;
Expand Down
2 changes: 1 addition & 1 deletion src/auto/aspect_frame.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file was generated by gir (25bba39) from gir-files (71d73f0)
// This file was generated by gir (e48471c) from gir-files (71d73f0)
// DO NOT EDIT

use Bin;
Expand Down
2 changes: 1 addition & 1 deletion src/auto/assistant.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file was generated by gir (25bba39) from gir-files (71d73f0)
// This file was generated by gir (e48471c) from gir-files (71d73f0)
// DO NOT EDIT

use AssistantPageType;
Expand Down
2 changes: 1 addition & 1 deletion src/auto/bin.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file was generated by gir (25bba39) from gir-files (71d73f0)
// This file was generated by gir (e48471c) from gir-files (71d73f0)
// DO NOT EDIT

use Container;
Expand Down
2 changes: 1 addition & 1 deletion src/auto/box_.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file was generated by gir (25bba39) from gir-files (71d73f0)
// This file was generated by gir (e48471c) from gir-files (71d73f0)
// DO NOT EDIT

#[cfg(feature = "v3_10")]
Expand Down
2 changes: 1 addition & 1 deletion src/auto/button.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file was generated by gir (25bba39) from gir-files (71d73f0)
// This file was generated by gir (e48471c) from gir-files (71d73f0)
// DO NOT EDIT

use Actionable;
Expand Down
2 changes: 1 addition & 1 deletion src/auto/button_box.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file was generated by gir (25bba39) from gir-files (71d73f0)
// This file was generated by gir (e48471c) from gir-files (71d73f0)
// DO NOT EDIT

use Box;
Expand Down
2 changes: 1 addition & 1 deletion src/auto/calendar.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file was generated by gir (25bba39) from gir-files (71d73f0)
// This file was generated by gir (e48471c) from gir-files (71d73f0)
// DO NOT EDIT

use CalendarDisplayOptions;
Expand Down
83 changes: 81 additions & 2 deletions src/auto/cell_area.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file was generated by gir (25bba39) from gir-files (71d73f0)
// This file was generated by gir (e48471c) from gir-files (71d73f0)
// DO NOT EDIT

use CellAreaContext;
Expand All @@ -7,17 +7,26 @@ use CellLayout;
use CellRenderer;
use CellRendererState;
use DirectionType;
use Object;
use Orientation;
use SizeRequestMode;
use TreeIter;
use TreeModel;
use TreePath;
use Widget;
use cairo;
use ffi;
use gdk;
use gdk_ffi;
use glib::object::Downcast;
use glib::object::IsA;
use glib::signal::connect;
use glib::translate::*;
use glib_ffi;
use libc;
use std::boxed::Box as Box_;
use std::mem;
use std::mem::transmute;

glib_wrapper! {
pub struct CellArea(Object<ffi::GtkCellArea>): CellLayout;
Expand Down Expand Up @@ -112,9 +121,17 @@ pub trait CellAreaExt {
fn set_focus_cell<T: IsA<CellRenderer>>(&self, renderer: &T);

fn stop_editing(&self, canceled: bool);

fn connect_add_editable<F: Fn(&Self, &CellRenderer, &CellEditable, &gdk::Rectangle, TreePath) + 'static>(&self, f: F) -> u64;

fn connect_apply_attributes<F: Fn(&Self, &TreeModel, &TreeIter, bool, bool) + 'static>(&self, f: F) -> u64;

fn connect_focus_changed<F: Fn(&Self, &CellRenderer, TreePath) + 'static>(&self, f: F) -> u64;

fn connect_remove_editable<F: Fn(&Self, &CellRenderer, &CellEditable) + 'static>(&self, f: F) -> u64;
}

impl<O: IsA<CellArea>> CellAreaExt for O {
impl<O: IsA<CellArea> + IsA<Object>> CellAreaExt for O {
fn activate<T: IsA<Widget>>(&self, context: &CellAreaContext, widget: &T, cell_area: &gdk::Rectangle, flags: CellRendererState, edit_only: bool) -> bool {
unsafe {
from_glib(ffi::gtk_cell_area_activate(self.to_glib_none().0, context.to_glib_none().0, widget.to_glib_none().0, cell_area.to_glib_none().0, flags.to_glib(), edit_only.to_glib()))
Expand Down Expand Up @@ -374,4 +391,66 @@ impl<O: IsA<CellArea>> CellAreaExt for O {
ffi::gtk_cell_area_stop_editing(self.to_glib_none().0, canceled.to_glib());
}
}

fn connect_add_editable<F: Fn(&Self, &CellRenderer, &CellEditable, &gdk::Rectangle, TreePath) + 'static>(&self, f: F) -> u64 {
unsafe {
let f: Box_<Box_<Fn(&Self, &CellRenderer, &CellEditable, &gdk::Rectangle, TreePath) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "add-editable",
transmute(add_editable_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}

fn connect_apply_attributes<F: Fn(&Self, &TreeModel, &TreeIter, bool, bool) + 'static>(&self, f: F) -> u64 {
unsafe {
let f: Box_<Box_<Fn(&Self, &TreeModel, &TreeIter, bool, bool) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "apply-attributes",
transmute(apply_attributes_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}

fn connect_focus_changed<F: Fn(&Self, &CellRenderer, TreePath) + 'static>(&self, f: F) -> u64 {
unsafe {
let f: Box_<Box_<Fn(&Self, &CellRenderer, TreePath) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "focus-changed",
transmute(focus_changed_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}

fn connect_remove_editable<F: Fn(&Self, &CellRenderer, &CellEditable) + 'static>(&self, f: F) -> u64 {
unsafe {
let f: Box_<Box_<Fn(&Self, &CellRenderer, &CellEditable) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "remove-editable",
transmute(remove_editable_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
}

unsafe extern "C" fn add_editable_trampoline<T>(this: *mut ffi::GtkCellArea, renderer: *mut ffi::GtkCellRenderer, editable: *mut ffi::GtkCellEditable, cell_area: *mut gdk_ffi::GdkRectangle, path: *mut libc::c_char, f: glib_ffi::gpointer)
where T: IsA<CellArea> {
callback_guard!();
let f: &Box_<Fn(&T, &CellRenderer, &CellEditable, &gdk::Rectangle, TreePath) + 'static> = transmute(f);
let path = from_glib_full(ffi::gtk_tree_path_new_from_string(path));
f(&CellArea::from_glib_none(this).downcast_unchecked(), &from_glib_none(renderer), &from_glib_none(editable), &from_glib_none(cell_area), path)
}

unsafe extern "C" fn apply_attributes_trampoline<T>(this: *mut ffi::GtkCellArea, model: *mut ffi::GtkTreeModel, iter: *mut ffi::GtkTreeIter, is_expander: glib_ffi::gboolean, is_expanded: glib_ffi::gboolean, f: glib_ffi::gpointer)
where T: IsA<CellArea> {
callback_guard!();
let f: &Box_<Fn(&T, &TreeModel, &TreeIter, bool, bool) + 'static> = transmute(f);
f(&CellArea::from_glib_none(this).downcast_unchecked(), &from_glib_none(model), &from_glib_borrow(iter), from_glib(is_expander), from_glib(is_expanded))
}

unsafe extern "C" fn focus_changed_trampoline<T>(this: *mut ffi::GtkCellArea, renderer: *mut ffi::GtkCellRenderer, path: *mut libc::c_char, f: glib_ffi::gpointer)
where T: IsA<CellArea> {
callback_guard!();
let f: &Box_<Fn(&T, &CellRenderer, TreePath) + 'static> = transmute(f);
let path = from_glib_full(ffi::gtk_tree_path_new_from_string(path));
f(&CellArea::from_glib_none(this).downcast_unchecked(), &from_glib_none(renderer), path)
}

unsafe extern "C" fn remove_editable_trampoline<T>(this: *mut ffi::GtkCellArea, renderer: *mut ffi::GtkCellRenderer, editable: *mut ffi::GtkCellEditable, f: glib_ffi::gpointer)
where T: IsA<CellArea> {
callback_guard!();
let f: &Box_<Fn(&T, &CellRenderer, &CellEditable) + 'static> = transmute(f);
f(&CellArea::from_glib_none(this).downcast_unchecked(), &from_glib_none(renderer), &from_glib_none(editable))
}
2 changes: 1 addition & 1 deletion src/auto/cell_area_box.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file was generated by gir (25bba39) from gir-files (71d73f0)
// This file was generated by gir (e48471c) from gir-files (71d73f0)
// DO NOT EDIT

use CellArea;
Expand Down
2 changes: 1 addition & 1 deletion src/auto/cell_area_context.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file was generated by gir (25bba39) from gir-files (71d73f0)
// This file was generated by gir (e48471c) from gir-files (71d73f0)
// DO NOT EDIT

use CellArea;
Expand Down
2 changes: 1 addition & 1 deletion src/auto/cell_editable.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file was generated by gir (25bba39) from gir-files (71d73f0)
// This file was generated by gir (e48471c) from gir-files (71d73f0)
// DO NOT EDIT

use Object;
Expand Down
2 changes: 1 addition & 1 deletion src/auto/cell_layout.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file was generated by gir (25bba39) from gir-files (71d73f0)
// This file was generated by gir (e48471c) from gir-files (71d73f0)
// DO NOT EDIT

use CellArea;
Expand Down
Loading

0 comments on commit df64887

Please sign in to comment.