qulogic/pidgin

82fffff36df6
Parents 55b30ce86f17
Children eca0c08ed2a3
If a message is an action format it with italics

Testing Done:
I temporarily set all of the Echo bot's messages in the Demo protocol plugin to actions to test.

Reviewed at https://reviews.imfreedom.org/r/2859/
--- a/pidgin/pidginconversation.c Thu Nov 30 22:38:54 2023 -0600
+++ b/pidgin/pidginconversation.c Fri Dec 01 01:09:14 2023 -0600
@@ -276,6 +276,31 @@
return pidgin_conversation_set_tooltip_for_timestamp(tooltip, timestamp);
}
+static PangoAttrList *
+pidgin_conversation_get_message_attributes(G_GNUC_UNUSED GObject *self,
+ PurpleMessage *message,
+ G_GNUC_UNUSED gpointer data)
+{
+ PangoAttrList *attrs = NULL;
+
+ if(!PURPLE_IS_MESSAGE(message)) {
+ return NULL;
+ }
+
+ attrs = pango_attr_list_new();
+
+ if(purple_message_get_action(message)) {
+ PangoAttribute *attr = NULL;
+
+ attr = pango_attr_style_new(PANGO_STYLE_ITALIC);
+
+ pango_attr_list_insert(attrs, attr);
+ }
+
+ return attrs;
+}
+
+
static char *
pidgin_conversation_process_message_contents_cb(G_GNUC_UNUSED GObject *self,
const char *contents,
@@ -418,6 +443,8 @@
gtk_widget_class_bind_template_callback(widget_class,
pidgin_conversation_query_tooltip_edited_cb);
gtk_widget_class_bind_template_callback(widget_class,
+ pidgin_conversation_get_message_attributes);
+ gtk_widget_class_bind_template_callback(widget_class,
pidgin_conversation_process_message_contents_cb);
gtk_widget_class_bind_template_callback(widget_class,
pidgin_conversation_member_list_context_cb);
--- a/pidgin/resources/Conversations/message.ui Thu Nov 30 22:38:54 2023 -0600
+++ b/pidgin/resources/Conversations/message.ui Fri Dec 01 01:09:14 2023 -0600
@@ -97,6 +97,11 @@
</lookup>
</closure>
</binding>
+ <binding name="attributes">
+ <closure type="PangoAttrList" function="pidgin_conversation_get_message_attributes">
+ <lookup name="item">GtkListItem</lookup>
+ </closure>
+ </binding>
</object>
</child>
</object>