pidgin/pidgin

Some cleanups for PidginDisplayItem

12 days ago, Gary Kramlich
d823c3372e97
Parents a97f73db61d0
Children 8cf1d11b59c1
Some cleanups for PidginDisplayItem

Set the title labels to ellipsize at the end, fix the position of the
notification indicators, and hide the notification indicators when the item is
selected. We're hiding them because a later review request is going to allow
us to show additional widgets on hover and selection.

Testing Done:
Ran the turtles and opened a bunch of conversations and notifications. See the screen shots in the review.

Reviewed at https://reviews.imfreedom.org/r/3177/
--- a/pidgin/pidgindisplaywindow.c Thu May 09 21:27:08 2024 -0500
+++ b/pidgin/pidgindisplaywindow.c Fri May 10 01:10:09 2024 -0500
@@ -445,9 +445,18 @@
id,
NULL);
if (!item_exists) {
+ PurpleProtocol *protocol = NULL;
+ const char *icon_name = NULL;
+
item = pidgin_display_item_new(pidgin_conversation, id);
g_object_set_data(G_OBJECT(item), "conversation", purple_conversation);
+ protocol = purple_account_get_protocol(account);
+ icon_name = purple_protocol_get_icon_name(protocol);
+ if(!purple_strempty(icon_name)) {
+ pidgin_display_item_set_icon_name(item, icon_name);
+ }
+
g_object_bind_property(purple_conversation, "title",
item, "title",
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
--- a/pidgin/resources/display-item.ui Thu May 09 21:27:08 2024 -0500
+++ b/pidgin/resources/display-item.ui Fri May 10 01:10:09 2024 -0500
@@ -10,10 +10,25 @@
<object class="GtkBox">
<property name="orientation">horizontal</property>
<property name="spacing">6</property>
+ <binding name="tooltip-text">
+ <lookup name="title" type="PidginDisplayItem">
+ <lookup name="item">expander</lookup>
+ </lookup>
+ </binding>
+ <child>
+ <object class="GtkImage">
+ <binding name="icon-name">
+ <lookup name="icon-name" type="PidginDisplayItem">
+ <lookup name="item">expander</lookup>
+ </lookup>
+ </binding>
+ </object>
+ </child>
<child>
<object class="GtkLabel">
<property name="xalign">0</property>
- <property name="hexpand">0</property>
+ <property name="hexpand">1</property>
+ <property name="ellipsize">end</property>
<binding name="label">
<lookup name="title" type="PidginDisplayItem">
<lookup name="item">expander</lookup>
@@ -22,22 +37,29 @@
</object>
</child>
<child>
- <object class="GtkLabel">
- <style>
- <class name="accent"/>
- <class name="circular"/>
- </style>
- <property name="halign">end</property>
- <binding name="visible">
- <lookup name="needs-attention" type="PidginDisplayItem">
- <lookup name="item">expander</lookup>
- </lookup>
- </binding>
- <binding name="label">
- <lookup name="badge-number" type="PidginDisplayItem">
- <lookup name="item">expander</lookup>
- </lookup>
- </binding>
+ <object class="GtkBox">
+ <property name="spacing">6</property>
+ <property name="visible" bind-source="GtkListItem" bind-property="selected" bind-flags="sync-create|invert-boolean"/>
+ <child>
+ <object class="GtkLabel">
+ <style>
+ <class name="notification-count"/>
+ </style>
+ <property name="halign">end</property>
+ <property name="hexpand">true</property>
+ <property name="valign">center</property>
+ <binding name="visible">
+ <lookup name="needs-attention" type="PidginDisplayItem">
+ <lookup name="item">expander</lookup>
+ </lookup>
+ </binding>
+ <binding name="label">
+ <lookup name="badge-number" type="PidginDisplayItem">
+ <lookup name="item">expander</lookup>
+ </lookup>
+ </binding>
+ </object>
+ </child>
</object>
</child>
</object>
--- a/pidgin/resources/display-window.ui Thu May 09 21:27:08 2024 -0500
+++ b/pidgin/resources/display-window.ui Fri May 10 01:10:09 2024 -0500
@@ -28,6 +28,7 @@
<property name="item-type">PidginDisplayItem</property>
<child>
<object class="PidginDisplayItem">
+ <property name="icon-name">system-users-symbolic</property>
<property name="id">__contacts__</property>
<property name="title" translatable="1">Contacts</property>
<property name="widget">
@@ -41,6 +42,7 @@
</child>
<child>
<object class="PidginDisplayItem">
+ <property name="icon-name">emblem-important-symbolic</property>
<property name="id">__notifications__</property>
<property name="title" translatable="1">Notifications</property>
<property name="widget">
@@ -62,6 +64,7 @@
</child>
<child>
<object class="PidginDisplayItem">
+ <property name="icon-name">application-x-addon-symbolic</property>
<property name="id">__plugins__</property>
<property name="title" translatable="1">Plugins</property>
<property name="widget">
@@ -103,6 +106,7 @@
</child>
<child>
<object class="PidginDisplayItem">
+ <property name="icon-name">user-available-symbolic</property>
<property name="id">__conversations__</property>
<property name="title" translatable="1">Conversations</property>
<property name="widget">
--- a/pidgin/resources/pidgin.gresource.xml Thu May 09 21:27:08 2024 -0500
+++ b/pidgin/resources/pidgin.gresource.xml Fri May 10 01:10:09 2024 -0500
@@ -40,6 +40,7 @@
<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 compressed="true">style.css</file>
<file>icons/16x16/status/pidgin-user-available.png</file>
<file>icons/16x16/status/pidgin-user-away.png</file>
<file>icons/16x16/status/pidgin-user-do-not-disturb.png</file>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pidgin/resources/style.css Fri May 10 01:10:09 2024 -0500
@@ -0,0 +1,10 @@
+/* This file is automatically loaded by AdwApplication. */
+.notification-count {
+ font-weight: bold;
+ font-size: 0.8em;
+ border-radius: 10px;
+ min-width: 0.7em;
+ padding: 2px 5px;
+ color: @accent_fg_color;
+ background-color: @accent_bg_color;
+}