--- a/pidgin/pidginnotificationlist.c Thu Mar 07 23:58:52 2024 -0600
+++ b/pidgin/pidginnotificationlist.c Fri Mar 08 01:05:27 2024 -0600
@@ -33,7 +33,7 @@
struct _PidginNotificationList {
GtkSingleSelection *selection_model;
@@ -106,6 +106,22 @@
*****************************************************************************/
+pidgin_notification_list_items_changed_cb(GListModel *model, + G_GNUC_UNUSED guint position, + G_GNUC_UNUSED guint added, + G_GNUC_UNUSED guint removed, + PidginNotificationList *list = data; + if(g_list_model_get_n_items(model) != 0) { + gtk_stack_set_visible_child_name(list->stack, "view"); + gtk_stack_set_visible_child_name(list->stack, "placeholder"); pidgin_notification_list_bind_cb(G_GNUC_UNUSED GtkSignalListItemFactory *self,
G_GNUC_UNUSED gpointer data)
@@ -152,6 +168,10 @@
model = purple_notification_manager_get_default_as_model();
gtk_single_selection_set_model(list->selection_model, model);
+ g_signal_connect(model, "items-changed", + G_CALLBACK(pidgin_notification_list_items_changed_cb), + pidgin_notification_list_items_changed_cb(model, 0, 0, 0, list); @@ -164,7 +184,7 @@
gtk_widget_class_bind_template_child(widget_class, PidginNotificationList,
gtk_widget_class_bind_template_child(widget_class, PidginNotificationList,
--- a/pidgin/resources/notificationlist.ui Thu Mar 07 23:58:52 2024 -0600
+++ b/pidgin/resources/notificationlist.ui Fri Mar 08 01:05:27 2024 -0600
@@ -18,6 +18,7 @@
<requires lib="gtk" version="4.0"/>
+ <requires lib="Adw" version="1.0"/> <!-- interface-license-type gplv2 -->
<!-- interface-name Pidgin -->
<!-- interface-description Internet Messenger -->
@@ -25,29 +26,39 @@
<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>
+ <object class="GtkStack" id="stack"> + <property name="vexpand">True</property> + <object class="GtkStackPage"> + <property name="name">view</property> + <property name="child"> + <object class="GtkListView"> + <property name="model"> + <object class="GtkSingleSelection" id="selection_model"/> + <property name="factory"> + <object class="GtkSignalListItemFactory"> + <signal name="bind" handler="pidgin_notification_list_bind_cb"/> --->
+ <object class="GtkStackPage"> + <property name="name">placeholder</property> + <property name="child"> + <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>