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

Commit

Permalink
Generate WidgetPath
Browse files Browse the repository at this point in the history
  • Loading branch information
EPashkin committed Feb 23, 2018
1 parent e29c59d commit 479672c
Show file tree
Hide file tree
Showing 8 changed files with 335 additions and 48 deletions.
5 changes: 5 additions & 0 deletions Gir.toml
Expand Up @@ -223,6 +223,7 @@ generate = [
"Gtk.Viewport",
"Gtk.VolumeButton",
"Gtk.WidgetHelpType",
"Gtk.WidgetPath",
"Gtk.WindowGroup",
"Gtk.WindowPosition",
"Gtk.WindowType",
Expand Down Expand Up @@ -1802,6 +1803,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
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
32 changes: 16 additions & 16 deletions src/auto/icon_info.rs
@@ -1,4 +1,4 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 8b9d0bb)
// This file was generated by gir (https://github.com/gtk-rs/gir @ ef40528)
// from gir-files (https://github.com/gtk-rs/gir-files @ 77d1f70)
// DO NOT EDIT

Expand Down Expand Up @@ -68,20 +68,20 @@ pub trait IconInfoExt {
fn load_icon(&self) -> Result<gdk_pixbuf::Pixbuf, Error>;

#[cfg(any(feature = "v3_8", feature = "dox"))]
fn load_icon_async<'a, P: Into<Option<&'a gio::Cancellable>>, Q: FnOnce(Result<(), Error>) + Send + 'static>(&self, cancellable: P, callback: Q);
fn load_icon_async<'a, P: Into<Option<&'a gio::Cancellable>>, Q: FnOnce(Result<gdk_pixbuf::Pixbuf, Error>) + Send + 'static>(&self, cancellable: P, callback: Q);

#[cfg(any(feature = "v3_10", feature = "dox"))]
fn load_surface<'a, P: Into<Option<&'a gdk::Window>>>(&self, for_window: P) -> Result<cairo::Surface, Error>;

fn load_symbolic<'a, 'b, 'c, P: Into<Option<&'a gdk::RGBA>>, Q: Into<Option<&'b gdk::RGBA>>, R: Into<Option<&'c gdk::RGBA>>>(&self, fg: &gdk::RGBA, success_color: P, warning_color: Q, error_color: R) -> Result<(gdk_pixbuf::Pixbuf, bool), Error>;

#[cfg(any(feature = "v3_8", feature = "dox"))]
fn load_symbolic_async<'a, 'b, 'c, 'd, P: Into<Option<&'a gdk::RGBA>>, Q: Into<Option<&'b gdk::RGBA>>, R: Into<Option<&'c gdk::RGBA>>, S: Into<Option<&'d gio::Cancellable>>, T: FnOnce(Result<bool, Error>) + Send + 'static>(&self, fg: &gdk::RGBA, success_color: P, warning_color: Q, error_color: R, cancellable: S, callback: T);
fn load_symbolic_async<'a, 'b, 'c, 'd, P: Into<Option<&'a gdk::RGBA>>, Q: Into<Option<&'b gdk::RGBA>>, R: Into<Option<&'c gdk::RGBA>>, S: Into<Option<&'d gio::Cancellable>>, T: FnOnce(Result<(gdk_pixbuf::Pixbuf, bool), Error>) + Send + 'static>(&self, fg: &gdk::RGBA, success_color: P, warning_color: Q, error_color: R, cancellable: S, callback: T);

fn load_symbolic_for_context(&self, context: &StyleContext) -> Result<(gdk_pixbuf::Pixbuf, bool), Error>;

#[cfg(any(feature = "v3_8", feature = "dox"))]
fn load_symbolic_for_context_async<'a, P: Into<Option<&'a gio::Cancellable>>, Q: FnOnce(Result<bool, Error>) + Send + 'static>(&self, context: &StyleContext, cancellable: P, callback: Q);
fn load_symbolic_for_context_async<'a, P: Into<Option<&'a gio::Cancellable>>, Q: FnOnce(Result<(gdk_pixbuf::Pixbuf, bool), Error>) + Send + 'static>(&self, context: &StyleContext, cancellable: P, callback: Q);

#[cfg_attr(feature = "v3_14", deprecated)]
fn set_raw_coordinates(&self, raw_coordinates: bool);
Expand Down Expand Up @@ -153,15 +153,15 @@ impl<O: IsA<IconInfo>> IconInfoExt for O {
}

#[cfg(any(feature = "v3_8", feature = "dox"))]
fn load_icon_async<'a, P: Into<Option<&'a gio::Cancellable>>, Q: FnOnce(Result<(), Error>) + Send + 'static>(&self, cancellable: P, callback: Q) {
fn load_icon_async<'a, P: Into<Option<&'a gio::Cancellable>>, Q: FnOnce(Result<gdk_pixbuf::Pixbuf, Error>) + Send + 'static>(&self, cancellable: P, callback: Q) {
let cancellable = cancellable.into();
let cancellable = cancellable.to_glib_none();
let user_data: Box<Box<Q>> = Box::new(Box::new(callback));
unsafe extern "C" fn load_icon_async_trampoline<Q: FnOnce(Result<(), Error>) + Send + 'static>(_source_object: *mut gobject_ffi::GObject, res: *mut gio_ffi::GAsyncResult, user_data: glib_ffi::gpointer)
unsafe extern "C" fn load_icon_async_trampoline<Q: FnOnce(Result<gdk_pixbuf::Pixbuf, Error>) + Send + 'static>(_source_object: *mut gobject_ffi::GObject, res: *mut gio_ffi::GAsyncResult, user_data: glib_ffi::gpointer)
{
let mut error = ptr::null_mut();
let _ = ffi::gtk_icon_info_load_icon_finish(_source_object as *mut _, res, &mut error);
let result = if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) };
let ret = ffi::gtk_icon_info_load_icon_finish(_source_object as *mut _, res, &mut error);
let result = if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) };
let callback: Box<Box<Q>> = Box::from_raw(user_data as *mut _);
callback(result);
}
Expand Down Expand Up @@ -198,7 +198,7 @@ impl<O: IsA<IconInfo>> IconInfoExt for O {
}

#[cfg(any(feature = "v3_8", feature = "dox"))]
fn load_symbolic_async<'a, 'b, 'c, 'd, P: Into<Option<&'a gdk::RGBA>>, Q: Into<Option<&'b gdk::RGBA>>, R: Into<Option<&'c gdk::RGBA>>, S: Into<Option<&'d gio::Cancellable>>, T: FnOnce(Result<bool, Error>) + Send + 'static>(&self, fg: &gdk::RGBA, success_color: P, warning_color: Q, error_color: R, cancellable: S, callback: T) {
fn load_symbolic_async<'a, 'b, 'c, 'd, P: Into<Option<&'a gdk::RGBA>>, Q: Into<Option<&'b gdk::RGBA>>, R: Into<Option<&'c gdk::RGBA>>, S: Into<Option<&'d gio::Cancellable>>, T: FnOnce(Result<(gdk_pixbuf::Pixbuf, bool), Error>) + Send + 'static>(&self, fg: &gdk::RGBA, success_color: P, warning_color: Q, error_color: R, cancellable: S, callback: T) {
let success_color = success_color.into();
let success_color = success_color.to_glib_none();
let warning_color = warning_color.into();
Expand All @@ -208,12 +208,12 @@ impl<O: IsA<IconInfo>> IconInfoExt for O {
let cancellable = cancellable.into();
let cancellable = cancellable.to_glib_none();
let user_data: Box<Box<T>> = Box::new(Box::new(callback));
unsafe extern "C" fn load_symbolic_async_trampoline<T: FnOnce(Result<bool, Error>) + Send + 'static>(_source_object: *mut gobject_ffi::GObject, res: *mut gio_ffi::GAsyncResult, user_data: glib_ffi::gpointer)
unsafe extern "C" fn load_symbolic_async_trampoline<T: FnOnce(Result<(gdk_pixbuf::Pixbuf, bool), Error>) + Send + 'static>(_source_object: *mut gobject_ffi::GObject, res: *mut gio_ffi::GAsyncResult, user_data: glib_ffi::gpointer)
{
let mut error = ptr::null_mut();
let mut was_symbolic = mem::uninitialized();
let _ = ffi::gtk_icon_info_load_symbolic_finish(_source_object as *mut _, res, &mut was_symbolic, &mut error);
let result = if error.is_null() { Ok(from_glib(was_symbolic)) } else { Err(from_glib_full(error)) };
let ret = ffi::gtk_icon_info_load_symbolic_finish(_source_object as *mut _, res, &mut was_symbolic, &mut error);
let result = if error.is_null() { Ok((from_glib_full(ret), from_glib(was_symbolic))) } else { Err(from_glib_full(error)) };
let callback: Box<Box<T>> = Box::from_raw(user_data as *mut _);
callback(result);
}
Expand All @@ -233,16 +233,16 @@ impl<O: IsA<IconInfo>> IconInfoExt for O {
}

#[cfg(any(feature = "v3_8", feature = "dox"))]
fn load_symbolic_for_context_async<'a, P: Into<Option<&'a gio::Cancellable>>, Q: FnOnce(Result<bool, Error>) + Send + 'static>(&self, context: &StyleContext, cancellable: P, callback: Q) {
fn load_symbolic_for_context_async<'a, P: Into<Option<&'a gio::Cancellable>>, Q: FnOnce(Result<(gdk_pixbuf::Pixbuf, bool), Error>) + Send + 'static>(&self, context: &StyleContext, cancellable: P, callback: Q) {
let cancellable = cancellable.into();
let cancellable = cancellable.to_glib_none();
let user_data: Box<Box<Q>> = Box::new(Box::new(callback));
unsafe extern "C" fn load_symbolic_for_context_async_trampoline<Q: FnOnce(Result<bool, Error>) + Send + 'static>(_source_object: *mut gobject_ffi::GObject, res: *mut gio_ffi::GAsyncResult, user_data: glib_ffi::gpointer)
unsafe extern "C" fn load_symbolic_for_context_async_trampoline<Q: FnOnce(Result<(gdk_pixbuf::Pixbuf, bool), Error>) + Send + 'static>(_source_object: *mut gobject_ffi::GObject, res: *mut gio_ffi::GAsyncResult, user_data: glib_ffi::gpointer)
{
let mut error = ptr::null_mut();
let mut was_symbolic = mem::uninitialized();
let _ = ffi::gtk_icon_info_load_symbolic_for_context_finish(_source_object as *mut _, res, &mut was_symbolic, &mut error);
let result = if error.is_null() { Ok(from_glib(was_symbolic)) } else { Err(from_glib_full(error)) };
let ret = ffi::gtk_icon_info_load_symbolic_for_context_finish(_source_object as *mut _, res, &mut was_symbolic, &mut error);
let result = if error.is_null() { Ok((from_glib_full(ret), from_glib(was_symbolic))) } else { Err(from_glib_full(error)) };
let callback: Box<Box<Q>> = Box::from_raw(user_data as *mut _);
callback(result);
}
Expand Down
5 changes: 4 additions & 1 deletion src/auto/mod.rs
@@ -1,4 +1,4 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 8b9d0bb)
// This file was generated by gir (https://github.com/gtk-rs/gir @ bd67955+)
// from gir-files (https://github.com/gtk-rs/gir-files @ 77d1f70)
// DO NOT EDIT

Expand Down 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
23 changes: 14 additions & 9 deletions src/auto/style_context.rs
@@ -1,4 +1,4 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 8b9d0bb)
// This file was generated by gir (https://github.com/gtk-rs/gir @ bd67955+)
// from gir-files (https://github.com/gtk-rs/gir-files @ 77d1f70)
// DO NOT EDIT

Expand All @@ -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*/&mut 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*/&mut 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
33 changes: 20 additions & 13 deletions src/auto/style_provider.rs
@@ -1,7 +1,10 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 8b9d0bb)
// This file was generated by gir (https://github.com/gtk-rs/gir @ bd67955+)
// 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*/&mut 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*/&mut 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*/&mut 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*/&mut 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*/&mut 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*/&mut 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() }
//}
}
13 changes: 8 additions & 5 deletions src/auto/widget.rs
@@ -1,4 +1,4 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 8b9d0bb)
// This file was generated by gir (https://github.com/gtk-rs/gir @ bd67955+)
// from gir-files (https://github.com/gtk-rs/gir-files @ 77d1f70)
// DO NOT EDIT

Expand All @@ -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

0 comments on commit 479672c

Please sign in to comment.