gtk: add split view navigation stack support
This commit is contained in:
@@ -14,6 +14,7 @@ public class ConversationListView : Adw.Bin
|
||||
|
||||
private string? selected_conversation_guid = null;
|
||||
private bool selection_update_queued = false;
|
||||
private bool suppress_row_selected = false;
|
||||
|
||||
public ConversationListView () {
|
||||
container = new Adw.ToolbarView ();
|
||||
@@ -29,6 +30,10 @@ public class ConversationListView : Adw.Bin
|
||||
scrolled_window.set_child (list_box);
|
||||
|
||||
list_box.row_selected.connect ((row) => {
|
||||
if (suppress_row_selected) {
|
||||
return;
|
||||
}
|
||||
|
||||
var conversation_row = (ConversationRow?) row;
|
||||
if (conversation_row != null) {
|
||||
selected_conversation_guid = conversation_row.conversation.guid;
|
||||
@@ -112,7 +117,9 @@ public class ConversationListView : Adw.Bin
|
||||
if (conversation.guid == selected_conversation_guid) {
|
||||
var row = list_box.get_row_at_index((int)i);
|
||||
if (row != null) {
|
||||
suppress_row_selected = true;
|
||||
list_box.select_row(row);
|
||||
suppress_row_selected = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -123,4 +130,4 @@ public class ConversationListView : Adw.Bin
|
||||
Conversation conversation = (Conversation) item;
|
||||
return new ConversationRow (conversation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user