summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanielle Madeley <danielle.madeley@collabora.co.uk>2011-05-20 13:02:45 +1000
committerDanielle Madeley <danielle.madeley@collabora.co.uk>2011-05-25 11:02:31 +1000
commit6b6c8f4d75a3bba7aa3bba735749ddd3795a9da1 (patch)
tree89e6dcbb28b04f5b2de9ada0b205647cf417a649
parenta35ae7f145d2eacaa4c087cb9f2e72f3346e24fb (diff)
downloadempathy-6b6c8f4d75a3bba7aa3bba735749ddd3795a9da1.tar.gz
Add an icon to edited messages
Currently this is using "format-text-direction-ltr" which is a crappy choice. We should ask for a better icon. Also, this should really be implemented as a class, so that the icon can change with the theme. Or be made part of the Adium theme, or something. Basically this is kludgey.
-rw-r--r--libempathy-gtk/empathy-images.h2
-rw-r--r--libempathy-gtk/empathy-theme-adium.c28
2 files changed, 30 insertions, 0 deletions
diff --git a/libempathy-gtk/empathy-images.h b/libempathy-gtk/empathy-images.h
index e2512d495..c4b8afbfb 100644
--- a/libempathy-gtk/empathy-images.h
+++ b/libempathy-gtk/empathy-images.h
@@ -46,6 +46,8 @@ G_BEGIN_DECLS
#define EMPATHY_IMAGE_LOG "document-open-recent"
#define EMPATHY_IMAGE_DOCUMENT_SEND "document-send"
#define EMPATHY_IMAGE_AVATAR_DEFAULT "avatar-default"
+/* FIXME: need a better icon! */
+#define EMPATHY_IMAGE_EDIT_MESSAGE "format-text-direction-ltr"
#define EMPATHY_IMAGE_CALL_MISSED "call-start"
#define EMPATHY_IMAGE_CALL_INCOMING "call-start"
diff --git a/libempathy-gtk/empathy-theme-adium.c b/libempathy-gtk/empathy-theme-adium.c
index b20b43774..5a14902c9 100644
--- a/libempathy-gtk/empathy-theme-adium.c
+++ b/libempathy-gtk/empathy-theme-adium.c
@@ -651,6 +651,7 @@ theme_adium_edit_message (EmpathyChatView *view,
WebKitDOMElement *span;
gchar *id, *parsed_body;
gchar *tooltip, *timestamp;
+ GtkIconInfo *icon_info;
GError *error = NULL;
if (priv->pages_loading != 0) {
@@ -702,6 +703,33 @@ theme_adium_edit_message (EmpathyChatView *view,
g_free (tooltip);
g_free (timestamp);
+ /* mark this message as edited */
+ icon_info = gtk_icon_theme_lookup_icon (gtk_icon_theme_get_default (),
+ EMPATHY_IMAGE_EDIT_MESSAGE, 16, 0);
+
+ if (icon_info != NULL) {
+ /* set the icon as a background image using CSS
+ * FIXME: the icon won't update in response to theme changes */
+ gchar *style = g_strdup_printf (
+ "background-image:url('%s');"
+ "background-repeat:no-repeat;"
+ "background-position:left center;"
+ "padding-left:19px;", /* 16px icon + 3px padding */
+ gtk_icon_info_get_filename (icon_info));
+
+ webkit_dom_element_set_attribute (span, "style", style, &error);
+
+ if (error != NULL) {
+ DEBUG ("Error setting element style: %s",
+ error->message);
+ g_clear_error (&error);
+ /* not fatal */
+ }
+
+ g_free (style);
+ gtk_icon_info_free (icon_info);
+ }
+
goto finally;
except: