--- a/pidgin/pidginnotificationlist.c Thu Mar 07 22:36:47 2024 -0600
+++ b/pidgin/pidginnotificationlist.c Thu Mar 07 22:59:26 2024 -0600
@@ -33,7 +33,8 @@
struct _PidginNotificationList {
+ GtkSingleSelection *selection_model; G_DEFINE_FINAL_TYPE(PidginNotificationList, pidgin_notification_list,
@@ -101,13 +102,20 @@
-pidgin_notification_list_create_widget_func(gpointer item,
- G_GNUC_UNUSED gpointer data)
+/****************************************************************************** + *****************************************************************************/ +pidgin_notification_list_bind_cb(G_GNUC_UNUSED GtkSignalListItemFactory *self, + 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 +138,7 @@
widget = pidgin_notification_list_unknown_notification(notification);
+ gtk_list_item_set_child(item, widget); /******************************************************************************
@@ -138,12 +146,12 @@
*****************************************************************************/
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,
+ model = purple_notification_manager_get_default_as_model(); + gtk_single_selection_set_model(list->selection_model, model); @@ -152,11 +160,16 @@
gtk_widget_class_set_template_from_resource(
- "/im/pidgin/Pidgin3/Notifications/list.ui"
+ "/im/pidgin/Pidgin3/notificationlist.ui" gtk_widget_class_bind_template_child(widget_class, PidginNotificationList,
+ gtk_widget_class_bind_template_child(widget_class, PidginNotificationList, + gtk_widget_class_bind_template_callback(widget_class, + pidgin_notification_list_bind_cb); /******************************************************************************
--- a/pidgin/resources/Notifications/list.ui Thu Mar 07 22:36:47 2024 -0600
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-Pidgin - Internet Messenger
-Copyright (C) Pidgin Developers <devel@pidgin.im>
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with this library; if not, see <https://www.gnu.org/licenses/>.
--->
- <requires lib="gtk" version="4.0"/>
- <requires lib="Adw" version="1.0"/>
- <!-- interface-license-type gplv2 -->
- <!-- interface-name Pidgin -->
- <!-- interface-description Internet Messenger -->
- <!-- interface-copyright Pidgin Developers <devel@pidgin.im> -->
- <template class="PidginNotificationList" parent="GtkBox">
- <property name="orientation">vertical</property>
- <object class="GtkListBox" id="list_box">
- <property name="vexpand">1</property>
- <child type="placeholder">
- <object class="AdwStatusPage">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="icon-name">mail-read-symbolic</property>
- <property name="title" translatable="1">Notifications</property>
- <property name="description" translatable="1">You're all caught up!</property>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pidgin/resources/notificationlist.ui Thu Mar 07 22:59:26 2024 -0600
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?> +Pidgin - Internet Messenger +Copyright (C) Pidgin Developers <devel@pidgin.im> +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. +You should have received a copy of the GNU General Public License +along with this library; if not, see <https://www.gnu.org/licenses/>. + <requires lib="gtk" version="4.0"/> + <!-- interface-license-type gplv2 --> + <!-- interface-name Pidgin --> + <!-- interface-description Internet Messenger --> + <!-- interface-copyright Pidgin Developers <devel@pidgin.im> --> + <template class="PidginNotificationList" parent="GtkBox"> + <property name="orientation">vertical</property> + <object class="GtkListView" id="list_view"> + <property name="model"> + <object class="GtkSingleSelection" id="selection_model"/> + <property name="factory"> + <object class="GtkSignalListItemFactory"> + <signal name="bind" handler="pidgin_notification_list_bind_cb"/> + <child type="placeholder"> + <object class="AdwStatusPage"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="icon-name">mail-read-symbolic</property> + <property name="title" translatable="1">Notifications</property> + <property name="description" translatable="1">You're all caught up!</property> --- a/pidgin/resources/pidgin.gresource.xml Thu Mar 07 22:36:47 2024 -0600
+++ b/pidgin/resources/pidgin.gresource.xml Thu Mar 07 22:59:26 2024 -0600
@@ -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>