diff --git a/Cargo.lock b/Cargo.lock index 40d0359..c1c1b8b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -473,7 +473,7 @@ checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" [[package]] name = "libhelium" -version = "0.8.0" +version = "0.9.0" dependencies = [ "bitflags", "futures-channel", @@ -490,7 +490,7 @@ dependencies = [ [[package]] name = "libhelium-sys" -version = "0.8.0" +version = "0.9.0" dependencies = [ "gdk4-sys", "gio-sys", diff --git a/He-1.gir b/He-1.gir index 4aa117c..b17ed42 100755 --- a/He-1.gir +++ b/He-1.gir @@ -6374,33 +6374,6 @@ Since: 1.0 - - <para>The title to the left on the AppBar.</para> - - - - - - - - - - - - - - - - - - - - - - - - - <para>The title widget to the left on the AppBar. If this is set, the other title &lpar;not subtitle&rpar; props won&apos;t work, and the mini title on collapsed state won&apos;t show.</para> @@ -10910,11 +10883,11 @@ Since: 1.0 - + <para>The title of the SideBar. </para> - + - + <para>The subtitle of the SideBar. </para> @@ -10922,11 +10895,11 @@ Since: 1.0 <para>The title of the sidebar.</para> - + - - + + @@ -10942,8 +10915,8 @@ Since: 1.0 - - + + @@ -13119,11 +13092,11 @@ Since: 1.0 - + <para>The title of the ViewMono. </para> - + - + <para>The subtitle of the ViewMono. </para> @@ -13194,12 +13167,12 @@ Since: 1.0 - <para>The title of the sidebar.</para> - + <para>The title of the view.</para> + - - + + @@ -13215,13 +13188,13 @@ Since: 1.0 - - + + - <para>The title widget of the sidebar.</para> + <para>The title widget of the view.</para> @@ -13248,7 +13221,7 @@ Since: 1.0 - <para>The title of the sidebar.</para> + <para>The subtitle of the view.</para> diff --git a/libhelium/Cargo.toml b/libhelium/Cargo.toml index c9e96c6..ff3fb30 100644 --- a/libhelium/Cargo.toml +++ b/libhelium/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "libhelium" -version = "0.8.0" +version = "0.9.0" authors = ["Lleyton Gray "] edition = "2021" readme = "../README.md" @@ -78,4 +78,4 @@ branch = "master" [dependencies.ffi] package = "libhelium-sys" path = './sys' -version = "0.8.0" +version = "0.9.0" diff --git a/libhelium/src/auto/app_bar.rs b/libhelium/src/auto/app_bar.rs index 6112e62..ae7e6d5 100644 --- a/libhelium/src/auto/app_bar.rs +++ b/libhelium/src/auto/app_bar.rs @@ -78,14 +78,6 @@ impl AppBarBuilder { } } - pub fn viewtitle_label(self, viewtitle_label: impl Into) -> Self { - Self { - builder: self - .builder - .property("viewtitle-label", viewtitle_label.into()), - } - } - pub fn viewtitle_widget(self, viewtitle_widget: &impl IsA) -> Self { Self { builder: self @@ -409,26 +401,6 @@ pub trait AppBarExt: IsA + sealed::Sealed + 'static { } } - #[doc(alias = "he_app_bar_get_viewtitle_label")] - #[doc(alias = "get_viewtitle_label")] - fn viewtitle_label(&self) -> glib::GString { - unsafe { - from_glib_none(ffi::he_app_bar_get_viewtitle_label( - self.as_ref().to_glib_none().0, - )) - } - } - - #[doc(alias = "he_app_bar_set_viewtitle_label")] - fn set_viewtitle_label(&self, value: &str) { - unsafe { - ffi::he_app_bar_set_viewtitle_label( - self.as_ref().to_glib_none().0, - value.to_glib_none().0, - ); - } - } - #[doc(alias = "he_app_bar_get_viewtitle_widget")] #[doc(alias = "get_viewtitle_widget")] fn viewtitle_widget(&self) -> Option { @@ -615,32 +587,6 @@ pub trait AppBarExt: IsA + sealed::Sealed + 'static { } } - #[doc(alias = "viewtitle-label")] - fn connect_viewtitle_label_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_viewtitle_label_trampoline< - P: IsA, - F: Fn(&P) + 'static, - >( - this: *mut ffi::HeAppBar, - _param_spec: glib::ffi::gpointer, - f: glib::ffi::gpointer, - ) { - let f: &F = &*(f as *const F); - f(AppBar::from_glib_borrow(this).unsafe_cast_ref()) - } - unsafe { - let f: Box_ = Box_::new(f); - connect_raw( - self.as_ptr() as *mut _, - b"notify::viewtitle-label\0".as_ptr() as *const _, - Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( - notify_viewtitle_label_trampoline:: as *const (), - )), - Box_::into_raw(f), - ) - } - } - #[doc(alias = "viewtitle-widget")] fn connect_viewtitle_widget_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_viewtitle_widget_trampoline< diff --git a/libhelium/src/auto/side_bar.rs b/libhelium/src/auto/side_bar.rs index 6fb3301..d0ce836 100644 --- a/libhelium/src/auto/side_bar.rs +++ b/libhelium/src/auto/side_bar.rs @@ -24,11 +24,11 @@ impl SideBar { pub const NONE: Option<&'static SideBar> = None; #[doc(alias = "he_side_bar_new")] - pub fn new(title: &str, subtitle: &str) -> SideBar { + pub fn new(title: Option<&impl IsA>, subtitle: Option<&str>) -> SideBar { assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::he_side_bar_new( - title.to_glib_none().0, + title.map(|p| p.as_ref()).to_glib_none().0, subtitle.to_glib_none().0, )) } @@ -65,9 +65,9 @@ impl SideBarBuilder { } } - pub fn title(self, title: impl Into) -> Self { + pub fn title(self, title: &impl IsA) -> Self { Self { - builder: self.builder.property("title", title.into()), + builder: self.builder.property("title", title.clone().upcast()), } } @@ -321,14 +321,17 @@ mod sealed { pub trait SideBarExt: IsA + sealed::Sealed + 'static { #[doc(alias = "he_side_bar_get_title")] #[doc(alias = "get_title")] - fn title(&self) -> glib::GString { + fn title(&self) -> Option { unsafe { from_glib_none(ffi::he_side_bar_get_title(self.as_ref().to_glib_none().0)) } } #[doc(alias = "he_side_bar_set_title")] - fn set_title(&self, value: &str) { + fn set_title(&self, value: Option<&impl IsA>) { unsafe { - ffi::he_side_bar_set_title(self.as_ref().to_glib_none().0, value.to_glib_none().0); + ffi::he_side_bar_set_title( + self.as_ref().to_glib_none().0, + value.map(|p| p.as_ref()).to_glib_none().0, + ); } } diff --git a/libhelium/src/auto/view_mono.rs b/libhelium/src/auto/view_mono.rs index d484f39..7d211cf 100644 --- a/libhelium/src/auto/view_mono.rs +++ b/libhelium/src/auto/view_mono.rs @@ -24,11 +24,11 @@ impl ViewMono { pub const NONE: Option<&'static ViewMono> = None; #[doc(alias = "he_view_mono_new")] - pub fn new(title: &str, subtitle: &str) -> ViewMono { + pub fn new(title: Option<&impl IsA>, subtitle: Option<&str>) -> ViewMono { assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::he_view_mono_new( - title.to_glib_none().0, + title.map(|p| p.as_ref()).to_glib_none().0, subtitle.to_glib_none().0, )) } @@ -65,9 +65,9 @@ impl ViewMonoBuilder { } } - pub fn title(self, title: impl Into) -> Self { + pub fn title(self, title: &impl IsA) -> Self { Self { - builder: self.builder.property("title", title.into()), + builder: self.builder.property("title", title.clone().upcast()), } } @@ -356,14 +356,17 @@ pub trait ViewMonoExt: IsA + sealed::Sealed + 'static { #[doc(alias = "he_view_mono_get_title")] #[doc(alias = "get_title")] - fn title(&self) -> glib::GString { + fn title(&self) -> Option { unsafe { from_glib_none(ffi::he_view_mono_get_title(self.as_ref().to_glib_none().0)) } } #[doc(alias = "he_view_mono_set_title")] - fn set_title(&self, value: &str) { + fn set_title(&self, value: Option<&impl IsA>) { unsafe { - ffi::he_view_mono_set_title(self.as_ref().to_glib_none().0, value.to_glib_none().0); + ffi::he_view_mono_set_title( + self.as_ref().to_glib_none().0, + value.map(|p| p.as_ref()).to_glib_none().0, + ); } } diff --git a/libhelium/sys/Cargo.toml b/libhelium/sys/Cargo.toml index 01e10f7..e3d1a77 100644 --- a/libhelium/sys/Cargo.toml +++ b/libhelium/sys/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "libhelium-sys" -version = "0.8.0" +version = "0.9.0" authors = ["Lleyton Gray "] edition = "2021" build = "build.rs" diff --git a/libhelium/sys/src/lib.rs b/libhelium/sys/src/lib.rs index 2df2654..720e39d 100644 --- a/libhelium/sys/src/lib.rs +++ b/libhelium/sys/src/lib.rs @@ -3813,8 +3813,6 @@ extern "C" { pub fn he_app_bar_set_scroller(self_: *mut HeAppBar, value: *mut gtk::GtkScrolledWindow); pub fn he_app_bar_get_is_compact(self_: *mut HeAppBar) -> gboolean; pub fn he_app_bar_set_is_compact(self_: *mut HeAppBar, value: gboolean); - pub fn he_app_bar_get_viewtitle_label(self_: *mut HeAppBar) -> *const c_char; - pub fn he_app_bar_set_viewtitle_label(self_: *mut HeAppBar, value: *const c_char); pub fn he_app_bar_get_viewtitle_widget(self_: *mut HeAppBar) -> *mut gtk::GtkWidget; pub fn he_app_bar_set_viewtitle_widget(self_: *mut HeAppBar, value: *mut gtk::GtkWidget); pub fn he_app_bar_get_viewsubtitle_label(self_: *mut HeAppBar) -> *const c_char; @@ -4835,9 +4833,9 @@ extern "C" { // HeSideBar //========================================================================= pub fn he_side_bar_get_type() -> GType; - pub fn he_side_bar_new(title: *const c_char, subtitle: *const c_char) -> *mut HeSideBar; - pub fn he_side_bar_get_title(self_: *mut HeSideBar) -> *const c_char; - pub fn he_side_bar_set_title(self_: *mut HeSideBar, value: *const c_char); + pub fn he_side_bar_new(title: *mut gtk::GtkWidget, subtitle: *const c_char) -> *mut HeSideBar; + pub fn he_side_bar_get_title(self_: *mut HeSideBar) -> *mut gtk::GtkWidget; + pub fn he_side_bar_set_title(self_: *mut HeSideBar, value: *mut gtk::GtkWidget); pub fn he_side_bar_get_titlewidget(self_: *mut HeSideBar) -> *mut gtk::GtkWidget; pub fn he_side_bar_set_titlewidget(self_: *mut HeSideBar, value: *mut gtk::GtkWidget); pub fn he_side_bar_get_subtitle(self_: *mut HeSideBar) -> *const c_char; @@ -5294,7 +5292,8 @@ extern "C" { // HeViewMono //========================================================================= pub fn he_view_mono_get_type() -> GType; - pub fn he_view_mono_new(title: *const c_char, subtitle: *const c_char) -> *mut HeViewMono; + pub fn he_view_mono_new(title: *mut gtk::GtkWidget, subtitle: *const c_char) + -> *mut HeViewMono; pub fn he_view_mono_add_titlebar_button(self_: *mut HeViewMono, child: *mut gtk::GtkButton); pub fn he_view_mono_add_titlebar_menu(self_: *mut HeViewMono, child: *mut gtk::GtkMenuButton); pub fn he_view_mono_add_titlebar_toggle( @@ -5302,8 +5301,8 @@ extern "C" { child: *mut gtk::GtkToggleButton, ); pub fn he_view_mono_append(self_: *mut HeViewMono, child: *mut gtk::GtkWidget); - pub fn he_view_mono_get_title(self_: *mut HeViewMono) -> *const c_char; - pub fn he_view_mono_set_title(self_: *mut HeViewMono, value: *const c_char); + pub fn he_view_mono_get_title(self_: *mut HeViewMono) -> *mut gtk::GtkWidget; + pub fn he_view_mono_set_title(self_: *mut HeViewMono, value: *mut gtk::GtkWidget); pub fn he_view_mono_get_titlewidget(self_: *mut HeViewMono) -> *mut gtk::GtkWidget; pub fn he_view_mono_set_titlewidget(self_: *mut HeViewMono, value: *mut gtk::GtkWidget); pub fn he_view_mono_get_subtitle(self_: *mut HeViewMono) -> *const c_char;