Private
Public Access
1
0
This commit is contained in:
2025-04-30 14:24:33 -07:00
parent 101694ddbc
commit 907a69385d
8 changed files with 10 additions and 7 deletions

View File

@@ -0,0 +1,47 @@
using Adw;
using Gtk;
public class ConversationListView : Adw.Bin
{
private Adw.ToolbarView container;
private ListBox list_box;
private ScrolledWindow scrolled_window;
private Adw.HeaderBar header_bar;
private ConversationListModel conversation_model;
public ConversationListView () {
container = new Adw.ToolbarView ();
set_child (container);
scrolled_window = new ScrolledWindow ();
container.set_content (scrolled_window);
list_box = new ListBox ();
list_box.add_css_class ("boxed-list");
list_box.set_selection_mode (SelectionMode.SINGLE);
scrolled_window.set_child (list_box);
header_bar = new Adw.HeaderBar ();
header_bar.set_title_widget (new Label ("Kordophone"));
container.add_top_bar (header_bar);
// Set up refresh button
var refresh_button = new Button.from_icon_name ("view-refresh-symbolic");
refresh_button.tooltip_text = "Refresh Conversations";
refresh_button.clicked.connect (() => {
if (conversation_model != null) {
conversation_model.load_conversations ();
}
});
header_bar.pack_end (refresh_button);
// Set up model and bind to list
conversation_model = new ConversationListModel ();
list_box.bind_model (conversation_model, create_conversation_row);
}
private Widget create_conversation_row (Object item) {
Conversation conversation = (Conversation) item;
return new ConversationRow (conversation);
}
}