# HG changeset patch
# Node ID 149864759f08
# Parent  fbcea290a1f6
diff --git a/pidgin/pidginconversation.c b/pidgin/pidginconversation.c
--- a/pidgin/pidginconversation.c
+++ b/pidgin/pidginconversation.c
@@ -78,6 +78,40 @@
 	}
 }
 
+/**
+ * pidgin_conversation_set_tooltip_for_timestamp: (skip)
+ * @tooltip: The tooltip to update.
+ * @timestamp: The timestamp to set.
+ *
+ * Updates @tooltip to display @timestamp. This is meant to be called from
+ * a GtkWidget::query-tooltip signal and it's return value should it what
+ * should be returned from that handler.
+ *
+ * Returns: %TRUE if a tooltip was set, otherwise %FALSE.
+ *
+ * Since: 3.0.0
+ */
+static gboolean
+pidgin_conversation_set_tooltip_for_timestamp(GtkTooltip *tooltip,
+                                              GDateTime *timestamp)
+{
+	GDateTime *local = NULL;
+	char *text = NULL;
+
+	if(timestamp == NULL) {
+		return FALSE;
+	}
+
+	local = g_date_time_to_local(timestamp);
+	text = g_date_time_format(local, "%c");
+	g_clear_pointer(&local, g_date_time_unref);
+
+	gtk_tooltip_set_text(tooltip, text);
+	g_clear_pointer(&text, g_free);
+
+	return TRUE;
+}
+
 /******************************************************************************
  * Callbacks
  *****************************************************************************/
@@ -171,6 +205,47 @@
 	return NULL;
 }
 
+static gboolean
+pidgin_conversation_query_tooltip_timestamp_cb(G_GNUC_UNUSED GtkWidget* self,
+                                               G_GNUC_UNUSED gint x,
+                                               G_GNUC_UNUSED gint y,
+                                               G_GNUC_UNUSED gboolean keyboard_mode,
+                                               GtkTooltip* tooltip,
+                                               gpointer data)
+{
+
+	PurpleMessage *message = gtk_list_item_get_item(data);
+	GDateTime *timestamp = NULL;
+
+	if(!PURPLE_IS_MESSAGE(message)) {
+		return FALSE;
+	}
+
+	timestamp = purple_message_get_timestamp(message);
+
+	return pidgin_conversation_set_tooltip_for_timestamp(tooltip, timestamp);
+}
+
+static gboolean
+pidgin_conversation_query_tooltip_edited_cb(G_GNUC_UNUSED GtkWidget* self,
+                                            G_GNUC_UNUSED gint x,
+                                            G_GNUC_UNUSED gint y,
+                                            G_GNUC_UNUSED gboolean keyboard_mode,
+                                            GtkTooltip* tooltip,
+                                            gpointer data)
+{
+	PurpleMessage *message = gtk_list_item_get_item(data);
+	GDateTime *timestamp = NULL;
+
+	if(!PURPLE_IS_MESSAGE(message)) {
+		return FALSE;
+	}
+
+	timestamp = purple_message_get_edited_at(message);
+
+	return pidgin_conversation_set_tooltip_for_timestamp(tooltip, timestamp);
+}
+
 /******************************************************************************
  * GObject Implementation
  *****************************************************************************/
@@ -269,6 +344,10 @@
 	                                        pidgin_conversation_get_author_attributes);
 	gtk_widget_class_bind_template_callback(widget_class,
 	                                        pidgin_converation_get_timestamp_string);
+	gtk_widget_class_bind_template_callback(widget_class,
+	                                        pidgin_conversation_query_tooltip_timestamp_cb);
+	gtk_widget_class_bind_template_callback(widget_class,
+	                                        pidgin_conversation_query_tooltip_edited_cb);
 }
 
 /******************************************************************************
diff --git a/pidgin/resources/Conversations/message.ui b/pidgin/resources/Conversations/message.ui
--- a/pidgin/resources/Conversations/message.ui
+++ b/pidgin/resources/Conversations/message.ui
@@ -55,12 +55,20 @@
                         <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">
-                    <property name="visible">0</property>
+                    <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>
