Skip to content
This repository was archived by the owner on Mar 4, 2024. It is now read-only.

Commit fb08b0f

Browse files
committed
post fix-getters manual updates
1 parent 78d6125 commit fb08b0f

File tree

16 files changed

+75
-71
lines changed

16 files changed

+75
-71
lines changed

cairo/src/ps.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ mod test {
150150
let buffer: Vec<u8> = vec![];
151151
let surface = PsSurface::for_stream(100., 100., buffer).unwrap();
152152
surface.set_eps(true);
153-
assert_eq!(surface.eps(), true);
153+
assert!(surface.is_eps());
154154
}
155155

156156
#[test]

examples/clipboard_simple/main.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,22 +76,22 @@ fn build_ui(application: &gtk::Application) {
7676
let mut s = String::new();
7777
GLOBAL.with(|global| {
7878
if let Some(ref ui) = *global.borrow() {
79-
if ui.button_a1.active() {
79+
if ui.button_a1.is_active() {
8080
s.push('1');
8181
} else {
8282
s.push('0');
8383
}
84-
if ui.button_a2.active() {
84+
if ui.button_a2.is_active() {
8585
s.push('1');
8686
} else {
8787
s.push('0');
8888
}
89-
if ui.button_b1.active() {
89+
if ui.button_b1.is_active() {
9090
s.push('1');
9191
} else {
9292
s.push('0');
9393
}
94-
if ui.button_b2.active() {
94+
if ui.button_b2.is_active() {
9595
s.push('1');
9696
} else {
9797
s.push('0');

examples/gtk_test/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ fn build_ui(application: &gtk::Application) {
133133
.expect("Couldn't get app_button");
134134
app_button.connect_clicked(glib::clone!(@weak window => move |_| {
135135
// entry.set_text("Clicked!");
136-
let dialog = AppChooserDialog::new_for_content_type(Some(&window),
136+
let dialog = AppChooserDialog::for_content_type(Some(&window),
137137
gtk::DialogFlags::MODAL,
138138
"sh");
139139

@@ -143,7 +143,7 @@ fn build_ui(application: &gtk::Application) {
143143

144144
let switch: Switch = builder.get_object("switch").expect("Couldn't get switch");
145145
switch.connect_changed_active(glib::clone!(@weak entry => move |switch| {
146-
if switch.active() {
146+
if switch.is_active() {
147147
entry.set_text("Switch On");
148148
} else {
149149
entry.set_text("Switch Off");

examples/menu_bar/main.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ fn build_ui(application: &gtk::Application) {
102102
p.show_all();
103103
});
104104
check_item.connect_toggled(|w| {
105-
w.set_label(if w.active() { "Checked" } else { "Unchecked" });
105+
w.set_label(if w.is_active() {
106+
"Checked"
107+
} else {
108+
"Unchecked"
109+
});
106110
});
107111
}

examples/menu_bar_system/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ fn add_actions(
9898
// The same goes the around way: if we update the switch state, we need to update the menu
9999
// item's state.
100100
switch.connect_property_active_notify(glib::clone!(@weak switch_action => move |s| {
101-
switch_action.change_state(&s.active().to_variant());
101+
switch_action.change_state(&s.is_active().to_variant());
102102
}));
103103

104104
let sub_another = gio::SimpleAction::new("sub_another", None);

examples/progress_tracker/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ impl Widgets {
123123

124124
let window = gtk::ApplicationWindow::new(application);
125125
window.set_icon_name(Some("package-x-generic"));
126-
window.set_property_window_position(gtk::WindowPosition::Center);
126+
window.set_window_position(gtk::WindowPosition::Center);
127127
window.set_titlebar(Some(&header.container));
128128
window.add(&view_stack);
129129
window.show_all();

gio/src/subclass/action_group.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ unsafe extern "C" fn action_group_get_action_enabled<T: ActionGroupImpl>(
542542
let imp = instance.impl_();
543543
let action_name = GString::from_glib_borrow(action_nameptr);
544544

545-
imp.get_action_enabled(
545+
imp.is_action_enabled(
546546
from_glib_borrow::<_, ActionGroup>(action_group).unsafe_cast_ref(),
547547
&action_name,
548548
)

glib-macros/src/utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ fn parse_attribute(meta: &NestedMeta) -> Result<(String, String)> {
3636
_ => bail!("wrong meta type"),
3737
};
3838

39-
let ident = match meta.path.ident() {
39+
let ident = match meta.path.get_ident() {
4040
None => bail!("missing ident"),
4141
Some(ident) => ident,
4242
};

glib/src/param_spec.rs

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ impl ParamSpec {
166166
//}
167167

168168
#[doc(alias = "g_param_spec_boolean")]
169-
pub fn boolean(
169+
pub fn new_boolean(
170170
name: &str,
171171
nick: &str,
172172
blurb: &str,
@@ -190,7 +190,7 @@ impl ParamSpec {
190190
}
191191

192192
#[doc(alias = "g_param_spec_boxed")]
193-
pub fn boxed(
193+
pub fn new_boxed(
194194
name: &str,
195195
nick: &str,
196196
blurb: &str,
@@ -214,7 +214,7 @@ impl ParamSpec {
214214
}
215215

216216
#[doc(alias = "g_param_spec_char")]
217-
pub fn char(
217+
pub fn new_char(
218218
name: &str,
219219
nick: &str,
220220
blurb: &str,
@@ -242,7 +242,7 @@ impl ParamSpec {
242242
}
243243

244244
#[doc(alias = "g_param_spec_double")]
245-
pub fn double(
245+
pub fn new_double(
246246
name: &str,
247247
nick: &str,
248248
blurb: &str,
@@ -270,7 +270,7 @@ impl ParamSpec {
270270
}
271271

272272
#[doc(alias = "g_param_spec_enum")]
273-
pub fn enum_(
273+
pub fn new_enum(
274274
name: &str,
275275
nick: &str,
276276
blurb: &str,
@@ -296,7 +296,7 @@ impl ParamSpec {
296296
}
297297

298298
#[doc(alias = "g_param_spec_flags")]
299-
pub fn flags(
299+
pub fn new_flags(
300300
name: &str,
301301
nick: &str,
302302
blurb: &str,
@@ -322,7 +322,7 @@ impl ParamSpec {
322322
}
323323

324324
#[doc(alias = "g_param_spec_float")]
325-
pub fn float(
325+
pub fn new_float(
326326
name: &str,
327327
nick: &str,
328328
blurb: &str,
@@ -350,7 +350,7 @@ impl ParamSpec {
350350
}
351351

352352
#[doc(alias = "g_param_spec_gtype")]
353-
pub fn gtype(
353+
pub fn new_type(
354354
name: &str,
355355
nick: &str,
356356
blurb: &str,
@@ -374,7 +374,7 @@ impl ParamSpec {
374374
}
375375

376376
#[doc(alias = "g_param_spec_int")]
377-
pub fn int(
377+
pub fn new_int(
378378
name: &str,
379379
nick: &str,
380380
blurb: &str,
@@ -402,7 +402,7 @@ impl ParamSpec {
402402
}
403403

404404
#[doc(alias = "g_param_spec_int64")]
405-
pub fn int64(
405+
pub fn new_int64(
406406
name: &str,
407407
nick: &str,
408408
blurb: &str,
@@ -430,7 +430,7 @@ impl ParamSpec {
430430
}
431431

432432
#[doc(alias = "g_param_spec_long")]
433-
pub fn long(
433+
pub fn new_long(
434434
name: &str,
435435
nick: &str,
436436
blurb: &str,
@@ -458,7 +458,7 @@ impl ParamSpec {
458458
}
459459

460460
#[doc(alias = "g_param_spec_object")]
461-
pub fn object(
461+
pub fn new_object(
462462
name: &str,
463463
nick: &str,
464464
blurb: &str,
@@ -482,7 +482,7 @@ impl ParamSpec {
482482
}
483483

484484
#[doc(alias = "g_param_spec_override")]
485-
pub fn override_(name: &str, overridden: &ParamSpec) -> ParamSpec {
485+
pub fn new_override(name: &str, overridden: &ParamSpec) -> ParamSpec {
486486
assert!(
487487
is_canonical_pspec_name(name),
488488
"{} is not a valid canonical parameter name",
@@ -497,7 +497,7 @@ impl ParamSpec {
497497
}
498498

499499
#[doc(alias = "g_param_spec_param")]
500-
pub fn param(
500+
pub fn new_param(
501501
name: &str,
502502
nick: &str,
503503
blurb: &str,
@@ -521,7 +521,7 @@ impl ParamSpec {
521521
}
522522

523523
#[doc(alias = "g_param_spec_pointer")]
524-
pub fn pointer(name: &str, nick: &str, blurb: &str, flags: ParamFlags) -> ParamSpec {
524+
pub fn new_pointer(name: &str, nick: &str, blurb: &str, flags: ParamFlags) -> ParamSpec {
525525
assert!(
526526
is_canonical_pspec_name(name),
527527
"{} is not a valid canonical parameter name",
@@ -538,7 +538,7 @@ impl ParamSpec {
538538
}
539539

540540
#[doc(alias = "g_param_spec_string")]
541-
pub fn string(
541+
pub fn new_string(
542542
name: &str,
543543
nick: &str,
544544
blurb: &str,
@@ -563,7 +563,7 @@ impl ParamSpec {
563563
}
564564

565565
#[doc(alias = "g_param_spec_uchar")]
566-
pub fn uchar(
566+
pub fn new_uchar(
567567
name: &str,
568568
nick: &str,
569569
blurb: &str,
@@ -591,7 +591,7 @@ impl ParamSpec {
591591
}
592592

593593
#[doc(alias = "g_param_spec_uint")]
594-
pub fn uint(
594+
pub fn new_uint(
595595
name: &str,
596596
nick: &str,
597597
blurb: &str,
@@ -619,7 +619,7 @@ impl ParamSpec {
619619
}
620620

621621
#[doc(alias = "g_param_spec_uint64")]
622-
pub fn uint64(
622+
pub fn new_uint64(
623623
name: &str,
624624
nick: &str,
625625
blurb: &str,
@@ -647,7 +647,7 @@ impl ParamSpec {
647647
}
648648

649649
#[doc(alias = "g_param_spec_ulong")]
650-
pub fn ulong(
650+
pub fn new_ulong(
651651
name: &str,
652652
nick: &str,
653653
blurb: &str,
@@ -675,7 +675,7 @@ impl ParamSpec {
675675
}
676676

677677
#[doc(alias = "g_param_spec_unichar")]
678-
pub fn unichar(
678+
pub fn new_unichar(
679679
name: &str,
680680
nick: &str,
681681
blurb: &str,
@@ -699,7 +699,7 @@ impl ParamSpec {
699699
}
700700

701701
#[doc(alias = "g_param_spec_value_array")]
702-
pub fn value_array(
702+
pub fn new_value_array(
703703
name: &str,
704704
nick: &str,
705705
blurb: &str,
@@ -723,7 +723,7 @@ impl ParamSpec {
723723
}
724724

725725
#[doc(alias = "g_param_spec_variant")]
726-
pub fn variant(
726+
pub fn new_variant(
727727
name: &str,
728728
nick: &str,
729729
blurb: &str,
@@ -1157,7 +1157,7 @@ mod tests {
11571157

11581158
#[test]
11591159
fn test_param_spec_string() {
1160-
let pspec = ParamSpec::string(
1160+
let pspec = ParamSpec::new_string(
11611161
"name",
11621162
"nick",
11631163
"blurb",

glib/src/subclass/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,22 +102,22 @@
102102
//! use once_cell::sync::Lazy;
103103
//! static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
104104
//! vec![
105-
//! glib::ParamSpec::string(
105+
//! glib::ParamSpec::new_string(
106106
//! "name",
107107
//! "Name",
108108
//! "Name of this object",
109109
//! None,
110110
//! glib::ParamFlags::READWRITE,
111111
//! ),
112-
//! glib::ParamSpec::enum_(
112+
//! glib::ParamSpec::new_enum(
113113
//! "animal",
114114
//! "Animal",
115115
//! "Animal",
116116
//! Animal::static_type(),
117117
//! Animal::default() as i32,
118118
//! glib::ParamFlags::READWRITE,
119119
//! ),
120-
//! glib::ParamSpec::flags(
120+
//! glib::ParamSpec::new_flags(
121121
//! "flags",
122122
//! "Flags",
123123
//! "Flags",
@@ -134,7 +134,7 @@
134134
//! // Called whenever a property is set on this instance. The id
135135
//! // is the same as the index of the property in the PROPERTIES array.
136136
//! fn set_property(&self, _obj: &Self::Type, _id: usize, value: &glib::Value, pspec: &glib::ParamSpec) {
137-
//! match pspec.get_name() {
137+
//! match pspec.name() {
138138
//! "name" => {
139139
//! let name = value
140140
//! .get()
@@ -160,7 +160,7 @@
160160
//! // Called whenever a property is retrieved from this instance. The id
161161
//! // is the same as the index of the property in the PROPERTIES array.
162162
//! fn get_property(&self, _obj: &Self::Type, _id: usize, pspec: &glib::ParamSpec) -> glib::Value {
163-
//! match pspec.get_name() {
163+
//! match pspec.name() {
164164
//! "name" => self.name.borrow().to_value(),
165165
//! "animal" => self.animal.get().to_value(),
166166
//! "flags" => self.flags.get().to_value(),

glib/src/subclass/object.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -315,28 +315,28 @@ mod test {
315315
use once_cell::sync::Lazy;
316316
static PROPERTIES: Lazy<Vec<ParamSpec>> = Lazy::new(|| {
317317
vec![
318-
crate::ParamSpec::string(
318+
crate::ParamSpec::new_string(
319319
"name",
320320
"Name",
321321
"Name of this object",
322322
None,
323323
crate::ParamFlags::READWRITE,
324324
),
325-
crate::ParamSpec::string(
325+
crate::ParamSpec::new_string(
326326
"construct-name",
327327
"Construct Name",
328328
"Construct Name of this object",
329329
None,
330330
crate::ParamFlags::READWRITE | crate::ParamFlags::CONSTRUCT_ONLY,
331331
),
332-
crate::ParamSpec::boolean(
332+
crate::ParamSpec::new_boolean(
333333
"constructed",
334334
"Constructed",
335335
"True if the constructed() virtual method was called",
336336
false,
337337
crate::ParamFlags::READABLE,
338338
),
339-
crate::ParamSpec::object(
339+
crate::ParamSpec::new_object(
340340
"child",
341341
"Child",
342342
"Child object",

0 commit comments

Comments
 (0)