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

Commit e400e0e

Browse files
authored
Merge pull request #437 from EPashkin/disco
Regen
2 parents 14d3bb3 + a516c19 commit e400e0e

File tree

10 files changed

+96
-3
lines changed

10 files changed

+96
-3
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ v2_50 = ["v2_48", "glib-sys/v2_50"]
4343
v2_52 = ["v2_50", "glib-sys/v2_52"]
4444
v2_54 = ["v2_52", "glib-sys/v2_54", "gobject-sys/v2_54"]
4545
v2_56 = ["v2_54", "glib-sys/v2_56"]
46+
v2_58 = ["v2_56", "glib-sys/v2_58"]
4647
futures = ["futures-preview", "v2_36"]
4748
subclassing = []
4849
dox = ["glib-sys/dox", "gobject-sys/dox"]

Gir.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,18 @@ status = "generate"
318318
[[object.function]]
319319
name = "unix_signal_add_full"
320320
ignore = true
321+
[[object.function]]
322+
pattern = "rc_box_.+"
323+
#need manual implementation
324+
ignore = true
325+
[[object.function]]
326+
pattern = "ref_count_.+"
327+
#need manual implementation
328+
ignore = true
329+
[[object.function]]
330+
pattern = "ref_string_.+"
331+
#need manual implementation
332+
ignore = true
321333
[[object.constant]]
322334
pattern = "DIR_SEPARATOR(_S)?"
323335
#not cross-platform

src/auto/date_time.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,13 @@ impl DateTime {
208208
}
209209
}
210210

211+
#[cfg(any(feature = "v2_58", feature = "dox"))]
212+
pub fn get_timezone(&self) -> Option<TimeZone> {
213+
unsafe {
214+
from_glib_none(ffi::g_date_time_get_timezone(self.to_glib_none().0))
215+
}
216+
}
217+
211218
pub fn get_timezone_abbreviation(&self) -> Option<GString> {
212219
unsafe {
213220
from_glib_none(ffi::g_date_time_get_timezone_abbreviation(self.to_glib_none().0))

src/auto/functions.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,13 @@ pub fn build_pathv(separator: &str, args: &[&std::path::Path]) -> Option<std::pa
142142
}
143143
}
144144

145+
#[cfg(any(feature = "v2_58", feature = "dox"))]
146+
pub fn canonicalize_filename<P: AsRef<std::path::Path>, Q: AsRef<std::path::Path>>(filename: P, relative_to: Q) -> Option<std::path::PathBuf> {
147+
unsafe {
148+
from_glib_full(ffi::g_canonicalize_filename(filename.as_ref().to_glib_none().0, relative_to.as_ref().to_glib_none().0))
149+
}
150+
}
151+
145152
pub fn chdir<P: AsRef<std::path::Path>>(path: P) -> i32 {
146153
unsafe {
147154
ffi::g_chdir(path.as_ref().to_glib_none().0)
@@ -468,6 +475,13 @@ pub fn get_language_names() -> Vec<GString> {
468475
}
469476
}
470477

478+
#[cfg(any(feature = "v2_58", feature = "dox"))]
479+
pub fn get_language_names_with_category(category_name: &str) -> Vec<GString> {
480+
unsafe {
481+
FromGlibPtrContainer::from_glib_none(ffi::g_get_language_names_with_category(category_name.to_glib_none().0))
482+
}
483+
}
484+
471485
pub fn get_locale_variants(locale: &str) -> Vec<GString> {
472486
unsafe {
473487
FromGlibPtrContainer::from_glib_full(ffi::g_get_locale_variants(locale.to_glib_none().0))
@@ -1032,6 +1046,11 @@ pub fn spaced_primes_closest(num: u32) -> u32 {
10321046
// unsafe { TODO: call ffi::g_spawn_async() }
10331047
//}
10341048

1049+
//#[cfg(any(feature = "v2_58", feature = "dox"))]
1050+
//pub fn spawn_async_with_fds<P: AsRef<std::path::Path>>(working_directory: P, argv: &[&str], envp: &[&str], flags: /*Ignored*/SpawnFlags, child_setup: Option<Box<dyn FnOnce() + 'static>>, stdin_fd: i32, stdout_fd: i32, stderr_fd: i32) -> Result<Pid, Error> {
1051+
// unsafe { TODO: call ffi::g_spawn_async_with_fds() }
1052+
//}
1053+
10351054
//pub fn spawn_async_with_pipes<P: AsRef<std::path::Path>>(working_directory: P, argv: &[&std::path::Path], envp: &[&std::path::Path], flags: /*Ignored*/SpawnFlags, child_setup: Option<Box<dyn FnOnce() + 'static>>) -> Result<(Pid, i32, i32, i32), Error> {
10361055
// unsafe { TODO: call ffi::g_spawn_async_with_pipes() }
10371056
//}

src/auto/main_context.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ impl MainContext {
103103
// unsafe { TODO: call ffi::g_main_context_set_poll_func() }
104104
//}
105105

106+
//#[cfg_attr(feature = "v2_58", deprecated)]
106107
//pub fn wait(&self, cond: /*Ignored*/&mut Cond, mutex: /*Ignored*/&mut Mutex) -> bool {
107108
// unsafe { TODO: call ffi::g_main_context_wait() }
108109
//}

src/auto/time_zone.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ impl TimeZone {
3232
}
3333
}
3434

35+
#[cfg(any(feature = "v2_58", feature = "dox"))]
36+
pub fn new_offset(seconds: i32) -> TimeZone {
37+
unsafe {
38+
from_glib_full(ffi::g_time_zone_new_offset(seconds))
39+
}
40+
}
41+
3542
pub fn new_utc() -> TimeZone {
3643
unsafe {
3744
from_glib_full(ffi::g_time_zone_new_utc())
@@ -50,6 +57,13 @@ impl TimeZone {
5057
}
5158
}
5259

60+
#[cfg(any(feature = "v2_58", feature = "dox"))]
61+
pub fn get_identifier(&self) -> Option<GString> {
62+
unsafe {
63+
from_glib_none(ffi::g_time_zone_get_identifier(self.to_glib_none().0))
64+
}
65+
}
66+
5367
pub fn get_offset(&self, interval: i32) -> i32 {
5468
unsafe {
5569
ffi::g_time_zone_get_offset(self.to_glib_none().0, interval)

src/auto/versions.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
Generated by gir (https://github.com/gtk-rs/gir @ f5d3eab)
2-
from gir-files (https://github.com/gtk-rs/gir-files @ 62f3bf0)
2+
from gir-files (https://github.com/gtk-rs/gir-files @ 02dfee2)

src/closure.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ impl Closure {
3939

4040
pub unsafe fn new_unsafe<F: Fn(&[Value]) -> Option<Value>>(callback: F) -> Self {
4141
unsafe extern "C" fn marshal<F>(_closure: *mut gobject_ffi::GClosure, return_value: *mut gobject_ffi::GValue,
42-
n_param_values: c_uint, param_values: *mut gobject_ffi::GValue, _invocation_hint: *mut c_void,
42+
n_param_values: c_uint, param_values: *const gobject_ffi::GValue, _invocation_hint: *mut c_void,
4343
marshal_data: *mut c_void)
4444
where F: Fn(&[Value]) -> Option<Value>
4545
{

src/translate.rs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,45 @@ macro_rules! impl_to_glib_container_from_slice_string {
656656
}
657657
}
658658
}
659+
impl<'a> ToGlibContainerFromSlice<'a, *const $ffi_name> for $name {
660+
type Storage = (Vec<Stash<'a, $ffi_name, $name>>, Option<Vec<$ffi_name>>);
661+
662+
fn to_glib_none_from_slice(t: &'a [$name]) -> (*const $ffi_name, Self::Storage) {
663+
let v: Vec<_> = t.iter().map(|s| s.to_glib_none()).collect();
664+
let mut v_ptr: Vec<_> = v.iter().map(|s| s.0).collect();
665+
v_ptr.push(ptr::null_mut() as $ffi_name);
666+
667+
(v_ptr.as_ptr() as *const $ffi_name, (v, Some(v_ptr)))
668+
}
669+
670+
fn to_glib_container_from_slice(t: &'a [$name]) -> (*const $ffi_name, Self::Storage) {
671+
let v: Vec<_> = t.iter().map(|s| s.to_glib_none()).collect();
672+
673+
let v_ptr = unsafe {
674+
let v_ptr = glib_ffi::g_malloc0(mem::size_of::<$ffi_name>() * (t.len() + 1)) as *mut $ffi_name;
675+
676+
for (i, s) in v.iter().enumerate() {
677+
ptr::write(v_ptr.add(i), s.0);
678+
}
679+
680+
v_ptr as *const $ffi_name
681+
};
682+
683+
(v_ptr, (v, None))
684+
}
685+
686+
fn to_glib_full_from_slice(t: &[$name]) -> *const $ffi_name {
687+
unsafe {
688+
let v_ptr = glib_ffi::g_malloc0(mem::size_of::<$ffi_name>() * (t.len() + 1)) as *mut $ffi_name;
689+
690+
for (i, s) in t.iter().enumerate() {
691+
ptr::write(v_ptr.add(i), s.to_glib_full());
692+
}
693+
694+
v_ptr as *const $ffi_name
695+
}
696+
}
697+
}
659698
}
660699
}
661700

0 commit comments

Comments
 (0)