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

Commit 42ad618

Browse files
Merge pull request #599 from EPashkin/typed_properties
Typed properties
2 parents c6376af + f1e8257 commit 42ad618

File tree

196 files changed

+1963
-1355
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

196 files changed

+1963
-1355
lines changed

Gir.toml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ generate = [
126126
"Gtk.PageSet",
127127
"Gtk.PanDirection",
128128
"Gtk.PlacesOpenFlags",
129-
"Gtk.PlacesSidebar",
130129
"Gtk.PolicyType",
131130
"Gtk.PopoverConstraint",
132131
"Gtk.PositionType",
@@ -272,6 +271,7 @@ manual = [
272271
"Gio.Application",
273272
"Gio.ApplicationFlags",
274273
"Gio.Cancellable",
274+
"Gio.File",
275275
"Gio.Icon",
276276
"Gio.Menu",
277277
"Gio.MenuModel",
@@ -1098,6 +1098,18 @@ status = "generate"
10981098
name = "is_ipp"
10991099
version = "3.16"
11001100

1101+
[[object]]
1102+
name = "Gtk.PlacesSidebar"
1103+
status = "generate"
1104+
[[object.signal]]
1105+
name = "drag-action-requested"
1106+
#[gio::File]
1107+
ignore = true
1108+
[[object.signal]]
1109+
name = "drag-perform-drop"
1110+
#[gio::File]
1111+
ignore = true
1112+
11011113
[[object]]
11021114
name = "Gtk.PrintContext"
11031115
status = "generate"

src/auto/about_dialog.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// This file was generated by gir (d933f9a) from gir-files (469db10)
1+
// This file was generated by gir (d50d839) from gir-files (469db10)
22
// DO NOT EDIT
33

44
use Bin;

src/auto/accel_group.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// This file was generated by gir (d933f9a) from gir-files (469db10)
1+
// This file was generated by gir (d50d839) from gir-files (469db10)
22
// DO NOT EDIT
33

44
use ffi;

src/auto/action_bar.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// This file was generated by gir (d933f9a) from gir-files (469db10)
1+
// This file was generated by gir (d50d839) from gir-files (469db10)
22
// DO NOT EDIT
33

44
use Bin;
@@ -7,14 +7,14 @@ use Container;
77
use PackType;
88
use Widget;
99
use ffi;
10+
use glib::StaticType;
1011
use glib::Value;
1112
use glib::object::Downcast;
1213
use glib::object::IsA;
1314
use glib::translate::*;
1415
use glib_ffi;
1516
use gobject_ffi;
1617
use std::mem;
17-
use std::mem::transmute;
1818
use std::ptr;
1919

2020
glib_wrapper! {
@@ -96,26 +96,27 @@ impl<O: IsA<ActionBar> + IsA<Container>> ActionBarExt for O {
9696
}
9797

9898
fn get_child_pack_type<T: IsA<Widget>>(&self, item: &T) -> PackType {
99-
let mut value = Value::from(&0);
10099
unsafe {
100+
let mut value = Value::uninitialized();
101+
gobject_ffi::g_value_init(value.to_glib_none_mut().0, <PackType as StaticType>::static_type().to_glib());
101102
ffi::gtk_container_child_get_property(self.to_glib_none().0, item.to_glib_none().0, "pack-type".to_glib_none().0, value.to_glib_none_mut().0);
102-
from_glib(transmute(value.get::<i32>().unwrap()))
103+
value.get().unwrap()
103104
}
104105
}
105106

106107
fn set_child_pack_type<T: IsA<Widget>>(&self, item: &T, pack_type: PackType) {
107-
let pack_type = pack_type.to_glib() as i32;
108108
unsafe {
109109
ffi::gtk_container_child_set_property(self.to_glib_none().0, item.to_glib_none().0, "pack-type".to_glib_none().0, Value::from(&pack_type).to_glib_none().0);
110110
}
111111
}
112112

113113
fn get_child_position<T: IsA<Widget>>(&self, item: &T) -> i32 {
114-
let mut value = Value::from(&0);
115114
unsafe {
115+
let mut value = Value::uninitialized();
116+
gobject_ffi::g_value_init(value.to_glib_none_mut().0, <i32 as StaticType>::static_type().to_glib());
116117
ffi::gtk_container_child_get_property(self.to_glib_none().0, item.to_glib_none().0, "position".to_glib_none().0, value.to_glib_none_mut().0);
118+
value.get().unwrap()
117119
}
118-
value.get().unwrap()
119120
}
120121

121122
fn set_child_position<T: IsA<Widget>>(&self, item: &T, position: i32) {

src/auto/actionable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// This file was generated by gir (d933f9a) from gir-files (469db10)
1+
// This file was generated by gir (d50d839) from gir-files (469db10)
22
// DO NOT EDIT
33

44
use Buildable;

src/auto/adjustment.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// This file was generated by gir (d933f9a) from gir-files (469db10)
1+
// This file was generated by gir (d50d839) from gir-files (469db10)
22
// DO NOT EDIT
33

44
use ffi;

src/auto/alignment.rs

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// This file was generated by gir (d933f9a) from gir-files (469db10)
1+
// This file was generated by gir (d50d839) from gir-files (469db10)
22
// DO NOT EDIT
33

44
use Bin;
@@ -7,6 +7,7 @@ use Container;
77
use Widget;
88
use ffi;
99
use glib;
10+
use glib::StaticType;
1011
use glib::Value;
1112
use glib::object::Downcast;
1213
use glib::object::IsA;
@@ -118,11 +119,12 @@ impl<O: IsA<Alignment> + IsA<glib::object::Object>> AlignmentExt for O {
118119
}
119120

120121
fn get_property_bottom_padding(&self) -> u32 {
121-
let mut value = Value::from(&0u32);
122122
unsafe {
123+
let mut value = Value::uninitialized();
124+
gobject_ffi::g_value_init(value.to_glib_none_mut().0, <u32 as StaticType>::static_type().to_glib());
123125
gobject_ffi::g_object_get_property(self.to_glib_none().0, "bottom-padding".to_glib_none().0, value.to_glib_none_mut().0);
126+
value.get().unwrap()
124127
}
125-
value.get().unwrap()
126128
}
127129

128130
fn set_property_bottom_padding(&self, bottom_padding: u32) {
@@ -132,11 +134,12 @@ impl<O: IsA<Alignment> + IsA<glib::object::Object>> AlignmentExt for O {
132134
}
133135

134136
fn get_property_left_padding(&self) -> u32 {
135-
let mut value = Value::from(&0u32);
136137
unsafe {
138+
let mut value = Value::uninitialized();
139+
gobject_ffi::g_value_init(value.to_glib_none_mut().0, <u32 as StaticType>::static_type().to_glib());
137140
gobject_ffi::g_object_get_property(self.to_glib_none().0, "left-padding".to_glib_none().0, value.to_glib_none_mut().0);
141+
value.get().unwrap()
138142
}
139-
value.get().unwrap()
140143
}
141144

142145
fn set_property_left_padding(&self, left_padding: u32) {
@@ -146,11 +149,12 @@ impl<O: IsA<Alignment> + IsA<glib::object::Object>> AlignmentExt for O {
146149
}
147150

148151
fn get_property_right_padding(&self) -> u32 {
149-
let mut value = Value::from(&0u32);
150152
unsafe {
153+
let mut value = Value::uninitialized();
154+
gobject_ffi::g_value_init(value.to_glib_none_mut().0, <u32 as StaticType>::static_type().to_glib());
151155
gobject_ffi::g_object_get_property(self.to_glib_none().0, "right-padding".to_glib_none().0, value.to_glib_none_mut().0);
156+
value.get().unwrap()
152157
}
153-
value.get().unwrap()
154158
}
155159

156160
fn set_property_right_padding(&self, right_padding: u32) {
@@ -160,11 +164,12 @@ impl<O: IsA<Alignment> + IsA<glib::object::Object>> AlignmentExt for O {
160164
}
161165

162166
fn get_property_top_padding(&self) -> u32 {
163-
let mut value = Value::from(&0u32);
164167
unsafe {
168+
let mut value = Value::uninitialized();
169+
gobject_ffi::g_value_init(value.to_glib_none_mut().0, <u32 as StaticType>::static_type().to_glib());
165170
gobject_ffi::g_object_get_property(self.to_glib_none().0, "top-padding".to_glib_none().0, value.to_glib_none_mut().0);
171+
value.get().unwrap()
166172
}
167-
value.get().unwrap()
168173
}
169174

170175
fn set_property_top_padding(&self, top_padding: u32) {
@@ -174,11 +179,12 @@ impl<O: IsA<Alignment> + IsA<glib::object::Object>> AlignmentExt for O {
174179
}
175180

176181
fn get_property_xalign(&self) -> f32 {
177-
let mut value = Value::from(&0f32);
178182
unsafe {
183+
let mut value = Value::uninitialized();
184+
gobject_ffi::g_value_init(value.to_glib_none_mut().0, <f32 as StaticType>::static_type().to_glib());
179185
gobject_ffi::g_object_get_property(self.to_glib_none().0, "xalign".to_glib_none().0, value.to_glib_none_mut().0);
186+
value.get().unwrap()
180187
}
181-
value.get().unwrap()
182188
}
183189

184190
fn set_property_xalign(&self, xalign: f32) {
@@ -188,11 +194,12 @@ impl<O: IsA<Alignment> + IsA<glib::object::Object>> AlignmentExt for O {
188194
}
189195

190196
fn get_property_xscale(&self) -> f32 {
191-
let mut value = Value::from(&0f32);
192197
unsafe {
198+
let mut value = Value::uninitialized();
199+
gobject_ffi::g_value_init(value.to_glib_none_mut().0, <f32 as StaticType>::static_type().to_glib());
193200
gobject_ffi::g_object_get_property(self.to_glib_none().0, "xscale".to_glib_none().0, value.to_glib_none_mut().0);
201+
value.get().unwrap()
194202
}
195-
value.get().unwrap()
196203
}
197204

198205
fn set_property_xscale(&self, xscale: f32) {
@@ -202,11 +209,12 @@ impl<O: IsA<Alignment> + IsA<glib::object::Object>> AlignmentExt for O {
202209
}
203210

204211
fn get_property_yalign(&self) -> f32 {
205-
let mut value = Value::from(&0f32);
206212
unsafe {
213+
let mut value = Value::uninitialized();
214+
gobject_ffi::g_value_init(value.to_glib_none_mut().0, <f32 as StaticType>::static_type().to_glib());
207215
gobject_ffi::g_object_get_property(self.to_glib_none().0, "yalign".to_glib_none().0, value.to_glib_none_mut().0);
216+
value.get().unwrap()
208217
}
209-
value.get().unwrap()
210218
}
211219

212220
fn set_property_yalign(&self, yalign: f32) {
@@ -216,11 +224,12 @@ impl<O: IsA<Alignment> + IsA<glib::object::Object>> AlignmentExt for O {
216224
}
217225

218226
fn get_property_yscale(&self) -> f32 {
219-
let mut value = Value::from(&0f32);
220227
unsafe {
228+
let mut value = Value::uninitialized();
229+
gobject_ffi::g_value_init(value.to_glib_none_mut().0, <f32 as StaticType>::static_type().to_glib());
221230
gobject_ffi::g_object_get_property(self.to_glib_none().0, "yscale".to_glib_none().0, value.to_glib_none_mut().0);
231+
value.get().unwrap()
222232
}
223-
value.get().unwrap()
224233
}
225234

226235
fn set_property_yscale(&self, yscale: f32) {

src/auto/app_chooser_dialog.rs

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// This file was generated by gir (d933f9a) from gir-files (469db10)
1+
// This file was generated by gir (d50d839) from gir-files (469db10)
22
// DO NOT EDIT
33

44
use AppChooser;
@@ -10,7 +10,10 @@ use DialogFlags;
1010
use Widget;
1111
use Window;
1212
use ffi;
13+
use gio;
1314
use glib;
15+
use glib::StaticType;
16+
use glib::Value;
1417
use glib::object::Downcast;
1518
use glib::object::IsA;
1619
use glib::signal::SignalHandlerId;
@@ -32,9 +35,14 @@ glib_wrapper! {
3235
}
3336

3437
impl AppChooserDialog {
35-
//pub fn new<'a, P: IsA<Window> + 'a, Q: Into<Option<&'a P>>, R: IsA</*Ignored*/gio::File>>(parent: Q, flags: DialogFlags, file: &R) -> AppChooserDialog {
36-
// unsafe { TODO: call ffi::gtk_app_chooser_dialog_new() }
37-
//}
38+
pub fn new<'a, P: IsA<Window> + 'a, Q: Into<Option<&'a P>>, R: IsA<gio::File>>(parent: Q, flags: DialogFlags, file: &R) -> AppChooserDialog {
39+
assert_initialized_main_thread!();
40+
let parent = parent.into();
41+
let parent = parent.to_glib_none();
42+
unsafe {
43+
Widget::from_glib_none(ffi::gtk_app_chooser_dialog_new(parent.0, flags.to_glib(), file.to_glib_none().0)).downcast_unchecked()
44+
}
45+
}
3846

3947
pub fn new_for_content_type<'a, P: IsA<Window> + 'a, Q: Into<Option<&'a P>>>(parent: Q, flags: DialogFlags, content_type: &str) -> AppChooserDialog {
4048
assert_initialized_main_thread!();
@@ -53,7 +61,7 @@ pub trait AppChooserDialogExt {
5361

5462
fn set_heading(&self, heading: &str);
5563

56-
//fn get_property_gfile(&self) -> /*Ignored*/Option<gio::File>;
64+
fn get_property_gfile(&self) -> Option<gio::File>;
5765

5866
fn connect_property_gfile_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
5967

@@ -79,13 +87,14 @@ impl<O: IsA<AppChooserDialog> + IsA<glib::object::Object>> AppChooserDialogExt f
7987
}
8088
}
8189

82-
//fn get_property_gfile(&self) -> /*Ignored*/Option<gio::File> {
83-
// let mut value = Value::from(None::<&/*Ignored*/gio::File>);
84-
// unsafe {
85-
// gobject_ffi::g_object_get_property(self.to_glib_none().0, "gfile".to_glib_none().0, value.to_glib_none_mut().0);
86-
// }
87-
// value.get()
88-
//}
90+
fn get_property_gfile(&self) -> Option<gio::File> {
91+
unsafe {
92+
let mut value = Value::uninitialized();
93+
gobject_ffi::g_value_init(value.to_glib_none_mut().0, <gio::File as StaticType>::static_type().to_glib());
94+
gobject_ffi::g_object_get_property(self.to_glib_none().0, "gfile".to_glib_none().0, value.to_glib_none_mut().0);
95+
value.get()
96+
}
97+
}
8998

9099
fn connect_property_gfile_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
91100
unsafe {

src/auto/app_chooser_widget.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// This file was generated by gir (d933f9a) from gir-files (469db10)
1+
// This file was generated by gir (d50d839) from gir-files (469db10)
22
// DO NOT EDIT
33

44
use AppChooser;

src/auto/application.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// This file was generated by gir (d933f9a) from gir-files (469db10)
1+
// This file was generated by gir (d50d839) from gir-files (469db10)
22
// DO NOT EDIT
33

44
use ApplicationInhibitFlags;
@@ -7,6 +7,7 @@ use ffi;
77
use gio;
88
use gio_ffi;
99
use glib;
10+
use glib::StaticType;
1011
use glib::Value;
1112
use glib::object::Downcast;
1213
use glib::object::IsA;
@@ -242,19 +243,21 @@ impl<O: IsA<Application> + IsA<glib::object::Object>> GtkApplicationExt for O {
242243
}
243244

244245
fn get_property_active_window(&self) -> Option<Window> {
245-
let mut value = Value::from(None::<&Window>);
246246
unsafe {
247+
let mut value = Value::uninitialized();
248+
gobject_ffi::g_value_init(value.to_glib_none_mut().0, <Window as StaticType>::static_type().to_glib());
247249
gobject_ffi::g_object_get_property(self.to_glib_none().0, "active-window".to_glib_none().0, value.to_glib_none_mut().0);
250+
value.get()
248251
}
249-
value.get()
250252
}
251253

252254
fn get_property_register_session(&self) -> bool {
253-
let mut value = Value::from(&false);
254255
unsafe {
256+
let mut value = Value::uninitialized();
257+
gobject_ffi::g_value_init(value.to_glib_none_mut().0, <bool as StaticType>::static_type().to_glib());
255258
gobject_ffi::g_object_get_property(self.to_glib_none().0, "register-session".to_glib_none().0, value.to_glib_none_mut().0);
259+
value.get().unwrap()
256260
}
257-
value.get().unwrap()
258261
}
259262

260263
fn set_property_register_session(&self, register_session: bool) {

src/auto/application_window.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// This file was generated by gir (d933f9a) from gir-files (469db10)
1+
// This file was generated by gir (d50d839) from gir-files (469db10)
22
// DO NOT EDIT
33

44
use Application;

0 commit comments

Comments
 (0)