Skip to content

Commit 6f46d1d

Browse files
ids1024sdroege
authored andcommitted
Do not pass $rust_class_name to glib_wrapper!
This is possible due to gtk-rs/gtk3-rs#10
1 parent 4bb1edf commit 6f46d1d

File tree

3 files changed

+9
-38
lines changed

3 files changed

+9
-38
lines changed

src/analysis/object.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ pub struct Info {
1111
pub base: InfoBase,
1212
pub c_type: String,
1313
pub c_class_type: Option<String>,
14-
pub rust_class_type: Option<String>,
1514
pub get_type: String,
1615
pub is_interface: bool,
1716
pub supertypes: Vec<general::StatusedTypeId>,
@@ -172,8 +171,6 @@ pub fn class(env: &Env, obj: &GObject, deps: &[library::TypeId]) -> Option<Info>
172171
imports.add("glib::ObjectExt");
173172
}
174173

175-
let rust_class_type = Some(format!("{}Class", name));
176-
177174
let base = InfoBase {
178175
full_name,
179176
type_id: class_tid,
@@ -204,7 +201,6 @@ pub fn class(env: &Env, obj: &GObject, deps: &[library::TypeId]) -> Option<Info>
204201
base,
205202
c_type: klass.c_type.clone(),
206203
c_class_type: klass.c_class_type.clone(),
207-
rust_class_type,
208204
get_type: klass.glib_get_type.clone(),
209205
is_interface: false,
210206
supertypes,
@@ -318,7 +314,6 @@ pub fn interface(env: &Env, obj: &GObject, deps: &[library::TypeId]) -> Option<I
318314
base,
319315
c_type: iface.c_type.clone(),
320316
c_class_type: None,
321-
rust_class_type: None,
322317
get_type: iface.glib_get_type.clone(),
323318
is_interface: true,
324319
supertypes,

src/codegen/general.rs

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ pub fn define_object_type(
7878
type_name: &str,
7979
glib_name: &str,
8080
glib_class_name: Option<&str>,
81-
rust_class_name: Option<&str>,
8281
glib_func_name: &str,
8382
is_interface: bool,
8483
parents: &[StatusedTypeId],
@@ -92,14 +91,6 @@ pub fn define_object_type(
9291
}
9392
};
9493

95-
let rust_class_name = {
96-
if let Some(s) = rust_class_name {
97-
format!(", {}", s)
98-
} else {
99-
"".to_string()
100-
}
101-
};
102-
10394
let kind_name = if is_interface { "Interface" } else { "Object" };
10495

10596
let parents: Vec<StatusedTypeId> = parents
@@ -113,22 +104,21 @@ pub fn define_object_type(
113104
if parents.is_empty() {
114105
writeln!(
115106
w,
116-
"\tpub struct {}({}<{}::{}{}{}>);",
117-
type_name, kind_name, sys_crate_name, glib_name, class_name, rust_class_name
107+
"\tpub struct {}({}<{}::{}{}>);",
108+
type_name, kind_name, sys_crate_name, glib_name, class_name
118109
)?;
119110
} else if is_interface {
120111
let prerequisites: Vec<String> =
121112
parents.iter().map(|p| format_parent_name(env, p)).collect();
122113

123114
writeln!(
124115
w,
125-
"\tpub struct {}({}<{}::{}{}{}>) @requires {};",
116+
"\tpub struct {}({}<{}::{}{}>) @requires {};",
126117
type_name,
127118
kind_name,
128119
sys_crate_name,
129120
glib_name,
130121
class_name,
131-
rust_class_name,
132122
prerequisites.join(", ")
133123
)?;
134124
} else {
@@ -172,14 +162,8 @@ pub fn define_object_type(
172162

173163
writeln!(
174164
w,
175-
"\tpub struct {}({}<{}::{}{}{}>){};",
176-
type_name,
177-
kind_name,
178-
sys_crate_name,
179-
glib_name,
180-
class_name,
181-
rust_class_name,
182-
parents_string,
165+
"\tpub struct {}({}<{}::{}{}>){};",
166+
type_name, kind_name, sys_crate_name, glib_name, class_name, parents_string,
183167
)?;
184168
}
185169
writeln!(w)?;

src/codegen/object.rs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ pub fn generate(
2727
&analysis.name,
2828
&analysis.c_type,
2929
analysis.c_class_type.as_deref(),
30-
analysis.rust_class_type.as_deref(),
3130
&analysis.get_type,
3231
analysis.is_interface,
3332
&analysis.supertypes,
@@ -364,17 +363,10 @@ pub fn generate_reexports(
364363
String::new()
365364
};
366365

367-
if let Some(ref class_name) = analysis.rust_class_type {
368-
contents.push(format!(
369-
"pub use self::{}::{{{}, {}{}}};",
370-
module_name, analysis.name, class_name, none_type
371-
));
372-
} else {
373-
contents.push(format!(
374-
"pub use self::{}::{{{}{}}};",
375-
module_name, analysis.name, none_type
376-
));
377-
}
366+
contents.push(format!(
367+
"pub use self::{}::{{{}{}}};",
368+
module_name, analysis.name, none_type
369+
));
378370
if need_generate_trait(analysis) {
379371
contents.extend_from_slice(&cfgs);
380372
contents.push(format!(

0 commit comments

Comments
 (0)