-
-
Notifications
You must be signed in to change notification settings - Fork 82
Generate GtkStyleContext get property functions #876
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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<WidgetPath>; | ||
|
||
fn get_property(&self, property: &str, state: StateFlags) -> glib::Value; | ||
|
||
fn get_scale(&self) -> i32; | ||
|
||
fn get_screen(&self) -> Option<gdk::Screen>; | ||
|
@@ -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); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah that's why it was ignored probably... this should return an There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure why gir gets the other function right and this one not though... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @EPashkin any guess? :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMHO because parameter not marked as
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That could be fixed with some addition to |
||
|
||
//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<O: IsA<StyleContext>> 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<O: IsA<StyleContext>> 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, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. May be this function better be manual as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not sure that it can return There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What would it return if the property name is invalid though? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Docs don't say that in both cases :( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Code says There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could have manual code that initializes the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looking into it, this function is deprecated (though not documented as such). Maybe we could ignore this one, and fix There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, works for me. Since when is the other function deprecated? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe they meant that it's deprecated as in "does not exist in GTK4 anymore". I think for the "deprecated" one the way forward is to panic if it fails (the The other one, if we can check beforehand then let's do that or otherwise like above. |
||
); | ||
} | ||
} | ||
|
||
//fn get_style_valist(&self, args: /*Unknown conversion*//*Unimplemented*/Unsupported) { | ||
// unsafe { TODO: call gtk_sys:gtk_style_context_get_style_valist() } | ||
//} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And also this should be
Option
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can probably be configured in the toml by marking the return type as nullable