--- a/pidgin/pidgincontactlist.c Thu Mar 23 23:11:59 2023 -0500
+++ b/pidgin/pidgincontactlist.c Wed Mar 29 23:21:05 2023 -0500
@@ -168,6 +168,57 @@
return !purple_strempty(message);
+pidgin_contact_list_get_primitive_as_string(G_GNUC_UNUSED GObject *self, + PurplePresence *presence, + G_GNUC_UNUSED gpointer data) + PurplePresencePrimitive primitive; + GDateTime *idle = NULL; + GString *str = g_string_new(NULL); + const char *tmp = NULL; + if(!PURPLE_IS_PRESENCE(presence)) { + return g_string_free(str, FALSE); + primitive = purple_presence_get_primitive(presence); + tmp = purple_presence_primitive_to_string(primitive); + g_string_append_printf(str, " - %s", tmp); + idle = purple_presence_get_idle_time(presence); + now = g_date_time_new_now_utc(); + duration = g_date_time_difference(now, idle); + g_date_time_unref(now); + days = duration / G_TIME_SPAN_DAY; + duration %= G_TIME_SPAN_DAY; + hours = duration / G_TIME_SPAN_HOUR; + duration %= G_TIME_SPAN_HOUR; + minutes = duration / G_TIME_SPAN_MINUTE; + g_string_append_printf(str, _(" Idle %dd %dh %02dm"), days, hours, + g_string_append_printf(str, _(" Idle %dh %02dm"), hours, minutes); + } else if(minutes > 0) { + g_string_append_printf(str, _(" Idle %02dm"), minutes); + return g_string_free(str, FALSE); /******************************************************************************
*****************************************************************************/
@@ -212,6 +263,8 @@
pidgin_contact_list_activate_cb);
gtk_widget_class_bind_template_callback(widget_class,
pidgin_contact_list_message_visible_cb);
+ gtk_widget_class_bind_template_callback(widget_class, + pidgin_contact_list_get_primitive_as_string); /******************************************************************************
--- a/pidgin/resources/ContactList/widget.ui Thu Mar 23 23:11:59 2023 -0500
+++ b/pidgin/resources/ContactList/widget.ui Wed Mar 29 23:21:05 2023 -0500
@@ -70,14 +70,34 @@
<property name="vexpand">1</property>
<property name="valign">center</property>
- <object class="GtkLabel">
- <property name="xalign">0</property>
- <property name="use-markup">1</property>
- <lookup name="name-for-display" type="PurplePerson">
- <lookup name="item">GtkListItem</lookup>
+ <object class="GtkBox"> + <property name="orientation">horizontal</property> + <object class="GtkLabel"> + <property name="xalign">0</property> + <property name="use-markup">1</property> + <lookup name="name-for-display" type="PurplePerson"> + <lookup name="item">GtkListItem</lookup> + <object class="GtkLabel"> + <property name="xalign">0</property> + <closure type="gchararray" function="pidgin_contact_list_get_primitive_as_string"> + <lookup name="presence" type="PurpleContactInfo"> + <lookup name="priority-contact-info" type="PurplePerson"> + <lookup name="item">GtkListItem</lookup>