pidgin/resources/Conversations/message.ui

changeset 43093
27f816a512af
parent 42905
d332eb539cb9
child 43094
4ff60371673f
--- a/pidgin/resources/Conversations/message.ui	Tue Nov 26 00:03:40 2024 -0600
+++ b/pidgin/resources/Conversations/message.ui	Fri Nov 29 00:32:37 2024 -0600
@@ -18,97 +18,91 @@
 -->
 <interface>
   <requires lib="gtk" version="4.0"/>
-  <template class="GtkListItem">
-    <property name="child">
+  <template class="PidginMessage">
+    <property name="orientation">horizontal</property>
+    <child>
+      <object class="GtkEventControllerMotion" id="motion_controller"/>
+    </child>
+    <child>
+      <object class="GtkImage" id="avatar">
+        <property name="icon-name">image-missing</property>
+        <property name="visible">0</property>
+      </object>
+    </child>
+    <child>
       <object class="GtkBox">
-        <child>
-          <object class="GtkEventControllerMotion" id="motion_controller"/>
-        </child>
-        <child>
-          <object class="GtkImage" id="avatar">
-            <property name="icon-name">image-missing</property>
-            <property name="visible">0</property>
-          </object>
-        </child>
+        <property name="hexpand">1</property>
+        <property name="orientation">vertical</property>
         <child>
           <object class="GtkBox">
-            <property name="hexpand">1</property>
-            <property name="orientation">vertical</property>
+            <property name="spacing">8</property>
             <child>
-              <object class="GtkBox">
-                <property name="spacing">8</property>
-                <child>
-                  <object class="GtkLabel" id="author">
-                    <binding name="label">
-                      <lookup name="name-for-display" type="PurpleContactInfo">
-                        <lookup name="author" type="PurpleMessage">
-                          <lookup name="item">GtkListItem</lookup>
-                        </lookup>
-                      </lookup>
-                    </binding>
-                    <binding name="attributes">
-                      <closure type="PangoAttrList" function="pidgin_conversation_get_author_attributes">
-                        <lookup name="item">GtkListItem</lookup>
-                      </closure>
-                    </binding>
-                  </object>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="timestamp">
-                    <binding name="visible">
-                      <lookup name="contains-pointer">motion_controller</lookup>
-                    </binding>
-                    <binding name="label">
-                      <closure type="gchararray" function="pidgin_converation_get_timestamp_string">
-                        <lookup name="item">GtkListItem</lookup>
-                      </closure>
-                    </binding>
-                    <property name="has-tooltip">1</property>
-                    <signal name="query-tooltip" handler="pidgin_conversation_query_tooltip_timestamp_cb"/>
-                  </object>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="edited">
-                    <binding name="visible">
-                      <lookup name="edited" type="PurpleMessage">
-                        <lookup name="item">GtkListItem</lookup>
-                      </lookup>
-                    </binding>
-                    <property name="label" translatable="yes">(edited)</property>
-                    <property name="has-tooltip">1</property>
-                    <signal name="query-tooltip" handler="pidgin_conversation_query_tooltip_edited_cb"/>
-                  </object>
-                </child>
-              </object>
-            </child>
-            <child>
-              <object class="GtkLabel" id="content">
-                <property name="wrap">1</property>
-                <property name="wrap-mode">word-char</property>
-                <property name="xalign">0</property>
-                <property name="yalign">0</property>
-                <property name="use-markup">1</property>
+              <object class="GtkLabel" id="author">
                 <binding name="label">
-                  <!-- this file is used by a GtkItemFactory in
-                      PidginConversation which is why the function name has a
-                      pidgin_conversation prefix.
+                  <!-- The first argument to the closure is automatically a
+                       PidginMessage, but if we don't do the lookup the message
+                       property on it isn't set yet for some reason.
                     -->
-                  <closure type="gchararray" function="pidgin_conversation_process_message_contents_cb">
-                    <lookup name="contents" type="PurpleMessage">
-                      <lookup name="item">GtkListItem</lookup>
-                    </lookup>
+                  <closure type="gchararray" function="pidgin_message_get_author">
+                    <lookup name="message">PidginMessage</lookup>
                   </closure>
                 </binding>
                 <binding name="attributes">
-                  <closure type="PangoAttrList" function="pidgin_conversation_get_message_attributes">
-                    <lookup name="item">GtkListItem</lookup>
+                  <closure type="PangoAttrList" function="pidgin_message_get_author_attributes">
+                    <lookup name="message">PidginMessage</lookup>
                   </closure>
                 </binding>
               </object>
             </child>
+            <child>
+              <object class="GtkLabel" id="timestamp">
+                <binding name="visible">
+                  <lookup name="contains-pointer">motion_controller</lookup>
+                </binding>
+                <property name="has-tooltip">1</property>
+                <signal name="query-tooltip" handler="pidgin_message_query_tooltip_timestamp_cb"/>
+              </object>
+            </child>
+            <child>
+              <object class="GtkLabel" id="edited">
+                <binding name="visible">
+                  <lookup name="edited" type="PurpleMessage">
+                    <lookup name="message">PidginMessage</lookup>
+                  </lookup>
+                </binding>
+                <property name="label" translatable="yes">(edited)</property>
+                <property name="has-tooltip">1</property>
+                <signal name="query-tooltip" handler="pidgin_message_query_tooltip_edited_cb"/>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel" id="content">
+            <property name="wrap">1</property>
+            <property name="wrap-mode">word-char</property>
+            <property name="xalign">0</property>
+            <property name="yalign">0</property>
+            <property name="use-markup">1</property>
+            <binding name="label">
+              <!-- this file is used by a GtkItemFactory in
+                  PidginConversation which is why the function name has a
+                  pidgin_conversation prefix.
+                -->
+              <closure type="gchararray" function="pidgin_message_process_message_contents_cb">
+                <lookup name="contents" type="PurpleMessage">
+                  <lookup name="message">PidginMessage</lookup>
+                </lookup>
+              </closure>
+            </binding>
+            <binding name="attributes">
+              <closure type="PangoAttrList" function="pidgin_message_get_message_attributes">
+                <lookup name="message">PidginMessage</lookup>
+              </closure>
+            </binding>
           </object>
         </child>
       </object>
-    </property>
+    </child>
   </template>
 </interface>

mercurial