Fix edge cases and consistency issues
This commit is contained in:
@@ -8,3 +8,33 @@ pub mod step_rename;
|
||||
pub mod step_resize;
|
||||
pub mod step_watermark;
|
||||
pub mod step_workflow;
|
||||
|
||||
use gtk::prelude::*;
|
||||
|
||||
/// Creates a list factory for ComboRow dropdowns where labels never truncate.
|
||||
/// The default GTK factory ellipsizes text, which cuts off long option names.
|
||||
pub fn full_text_list_factory() -> gtk::SignalListItemFactory {
|
||||
let factory = gtk::SignalListItemFactory::new();
|
||||
factory.connect_setup(|_, item| {
|
||||
let item = item.downcast_ref::<gtk::ListItem>().unwrap();
|
||||
let label = gtk::Label::builder()
|
||||
.xalign(0.0)
|
||||
.margin_start(8)
|
||||
.margin_end(8)
|
||||
.margin_top(8)
|
||||
.margin_bottom(8)
|
||||
.build();
|
||||
item.set_child(Some(&label));
|
||||
});
|
||||
factory.connect_bind(|_, item| {
|
||||
let item = item.downcast_ref::<gtk::ListItem>().unwrap();
|
||||
if let Some(obj) = item.item() {
|
||||
if let Some(string_obj) = obj.downcast_ref::<gtk::StringObject>() {
|
||||
if let Some(label) = item.child().and_downcast_ref::<gtk::Label>() {
|
||||
label.set_label(&string_obj.string());
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
factory
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user