# HG changeset patch
# Node ID 03536215c9fd
# Parent  931b9adb4ab5
diff --git a/pidgin/pidginnotificationlist.c b/pidgin/pidginnotificationlist.c
--- a/pidgin/pidginnotificationlist.c
+++ b/pidgin/pidginnotificationlist.c
@@ -33,7 +33,10 @@
 struct _PidginNotificationList {
 	GtkBox parent;
 
-	GtkWidget *list_box;
+	GtkWidget *list_view;
+	GtkSingleSelection *selection_model;
+
+	guint unread_count;
 };
 
 G_DEFINE_FINAL_TYPE(PidginNotificationList, pidgin_notification_list,
@@ -101,13 +104,20 @@
 	return row;
 }
 
-static GtkWidget *
-pidgin_notification_list_create_widget_func(gpointer item,
-                                            G_GNUC_UNUSED gpointer data)
+/******************************************************************************
+ * Callbacks
+ *****************************************************************************/
+static void
+pidgin_notification_list_bind_cb(G_GNUC_UNUSED GtkSignalListItemFactory *self,
+                                 GObject* object,
+                                 G_GNUC_UNUSED gpointer data)
 {
-	PurpleNotification *notification = item;
+	PurpleNotification *notification = NULL;
+	GtkListItem *item = GTK_LIST_ITEM(object);
 	GtkWidget *widget = NULL;
 
+	notification = gtk_list_item_get_item(item);
+
 	switch(purple_notification_get_notification_type(notification)) {
 		case PURPLE_NOTIFICATION_TYPE_GENERIC:
 			widget = pidgin_notification_generic_new(notification);
@@ -130,7 +140,7 @@
 		widget = pidgin_notification_list_unknown_notification(notification);
 	}
 
-	return widget;
+	gtk_list_item_set_child(item, widget);
 }
 
 /******************************************************************************
@@ -138,12 +148,12 @@
  *****************************************************************************/
 static void
 pidgin_notification_list_init(PidginNotificationList *list) {
+	GListModel *model = NULL;
+
 	gtk_widget_init_template(GTK_WIDGET(list));
 
-	gtk_list_box_bind_model(GTK_LIST_BOX(list->list_box),
-	                        purple_notification_manager_get_default_as_model(),
-	                        pidgin_notification_list_create_widget_func,
-	                        list, NULL);
+	model = purple_notification_manager_get_default_as_model();
+	gtk_single_selection_set_model(list->selection_model, model);
 }
 
 static void
@@ -152,11 +162,16 @@
 
 	gtk_widget_class_set_template_from_resource(
 	    widget_class,
-	    "/im/pidgin/Pidgin3/Notifications/list.ui"
+	    "/im/pidgin/Pidgin3/notificationlist.ui"
 	);
 
 	gtk_widget_class_bind_template_child(widget_class, PidginNotificationList,
-	                                     list_box);
+	                                     list_view);
+	gtk_widget_class_bind_template_child(widget_class, PidginNotificationList,
+	                                     selection_model);
+
+	gtk_widget_class_bind_template_callback(widget_class,
+	                                        pidgin_notification_list_bind_cb);
 }
 
 /******************************************************************************
diff --git a/pidgin/resources/Notifications/list.ui b/pidgin/resources/notificationlist.ui
rename from pidgin/resources/Notifications/list.ui
rename to pidgin/resources/notificationlist.ui
--- a/pidgin/resources/Notifications/list.ui
+++ b/pidgin/resources/notificationlist.ui
@@ -18,7 +18,6 @@
 -->
 <interface>
   <requires lib="gtk" version="4.0"/>
-  <requires lib="Adw" version="1.0"/>
   <!-- interface-license-type gplv2 -->
   <!-- interface-name Pidgin -->
   <!-- interface-description Internet Messenger -->
@@ -26,8 +25,16 @@
   <template class="PidginNotificationList" parent="GtkBox">
     <property name="orientation">vertical</property>
     <child>
-      <object class="GtkListBox" id="list_box">
-        <property name="vexpand">1</property>
+      <object class="GtkListView" id="list_view">
+        <property name="model">
+          <object class="GtkSingleSelection" id="selection_model"/>
+        </property>
+        <property name="factory">
+          <object class="GtkSignalListItemFactory">
+            <signal name="bind" handler="pidgin_notification_list_bind_cb"/>
+          </object>
+        </property>
+<!--
         <child type="placeholder">
           <object class="AdwStatusPage">
             <property name="visible">True</property>
@@ -40,6 +47,7 @@
             </child>
           </object>
         </child>
+-->
       </object>
     </child>
   </template>
diff --git a/pidgin/resources/pidgin.gresource.xml b/pidgin/resources/pidgin.gresource.xml
--- a/pidgin/resources/pidgin.gresource.xml
+++ b/pidgin/resources/pidgin.gresource.xml
@@ -19,7 +19,6 @@
     <file compressed="true" preprocess="xml-stripblanks">Notifications/addcontact.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">Notifications/authorizationrequest.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">Notifications/connectionerror.ui</file>
-    <file compressed="true" preprocess="xml-stripblanks">Notifications/list.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">Plugins/dialog.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">Prefs/away.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">Prefs/conversation.ui</file>
@@ -43,6 +42,7 @@
     <file compressed="true" preprocess="xml-stripblanks">conversationmemberlistitem.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">imwindow.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">infopane.ui</file>
+    <file compressed="true" preprocess="xml-stripblanks">notificationlist.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">presenceicon.ui</file>
     <file>icons/16x16/status/pidgin-user-available.png</file>
     <file>icons/16x16/status/pidgin-user-away.png</file>
