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

Generate WidgetPath #630

Merged
merged 1 commit into from
Mar 3, 2018
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Gir.toml
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ generate = [
"Gtk.Viewport",
"Gtk.VolumeButton",
"Gtk.WidgetHelpType",
"Gtk.WidgetPath",
"Gtk.WindowGroup",
"Gtk.WindowPosition",
"Gtk.WindowType",
Expand Down Expand Up @@ -1814,6 +1815,10 @@ status = "generate"
[[object.function]]
name = "style_get_property"
ignore = true
[[object.function]]
name = "get_path"
[object.function.return]
nullable = false
[[object.signal]]
name = "button-press-event"
inhibit = true
Expand Down
11 changes: 7 additions & 4 deletions src/auto/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use Adjustment;
use Buildable;
use ResizeMode;
use Widget;
use WidgetPath;
use cairo;
use ffi;
use glib;
Expand Down Expand Up @@ -68,7 +69,7 @@ pub trait ContainerExt {

fn get_focus_vadjustment(&self) -> Option<Adjustment>;

//fn get_path_for_child<P: IsA<Widget>>(&self, child: &P) -> /*Ignored*/Option<WidgetPath>;
fn get_path_for_child<P: IsA<Widget>>(&self, child: &P) -> Option<WidgetPath>;

#[cfg_attr(feature = "v3_12", deprecated)]
fn get_resize_mode(&self) -> ResizeMode;
Expand Down Expand Up @@ -207,9 +208,11 @@ impl<O: IsA<Container> + IsA<glib::object::Object>> ContainerExt for O {
}
}

//fn get_path_for_child<P: IsA<Widget>>(&self, child: &P) -> /*Ignored*/Option<WidgetPath> {
// unsafe { TODO: call ffi::gtk_container_get_path_for_child() }
//}
fn get_path_for_child<P: IsA<Widget>>(&self, child: &P) -> Option<WidgetPath> {
unsafe {
from_glib_full(ffi::gtk_container_get_path_for_child(self.to_glib_none().0, child.to_glib_none().0))
}
}

fn get_resize_mode(&self) -> ResizeMode {
unsafe {
Expand Down
3 changes: 3 additions & 0 deletions src/auto/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,9 @@ pub use self::tree_path::TreePath;
mod tree_row_reference;
pub use self::tree_row_reference::TreeRowReference;

mod widget_path;
pub use self::widget_path::WidgetPath;

mod enums;
pub use self::enums::Align;
pub use self::enums::ArrowType;
Expand Down
21 changes: 13 additions & 8 deletions src/auto/style_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use StateType;
use StyleContextPrintFlags;
use StyleProvider;
use TextDirection;
use WidgetPath;
use ffi;
use gdk;
use glib;
Expand Down Expand Up @@ -113,7 +114,7 @@ pub trait StyleContextExt {

fn get_parent(&self) -> Option<StyleContext>;

//fn get_path(&self) -> /*Ignored*/Option<WidgetPath>;
fn get_path(&self) -> Option<WidgetPath>;

#[cfg(any(feature = "v3_10", feature = "dox"))]
fn get_scale(&self) -> i32;
Expand Down Expand Up @@ -184,7 +185,7 @@ pub trait StyleContextExt {

fn set_parent<'a, P: Into<Option<&'a StyleContext>>>(&self, parent: P);

//fn set_path(&self, path: /*Ignored*/&WidgetPath);
fn set_path(&self, path: &WidgetPath);

#[cfg(any(feature = "v3_10", feature = "dox"))]
fn set_scale(&self, scale: i32);
Expand Down Expand Up @@ -317,9 +318,11 @@ impl<O: IsA<StyleContext> + IsA<glib::object::Object>> StyleContextExt for O {
}
}

//fn get_path(&self) -> /*Ignored*/Option<WidgetPath> {
// unsafe { TODO: call ffi::gtk_style_context_get_path() }
//}
fn get_path(&self) -> Option<WidgetPath> {
unsafe {
from_glib_none(ffi::gtk_style_context_get_path(self.to_glib_none().0))
}
}

#[cfg(any(feature = "v3_10", feature = "dox"))]
fn get_scale(&self) -> i32 {
Expand Down Expand Up @@ -487,9 +490,11 @@ impl<O: IsA<StyleContext> + IsA<glib::object::Object>> StyleContextExt for O {
}
}

//fn set_path(&self, path: /*Ignored*/&WidgetPath) {
// unsafe { TODO: call ffi::gtk_style_context_set_path() }
//}
fn set_path(&self, path: &WidgetPath) {
unsafe {
ffi::gtk_style_context_set_path(self.to_glib_none().0, path.to_glib_none().0);
}
}

#[cfg(any(feature = "v3_10", feature = "dox"))]
fn set_scale(&self, scale: i32) {
Expand Down
31 changes: 19 additions & 12 deletions src/auto/style_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
// from gir-files (https://github.com/gtk-rs/gir-files @ 77d1f70)
// DO NOT EDIT

use IconFactory;
use StyleProperties;
use WidgetPath;
use ffi;
use glib::object::IsA;
use glib::translate::*;
Expand All @@ -19,25 +22,29 @@ glib_wrapper! {
}

pub trait StyleProviderExt {
//#[cfg_attr(feature = "v3_8", deprecated)]
//fn get_icon_factory(&self, path: /*Ignored*/&WidgetPath) -> Option<IconFactory>;
#[cfg_attr(feature = "v3_8", deprecated)]
fn get_icon_factory(&self, path: &WidgetPath) -> Option<IconFactory>;

//#[cfg_attr(feature = "v3_8", deprecated)]
//fn get_style(&self, path: /*Ignored*/&WidgetPath) -> Option<StyleProperties>;
#[cfg_attr(feature = "v3_8", deprecated)]
fn get_style(&self, path: &WidgetPath) -> Option<StyleProperties>;

//fn get_style_property<P: IsA</*Ignored*/glib::ParamSpec>>(&self, path: /*Ignored*/&WidgetPath, state: StateFlags, pspec: &P) -> Option<glib::Value>;
//fn get_style_property<P: IsA</*Ignored*/glib::ParamSpec>>(&self, path: &WidgetPath, state: StateFlags, pspec: &P) -> Option<glib::Value>;
}

impl<O: IsA<StyleProvider>> StyleProviderExt for O {
//fn get_icon_factory(&self, path: /*Ignored*/&WidgetPath) -> Option<IconFactory> {
// unsafe { TODO: call ffi::gtk_style_provider_get_icon_factory() }
//}
fn get_icon_factory(&self, path: &WidgetPath) -> Option<IconFactory> {
unsafe {
from_glib_none(ffi::gtk_style_provider_get_icon_factory(self.to_glib_none().0, path.to_glib_none().0))
}
}

//fn get_style(&self, path: /*Ignored*/&WidgetPath) -> Option<StyleProperties> {
// unsafe { TODO: call ffi::gtk_style_provider_get_style() }
//}
fn get_style(&self, path: &WidgetPath) -> Option<StyleProperties> {
unsafe {
from_glib_full(ffi::gtk_style_provider_get_style(self.to_glib_none().0, path.to_glib_none().0))
}
}

//fn get_style_property<P: IsA</*Ignored*/glib::ParamSpec>>(&self, path: /*Ignored*/&WidgetPath, state: StateFlags, pspec: &P) -> Option<glib::Value> {
//fn get_style_property<P: IsA</*Ignored*/glib::ParamSpec>>(&self, path: &WidgetPath, state: StateFlags, pspec: &P) -> Option<glib::Value> {
// unsafe { TODO: call ffi::gtk_style_provider_get_style_property() }
//}
}
11 changes: 7 additions & 4 deletions src/auto/widget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use TargetList;
use TextDirection;
use Tooltip;
use WidgetHelpType;
use WidgetPath;
use Window;
use cairo;
use cairo_ffi;
Expand Down Expand Up @@ -289,7 +290,7 @@ pub trait WidgetExt {

fn get_parent_window(&self) -> Option<gdk::Window>;

//fn get_path(&self) -> /*Ignored*/Option<WidgetPath>;
fn get_path(&self) -> WidgetPath;

fn get_preferred_height(&self) -> (i32, i32);

Expand Down Expand Up @@ -1432,9 +1433,11 @@ impl<O: IsA<Widget> + IsA<glib::object::Object> + glib::object::ObjectExt> Widge
}
}

//fn get_path(&self) -> /*Ignored*/Option<WidgetPath> {
// unsafe { TODO: call ffi::gtk_widget_get_path() }
//}
fn get_path(&self) -> WidgetPath {
unsafe {
from_glib_none(ffi::gtk_widget_get_path(self.to_glib_none().0))
}
}

fn get_preferred_height(&self) -> (i32, i32) {
unsafe {
Expand Down
Loading