[empathy: 16/28] Add icons to the new log viewer
- From: Danielle Madeley <daniellem src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [empathy: 16/28] Add icons to the new log viewer
- Date: Thu, 18 Aug 2011 00:36:08 +0000 (UTC)
commit 14899f2d17dd5943b28fb83e79aa998125159fff
Author: Danielle Madeley <danielle madeley collabora co uk>
Date: Tue Aug 9 14:21:35 2011 +1000
Add icons to the new log viewer
data/empathy-log-window.html | 26 ++++++++++++++++++++++----
libempathy-gtk/empathy-log-window.c | 22 ++++++++++++++++++++--
2 files changed, 42 insertions(+), 6 deletions(-)
---
diff --git a/data/empathy-log-window.html b/data/empathy-log-window.html
index d466c91..034c930 100644
--- a/data/empathy-log-window.html
+++ b/data/empathy-log-window.html
@@ -34,6 +34,11 @@ span.date {
float: right;
color: gray;
}
+
+img.icon {
+ vertical-align: middle;
+ padding-right: 1px;
+}
</style>
<script type="text/javascript">
function filterNodes (node, tagName)
@@ -108,7 +113,20 @@ function expandAll()
expandAllRecurse(treeview);
}
-function insertRow (path, text, date_)
+function setContent (contents, text, icon, date_)
+{
+ contents.innerHTML = "";
+
+ if (icon != "")
+ {
+ contents.innerHTML += '<img class="icon" src="' + icon + '"/>';
+ }
+
+ contents.innerHTML += text;
+ contents.innerHTML += '<span class="date">' + date_ + '</span>';
+}
+
+function insertRow (path, text, icon, date_)
{
var treeview = document.getElementById('treeview');
var parentnode = treeview;
@@ -150,14 +168,14 @@ function insertRow (path, text, date_)
var contents = document.createElement('p');
newnode.appendChild(contents);
- contents.innerHTML = text + '<span class="date">' + date_ + '</span>';
+ setContent(contents, text, icon, date_);
// if the node is not a top-level node, hide it
if (parentnode != treeview)
newnode.style.display = 'none';
}
-function changeRow (path, text, date_)
+function changeRow (path, text, icon, date_)
{
var treeview = document.getElementById('treeview');
var node = treeview;
@@ -170,7 +188,7 @@ function changeRow (path, text, date_)
// set the contents
var contents = getContent(node);
- contents.innerHTML = text + '<span class="date">' + date_ + '</span>';
+ setContent(contents, text, icon, date_);
}
function deleteRow (path)
diff --git a/libempathy-gtk/empathy-log-window.c b/libempathy-gtk/empathy-log-window.c
index f2aafda..ba63420 100644
--- a/libempathy-gtk/empathy-log-window.c
+++ b/libempathy-gtk/empathy-log-window.c
@@ -375,17 +375,33 @@ insert_or_change_row (EmpathyLogWindow *self,
GtkTreeIter *iter)
{
char *str = gtk_tree_path_to_string (path);
- char *script, *text, *date;
+ char *script, *text, *date, *stock_icon;
+ char *icon = NULL;
gtk_tree_model_get (model, iter,
COL_EVENTS_TEXT, &text,
COL_EVENTS_PRETTY_DATE, &date,
+ COL_EVENTS_ICON, &stock_icon,
-1);
- script = g_strdup_printf ("javascript:%s([%s], '%s', '%s');",
+ if (!tp_str_empty (stock_icon))
+ {
+ GtkIconInfo *icon_info = gtk_icon_theme_lookup_icon (
+ gtk_icon_theme_get_default (),
+ stock_icon,
+ GTK_ICON_SIZE_MENU, 0);
+
+ if (icon_info != NULL)
+ icon = g_strdup (gtk_icon_info_get_filename (icon_info));
+
+ gtk_icon_info_free (icon_info);
+ }
+
+ script = g_strdup_printf ("javascript:%s([%s], '%s', '%s', '%s');",
method,
g_strdelimit (str, ":", ','),
text,
+ icon != NULL ? icon: "",
date);
// g_print ("%s\n", script);
@@ -395,6 +411,8 @@ insert_or_change_row (EmpathyLogWindow *self,
g_free (str);
g_free (text);
g_free (date);
+ g_free (stock_icon);
+ g_free (icon);
g_free (script);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]