pidgin/pidgin

Add status-messages to PidginContactList

16 months ago, Gary Kramlich
e575534f450d
Parents 18adb1710a54
Children 742efe62e610
Add status-messages to PidginContactList

Testing Done:
Connected the demo protocol plugin and verified everything looked correct.

Bugs closed: PIDGIN-17754

Reviewed at https://reviews.imfreedom.org/r/2231/
--- a/pidgin/pidgincontactlist.c Fri Feb 10 00:52:05 2023 -0600
+++ b/pidgin/pidgincontactlist.c Fri Feb 10 00:59:09 2023 -0600
@@ -113,6 +113,16 @@
}
}
+static gboolean
+pidgin_contact_list_message_visible_cb(G_GNUC_UNUSED GtkListItem *item,
+ const char *message)
+{
+ /* If we have a message, return TRUE because this is bound to the label's
+ * visibility.
+ */
+ return (message != NULL);
+}
+
/******************************************************************************
* GObject Implementation
*****************************************************************************/
@@ -146,6 +156,8 @@
pidgin_contact_list_avatar_cb);
gtk_widget_class_bind_template_callback(widget_class,
pidgin_contact_list_activate_cb);
+ gtk_widget_class_bind_template_callback(widget_class,
+ pidgin_contact_list_message_visible_cb);
}
/******************************************************************************
--- a/pidgin/resources/ContactList/widget.ui Fri Feb 10 00:52:05 2023 -0600
+++ b/pidgin/resources/ContactList/widget.ui Fri Feb 10 00:59:09 2023 -0600
@@ -50,16 +50,53 @@
</object>
</child>
<child>
- <object class="GtkLabel">
- <property name="xalign">0</property>
- <property name="use-markup">1</property>
- <binding name="label">
- <lookup name="name-for-display" type="PurpleContactInfo">
- <lookup name="priority-contact-info" type="PurplePerson">
- <lookup name="item">GtkListItem</lookup>
- </lookup>
- </lookup>
- </binding>
+ <object class="GtkBox">
+ <property name="hexpand">1</property>
+ <property name="orientation">vertical</property>
+ <property name="vexpand">1</property>
+ <property name="valign">center</property>
+ <child>
+ <object class="GtkLabel">
+ <property name="xalign">0</property>
+ <property name="use-markup">1</property>
+ <binding name="label">
+ <lookup name="name-for-display" type="PurpleContactInfo">
+ <lookup name="priority-contact-info" type="PurplePerson">
+ <lookup name="item">GtkListItem</lookup>
+ </lookup>
+ </lookup>
+ </binding>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel" id="status_message">
+ <style>
+ <class name="dim-label"/>
+ </style>
+ <property name="xalign">0</property>
+ <property name="ellipsize">end</property>
+ <binding name="label">
+ <lookup name="message" type="PurplePresence">
+ <lookup name="presence" type="PurpleContactInfo">
+ <lookup name="priority-contact-info" type="PurplePerson">
+ <lookup name="item">GtkListItem</lookup>
+ </lookup>
+ </lookup>
+ </lookup>
+ </binding>
+ <binding name="visible">
+ <closure type="gboolean" function="pidgin_contact_list_message_visible_cb">
+ <lookup name="message" type="PurplePresence">
+ <lookup name="presence" type="PurpleContactInfo">
+ <lookup name="priority-contact-info" type="PurplePerson">
+ <lookup name="item">GtkListItem</lookup>
+ </lookup>
+ </lookup>
+ </lookup>
+ </closure>
+ </binding>
+ </object>
+ </child>
</object>
</child>
</object>