From 3dae50428b1ab5e47e0f0a845994f8ed84a08898 Mon Sep 17 00:00:00 2001 From: Christopher Davis Date: Wed, 14 Aug 2019 12:15:19 -0700 Subject: [PATCH] Generate GtkStyleContext get property functions These were ignored previously. Fixes https://github.com/gtk-rs/gtk/issues/874 --- Gir.toml | 3 --- src/auto/style_context.rs | 28 ++++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/Gir.toml b/Gir.toml index a1a1801329..cb2e75d423 100644 --- a/Gir.toml +++ b/Gir.toml @@ -1765,9 +1765,6 @@ status = "ignore" [[object]] name = "Gtk.StyleContext" status = "generate" - [[object.function]] - pattern = "get_(style_)?property" - ignore = true [[object.function]] name = "get_font" ignore = true #returning Pango.FontDescription from *const diff --git a/src/auto/style_context.rs b/src/auto/style_context.rs index 4c4e537e3a..922dcdc450 100644 --- a/src/auto/style_context.rs +++ b/src/auto/style_context.rs @@ -3,6 +3,7 @@ // DO NOT EDIT use gdk; +use glib; use glib::object::Cast; use glib::object::IsA; use glib::signal::connect_raw; @@ -170,6 +171,8 @@ pub trait StyleContextExt: 'static { fn get_path(&self) -> Option; + fn get_property(&self, property: &str, state: StateFlags) -> glib::Value; + fn get_scale(&self) -> i32; fn get_screen(&self) -> Option; @@ -180,6 +183,8 @@ pub trait StyleContextExt: 'static { //fn get_style(&self, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs); + fn get_style_property(&self, property_name: &str, value: &mut glib::Value); + //fn get_style_valist(&self, args: /*Unknown conversion*//*Unimplemented*/Unsupported); //fn get_valist(&self, state: StateFlags, args: /*Unknown conversion*//*Unimplemented*/Unsupported); @@ -365,6 +370,19 @@ impl> StyleContextExt for O { } } + fn get_property(&self, property: &str, state: StateFlags) -> glib::Value { + unsafe { + let mut value = glib::Value::uninitialized(); + gtk_sys::gtk_style_context_get_property( + self.as_ref().to_glib_none().0, + property.to_glib_none().0, + state.to_glib(), + value.to_glib_none_mut().0, + ); + value + } + } + fn get_scale(&self) -> i32 { unsafe { gtk_sys::gtk_style_context_get_scale(self.as_ref().to_glib_none().0) } } @@ -398,6 +416,16 @@ impl> StyleContextExt for O { // unsafe { TODO: call gtk_sys:gtk_style_context_get_style() } //} + fn get_style_property(&self, property_name: &str, value: &mut glib::Value) { + unsafe { + gtk_sys::gtk_style_context_get_style_property( + self.as_ref().to_glib_none().0, + property_name.to_glib_none().0, + value.to_glib_none_mut().0, + ); + } + } + //fn get_style_valist(&self, args: /*Unknown conversion*//*Unimplemented*/Unsupported) { // unsafe { TODO: call gtk_sys:gtk_style_context_get_style_valist() } //}