Sun, 19 Nov 2023 03:10:58 -0600
Use bindings for a few more things in PidginConversation
This avoid a bit of C code and a struct member and offloads more stuff to the
ui file which is of course ideal.
Testing Done:
Joined a twitch chat and verified everything was working.
Reviewed at https://reviews.imfreedom.org/r/2841/
| pidgin/pidginconversation.c | file | annotate | diff | comparison | revisions | |
| pidgin/resources/Conversations/conversation.ui | file | annotate | diff | comparison | revisions |
--- a/pidgin/pidginconversation.c Sun Nov 19 02:13:46 2023 -0600 +++ b/pidgin/pidginconversation.c Sun Nov 19 03:10:58 2023 -0600 @@ -46,7 +46,6 @@ GtkWidget *info_pane; GtkWidget *history; GtkAdjustment *history_adjustment; - GtkNoSelection *history_selection; GtkWidget *input; }; @@ -61,19 +60,11 @@ PurpleConversation *purple_conversation) { if(g_set_object(&conversation->conversation, purple_conversation)) { - GListModel *model = NULL; - if(PURPLE_IS_CONVERSATION(purple_conversation)) { g_object_set_data(G_OBJECT(purple_conversation), PIDGIN_CONVERSATION_DATA, conversation); - model = purple_conversation_get_messages(purple_conversation); } - gtk_no_selection_set_model(conversation->history_selection, model); - - pidgin_info_pane_set_conversation(PIDGIN_INFO_PANE(conversation->info_pane), - purple_conversation); - g_object_notify_by_pspec(G_OBJECT(conversation), properties[PROP_CONVERSATION]); } @@ -380,8 +371,6 @@ gtk_widget_class_bind_template_child(widget_class, PidginConversation, history); gtk_widget_class_bind_template_child(widget_class, PidginConversation, - history_selection); - gtk_widget_class_bind_template_child(widget_class, PidginConversation, history_adjustment); gtk_widget_class_bind_template_child(widget_class, PidginConversation, input);
--- a/pidgin/resources/Conversations/conversation.ui Sun Nov 19 02:13:46 2023 -0600 +++ b/pidgin/resources/Conversations/conversation.ui Sun Nov 19 03:10:58 2023 -0600 @@ -31,6 +31,9 @@ <child> <object class="PidginInfoPane" id="info_pane"> <property name="hexpand">1</property> + <binding name="conversation"> + <lookup name="conversation">PidginConversation</lookup> + </binding> </object> </child> <child> @@ -67,7 +70,13 @@ </object> </property> <property name="model"> - <object class="GtkNoSelection" id="history_selection"/> + <object class="GtkNoSelection"> + <binding name="model"> + <lookup name="messages" type="PurpleConversation"> + <lookup name="conversation">PidginConversation</lookup> + </lookup> + </binding> + </object> </property> </object> </child>