aboutsummaryrefslogtreecommitdiff
path: root/main/src/ui/conversation_content
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2022-02-14 14:55:59 +0100
committerfiaxh <git@lightrise.org>2022-07-27 20:34:20 +0200
commit7e7dcedaf31ee35499875491c9f569c575d28435 (patch)
tree0c5fee2b28baf320775fbc92b3c252e97d9d054f /main/src/ui/conversation_content
parentf25bfb00969a7e09996da2d5500e6718f4cc0148 (diff)
downloaddino-7e7dcedaf31ee35499875491c9f569c575d28435.tar.gz
dino-7e7dcedaf31ee35499875491c9f569c575d28435.zip
Port from GTK3 to GTK4
Diffstat (limited to 'main/src/ui/conversation_content')
-rw-r--r--main/src/ui/conversation_content/conversation_item_factory.vala36
1 files changed, 36 insertions, 0 deletions
diff --git a/main/src/ui/conversation_content/conversation_item_factory.vala b/main/src/ui/conversation_content/conversation_item_factory.vala
new file mode 100644
index 00000000..29a83785
--- /dev/null
+++ b/main/src/ui/conversation_content/conversation_item_factory.vala
@@ -0,0 +1,36 @@
+using Gtk;
+
+namespace Dino.Ui {
+
+ public static ListItemFactory get_item_factory() {
+ SignalListItemFactory item_factory = new SignalListItemFactory();
+ item_factory.setup.connect((list_item) => { on_setup(list_item); });
+ item_factory.bind.connect((list_item) => { on_bind(list_item); });
+ return item_factory;
+ }
+
+ public static void on_setup(ListItem listitem) {
+ listitem.child = new ConversationItemWidget();
+ }
+
+ public static void on_bind(ListItem listitem) {
+ MessageViewModel view_model = (MessageViewModel) listitem.get_item();
+ ConversationItemWidget view = (ConversationItemWidget) listitem.get_child();
+
+ view_model.bind_property("name", view.name_label, "label", BindingFlags.SYNC_CREATE);
+ view_model.bind_property("time", view.time_label, "label", BindingFlags.SYNC_CREATE);
+
+ Label? label = view.content_widget as Label;
+ if (label == null) {
+ label = new Label("") { use_markup=true, xalign=0, selectable=true, wrap=true, wrap_mode=Pango.WrapMode.WORD_CHAR, hexpand=true, vexpand=true };
+ view.set_content_widget(label);
+ }
+ view_model.bind_property("message", label, "label", BindingFlags.SYNC_CREATE);
+
+ view_model.bind_property("encryption-icon-name", view.encrypted_image, "icon-name", BindingFlags.SYNC_CREATE);
+ view_model.bind_property("encryption-icon-tooltip", view.encrypted_image, "tooltip-text", BindingFlags.SYNC_CREATE);
+
+ view_model.bind_property("marked-icon-name", view.marked_image, "icon-name", BindingFlags.SYNC_CREATE);
+ view_model.bind_property("marked-icon-tooltip", view.marked_image, "tooltip-text", BindingFlags.SYNC_CREATE);
+ }
+} \ No newline at end of file