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

Add Buildable interface #568

Merged
merged 2 commits into from Nov 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions Gir.toml
Expand Up @@ -480,6 +480,13 @@ status = "generate"
name = "baseline-position"
version = "3.10"

[[object]]
name = "Gtk.Buildable"
status = "generate"
[[object.function]]
pattern = "[gs]et_name"
ignore = true

[[object]]
name = "Gtk.CellArea"
status = "generate"
Expand Down
2 changes: 1 addition & 1 deletion gir
5 changes: 3 additions & 2 deletions src/auto/about_dialog.rs
@@ -1,7 +1,8 @@
// This file was generated by gir (0409d73) from gir-files (469db10)
// This file was generated by gir (e912ccf) from gir-files (469db10)
// DO NOT EDIT

use Bin;
use Buildable;
use Container;
use Dialog;
use License;
Expand All @@ -25,7 +26,7 @@ use std::mem::transmute;
use std::ptr;

glib_wrapper! {
pub struct AboutDialog(Object<ffi::GtkAboutDialog, ffi::GtkAboutDialogClass>): Dialog, Window, Bin, Container, Widget;
pub struct AboutDialog(Object<ffi::GtkAboutDialog, ffi::GtkAboutDialogClass>): Dialog, Window, Bin, Container, Widget, Buildable;

match fn {
get_type => || ffi::gtk_about_dialog_get_type(),
Expand Down
2 changes: 1 addition & 1 deletion src/auto/accel_group.rs
@@ -1,4 +1,4 @@
// This file was generated by gir (0409d73) from gir-files (469db10)
// This file was generated by gir (e912ccf) from gir-files (469db10)
// DO NOT EDIT

use ffi;
Expand Down
5 changes: 3 additions & 2 deletions src/auto/action_bar.rs
@@ -1,7 +1,8 @@
// This file was generated by gir (0409d73) from gir-files (469db10)
// This file was generated by gir (e912ccf) from gir-files (469db10)
// DO NOT EDIT

use Bin;
use Buildable;
use Container;
use PackType;
use Widget;
Expand All @@ -17,7 +18,7 @@ use std::mem::transmute;
use std::ptr;

glib_wrapper! {
pub struct ActionBar(Object<ffi::GtkActionBar, ffi::GtkActionBarClass>): Bin, Container, Widget;
pub struct ActionBar(Object<ffi::GtkActionBar, ffi::GtkActionBarClass>): Bin, Container, Widget, Buildable;

match fn {
get_type => || ffi::gtk_action_bar_get_type(),
Expand Down
5 changes: 3 additions & 2 deletions src/auto/actionable.rs
@@ -1,6 +1,7 @@
// This file was generated by gir (0409d73) from gir-files (469db10)
// This file was generated by gir (e912ccf) from gir-files (469db10)
// DO NOT EDIT

use Buildable;
use Widget;
use ffi;
use glib;
Expand All @@ -17,7 +18,7 @@ use std::mem::transmute;
use std::ptr;

glib_wrapper! {
pub struct Actionable(Object<ffi::GtkActionable, ffi::GtkActionableInterface>): Widget;
pub struct Actionable(Object<ffi::GtkActionable, ffi::GtkActionableInterface>): Widget, Buildable;

match fn {
get_type => || ffi::gtk_actionable_get_type(),
Expand Down
2 changes: 1 addition & 1 deletion src/auto/adjustment.rs
@@ -1,4 +1,4 @@
// This file was generated by gir (0409d73) from gir-files (469db10)
// This file was generated by gir (e912ccf) from gir-files (469db10)
// DO NOT EDIT

use ffi;
Expand Down
5 changes: 3 additions & 2 deletions src/auto/alignment.rs
@@ -1,7 +1,8 @@
// This file was generated by gir (0409d73) from gir-files (469db10)
// This file was generated by gir (e912ccf) from gir-files (469db10)
// DO NOT EDIT

use Bin;
use Buildable;
use Container;
use Widget;
use ffi;
Expand All @@ -20,7 +21,7 @@ use std::mem::transmute;
use std::ptr;

glib_wrapper! {
pub struct Alignment(Object<ffi::GtkAlignment, ffi::GtkAlignmentClass>): Bin, Container, Widget;
pub struct Alignment(Object<ffi::GtkAlignment, ffi::GtkAlignmentClass>): Bin, Container, Widget, Buildable;

match fn {
get_type => || ffi::gtk_alignment_get_type(),
Expand Down
5 changes: 3 additions & 2 deletions src/auto/app_chooser_dialog.rs
@@ -1,8 +1,9 @@
// This file was generated by gir (0409d73) from gir-files (469db10)
// This file was generated by gir (e912ccf) from gir-files (469db10)
// DO NOT EDIT

use AppChooser;
use Bin;
use Buildable;
use Container;
use Dialog;
use DialogFlags;
Expand All @@ -23,7 +24,7 @@ use std::mem::transmute;
use std::ptr;

glib_wrapper! {
pub struct AppChooserDialog(Object<ffi::GtkAppChooserDialog, ffi::GtkAppChooserDialogClass>): Dialog, Window, Bin, Container, Widget, AppChooser;
pub struct AppChooserDialog(Object<ffi::GtkAppChooserDialog, ffi::GtkAppChooserDialogClass>): Dialog, Window, Bin, Container, Widget, Buildable, AppChooser;

match fn {
get_type => || ffi::gtk_app_chooser_dialog_get_type(),
Expand Down
5 changes: 3 additions & 2 deletions src/auto/app_chooser_widget.rs
@@ -1,8 +1,9 @@
// This file was generated by gir (0409d73) from gir-files (469db10)
// This file was generated by gir (e912ccf) from gir-files (469db10)
// DO NOT EDIT

use AppChooser;
use Box;
use Buildable;
use Container;
use Menu;
use Orientable;
Expand All @@ -24,7 +25,7 @@ use std::mem::transmute;
use std::ptr;

glib_wrapper! {
pub struct AppChooserWidget(Object<ffi::GtkAppChooserWidget, ffi::GtkAppChooserWidgetClass>): Box, Container, Widget, Orientable, AppChooser;
pub struct AppChooserWidget(Object<ffi::GtkAppChooserWidget, ffi::GtkAppChooserWidgetClass>): Box, Container, Widget, Buildable, Orientable, AppChooser;

match fn {
get_type => || ffi::gtk_app_chooser_widget_get_type(),
Expand Down
2 changes: 1 addition & 1 deletion src/auto/application.rs
@@ -1,4 +1,4 @@
// This file was generated by gir (0409d73) from gir-files (469db10)
// This file was generated by gir (e912ccf) from gir-files (469db10)
// DO NOT EDIT

use ApplicationInhibitFlags;
Expand Down
4 changes: 3 additions & 1 deletion src/auto/application_window.rs
@@ -1,8 +1,9 @@
// This file was generated by gir (0409d73) from gir-files (469db10)
// This file was generated by gir (e912ccf) from gir-files (469db10)
// DO NOT EDIT

use Application;
use Bin;
use Buildable;
use Container;
#[cfg(any(feature = "v3_20", feature = "dox"))]
use ShortcutsWindow;
Expand Down Expand Up @@ -30,6 +31,7 @@ glib_wrapper! {
Bin,
Container,
Widget,
Buildable,
gio::ActionGroup => gio_ffi::GActionGroup,
gio::ActionMap => gio_ffi::GActionMap,
];
Expand Down
5 changes: 3 additions & 2 deletions src/auto/arrow.rs
@@ -1,7 +1,8 @@
// This file was generated by gir (0409d73) from gir-files (469db10)
// This file was generated by gir (e912ccf) from gir-files (469db10)
// DO NOT EDIT

use ArrowType;
use Buildable;
use Misc;
use ShadowType;
use Widget;
Expand All @@ -21,7 +22,7 @@ use std::mem::transmute;
use std::ptr;

glib_wrapper! {
pub struct Arrow(Object<ffi::GtkArrow, ffi::GtkArrowClass>): Misc, Widget;
pub struct Arrow(Object<ffi::GtkArrow, ffi::GtkArrowClass>): Misc, Widget, Buildable;

match fn {
get_type => || ffi::gtk_arrow_get_type(),
Expand Down
5 changes: 3 additions & 2 deletions src/auto/aspect_frame.rs
@@ -1,7 +1,8 @@
// This file was generated by gir (0409d73) from gir-files (469db10)
// This file was generated by gir (e912ccf) from gir-files (469db10)
// DO NOT EDIT

use Bin;
use Buildable;
use Container;
use Frame;
use Widget;
Expand All @@ -21,7 +22,7 @@ use std::mem::transmute;
use std::ptr;

glib_wrapper! {
pub struct AspectFrame(Object<ffi::GtkAspectFrame, ffi::GtkAspectFrameClass>): Frame, Bin, Container, Widget;
pub struct AspectFrame(Object<ffi::GtkAspectFrame, ffi::GtkAspectFrameClass>): Frame, Bin, Container, Widget, Buildable;

match fn {
get_type => || ffi::gtk_aspect_frame_get_type(),
Expand Down
5 changes: 3 additions & 2 deletions src/auto/assistant.rs
@@ -1,8 +1,9 @@
// This file was generated by gir (0409d73) from gir-files (469db10)
// This file was generated by gir (e912ccf) from gir-files (469db10)
// DO NOT EDIT

use AssistantPageType;
use Bin;
use Buildable;
use Container;
use Widget;
use Window;
Expand All @@ -22,7 +23,7 @@ use std::mem::transmute;
use std::ptr;

glib_wrapper! {
pub struct Assistant(Object<ffi::GtkAssistant, ffi::GtkAssistantClass>): Window, Bin, Container, Widget;
pub struct Assistant(Object<ffi::GtkAssistant, ffi::GtkAssistantClass>): Window, Bin, Container, Widget, Buildable;

match fn {
get_type => || ffi::gtk_assistant_get_type(),
Expand Down
5 changes: 3 additions & 2 deletions src/auto/bin.rs
@@ -1,6 +1,7 @@
// This file was generated by gir (0409d73) from gir-files (469db10)
// This file was generated by gir (e912ccf) from gir-files (469db10)
// DO NOT EDIT

use Buildable;
use Container;
use Widget;
use ffi;
Expand All @@ -12,7 +13,7 @@ use std::mem;
use std::ptr;

glib_wrapper! {
pub struct Bin(Object<ffi::GtkBin, ffi::GtkBinClass>): Container, Widget;
pub struct Bin(Object<ffi::GtkBin, ffi::GtkBinClass>): Container, Widget, Buildable;

match fn {
get_type => || ffi::gtk_bin_get_type(),
Expand Down
5 changes: 3 additions & 2 deletions src/auto/box_.rs
@@ -1,8 +1,9 @@
// This file was generated by gir (0409d73) from gir-files (469db10)
// This file was generated by gir (e912ccf) from gir-files (469db10)
// DO NOT EDIT

#[cfg(any(feature = "v3_10", feature = "dox"))]
use BaselinePosition;
use Buildable;
use Container;
use Orientable;
use Orientation;
Expand All @@ -24,7 +25,7 @@ use std::mem::transmute;
use std::ptr;

glib_wrapper! {
pub struct Box(Object<ffi::GtkBox, ffi::GtkBoxClass>): Container, Widget, Orientable;
pub struct Box(Object<ffi::GtkBox, ffi::GtkBoxClass>): Container, Widget, Buildable, Orientable;

match fn {
get_type => || ffi::gtk_box_get_type(),
Expand Down
84 changes: 84 additions & 0 deletions src/auto/buildable.rs
@@ -0,0 +1,84 @@
// This file was generated by gir (e912ccf) from gir-files (469db10)
// DO NOT EDIT

use Builder;
use ffi;
use glib;
use glib::object::IsA;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use std::mem;
use std::ptr;

glib_wrapper! {
pub struct Buildable(Object<ffi::GtkBuildable, ffi::GtkBuildableIface>);

match fn {
get_type => || ffi::gtk_buildable_get_type(),
}
}

pub trait BuildableExt {
fn add_child<'a, P: IsA<glib::Object>, Q: Into<Option<&'a str>>>(&self, builder: &Builder, child: &P, type_: Q);

fn construct_child(&self, builder: &Builder, name: &str) -> Option<glib::Object>;

//fn custom_finished<'a, P: IsA<glib::Object> + 'a, Q: Into<Option<&'a P>>, R: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, builder: &Builder, child: Q, tagname: &str, data: R);

//fn custom_tag_end<'a, P: IsA<glib::Object> + 'a, Q: Into<Option<&'a P>>, R: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, builder: &Builder, child: Q, tagname: &str, data: R);

//fn custom_tag_start<'a, P: IsA<glib::Object> + 'a, Q: Into<Option<&'a P>>>(&self, builder: &Builder, child: Q, tagname: &str, parser: /*Ignored*/glib::MarkupParser, data: /*Unimplemented*/&mut Option<Fundamental: Pointer>) -> bool;

fn get_internal_child(&self, builder: &Builder, childname: &str) -> Option<glib::Object>;

fn parser_finished(&self, builder: &Builder);

fn set_buildable_property(&self, builder: &Builder, name: &str, value: &glib::Value);
}

impl<O: IsA<Buildable>> BuildableExt for O {
fn add_child<'a, P: IsA<glib::Object>, Q: Into<Option<&'a str>>>(&self, builder: &Builder, child: &P, type_: Q) {
let type_ = type_.into();
let type_ = type_.to_glib_none();
unsafe {
ffi::gtk_buildable_add_child(self.to_glib_none().0, builder.to_glib_none().0, child.to_glib_none().0, type_.0);
}
}

fn construct_child(&self, builder: &Builder, name: &str) -> Option<glib::Object> {
unsafe {
from_glib_full(ffi::gtk_buildable_construct_child(self.to_glib_none().0, builder.to_glib_none().0, name.to_glib_none().0))
}
}

//fn custom_finished<'a, P: IsA<glib::Object> + 'a, Q: Into<Option<&'a P>>, R: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, builder: &Builder, child: Q, tagname: &str, data: R) {
// unsafe { TODO: call ffi::gtk_buildable_custom_finished() }
//}

//fn custom_tag_end<'a, P: IsA<glib::Object> + 'a, Q: Into<Option<&'a P>>, R: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, builder: &Builder, child: Q, tagname: &str, data: R) {
// unsafe { TODO: call ffi::gtk_buildable_custom_tag_end() }
//}

//fn custom_tag_start<'a, P: IsA<glib::Object> + 'a, Q: Into<Option<&'a P>>>(&self, builder: &Builder, child: Q, tagname: &str, parser: /*Ignored*/glib::MarkupParser, data: /*Unimplemented*/&mut Option<Fundamental: Pointer>) -> bool {
// unsafe { TODO: call ffi::gtk_buildable_custom_tag_start() }
//}

fn get_internal_child(&self, builder: &Builder, childname: &str) -> Option<glib::Object> {
unsafe {
from_glib_none(ffi::gtk_buildable_get_internal_child(self.to_glib_none().0, builder.to_glib_none().0, childname.to_glib_none().0))
}
}

fn parser_finished(&self, builder: &Builder) {
unsafe {
ffi::gtk_buildable_parser_finished(self.to_glib_none().0, builder.to_glib_none().0);
}
}

fn set_buildable_property(&self, builder: &Builder, name: &str, value: &glib::Value) {
unsafe {
ffi::gtk_buildable_set_buildable_property(self.to_glib_none().0, builder.to_glib_none().0, name.to_glib_none().0, value.to_glib_none().0);
}
}
}
2 changes: 1 addition & 1 deletion src/auto/builder.rs
@@ -1,4 +1,4 @@
// This file was generated by gir (0409d73) from gir-files (469db10)
// This file was generated by gir (e912ccf) from gir-files (469db10)
// DO NOT EDIT

#[cfg(any(feature = "v3_10", feature = "dox"))]
Expand Down
5 changes: 3 additions & 2 deletions src/auto/button.rs
@@ -1,8 +1,9 @@
// This file was generated by gir (0409d73) from gir-files (469db10)
// This file was generated by gir (e912ccf) from gir-files (469db10)
// DO NOT EDIT

use Actionable;
use Bin;
use Buildable;
use Container;
use PositionType;
use ReliefStyle;
Expand All @@ -24,7 +25,7 @@ use std::mem::transmute;
use std::ptr;

glib_wrapper! {
pub struct Button(Object<ffi::GtkButton, ffi::GtkButtonClass>): Bin, Container, Widget, Actionable;
pub struct Button(Object<ffi::GtkButton, ffi::GtkButtonClass>): Bin, Container, Widget, Buildable, Actionable;

match fn {
get_type => || ffi::gtk_button_get_type(),
Expand Down
5 changes: 3 additions & 2 deletions src/auto/button_box.rs
@@ -1,7 +1,8 @@
// This file was generated by gir (0409d73) from gir-files (469db10)
// This file was generated by gir (e912ccf) from gir-files (469db10)
// DO NOT EDIT

use Box;
use Buildable;
use ButtonBoxStyle;
use Container;
use Orientable;
Expand All @@ -23,7 +24,7 @@ use std::mem::transmute;
use std::ptr;

glib_wrapper! {
pub struct ButtonBox(Object<ffi::GtkButtonBox, ffi::GtkButtonBoxClass>): Box, Container, Widget, Orientable;
pub struct ButtonBox(Object<ffi::GtkButtonBox, ffi::GtkButtonBoxClass>): Box, Container, Widget, Buildable, Orientable;

match fn {
get_type => || ffi::gtk_button_box_get_type(),
Expand Down