[empathy: 15/28] Add dates to new log viewer



commit 4133101266b116d34b04a69e9957c0502daf72e8
Author: Danielle Madeley <danielle madeley collabora co uk>
Date:   Tue Aug 9 14:05:28 2011 +1000

    Add dates to new log viewer

 data/empathy-log-window.html        |   14 ++++++++++----
 libempathy-gtk/empathy-log-window.c |    9 ++++++---
 2 files changed, 16 insertions(+), 7 deletions(-)
---
diff --git a/data/empathy-log-window.html b/data/empathy-log-window.html
index db93240..d466c91 100644
--- a/data/empathy-log-window.html
+++ b/data/empathy-log-window.html
@@ -12,6 +12,7 @@ body {
 
 div.row {
   margin-left: 1em;
+  clear: both;
 }
 
 div.row p {
@@ -28,6 +29,11 @@ span.closed:after {
   content: "\25B8";
   margin-right: 2px;
 }
+
+span.date {
+  float: right;
+  color: gray;
+}
     </style>
     <script type="text/javascript">
 function filterNodes (node, tagName)
@@ -102,7 +108,7 @@ function expandAll()
   expandAllRecurse(treeview);
 }
 
-function insertRow (path, text)
+function insertRow (path, text, date_)
 {
   var treeview = document.getElementById('treeview');
   var parentnode = treeview;
@@ -144,14 +150,14 @@ function insertRow (path, text)
   
   var contents = document.createElement('p');
   newnode.appendChild(contents);
-  contents.innerHTML = text;
+  contents.innerHTML = text + '<span class="date">' + date_ + '</span>';
 
   // if the node is not a top-level node, hide it
   if (parentnode != treeview)
     newnode.style.display = 'none';
 }
 
-function changeRow (path, text)
+function changeRow (path, text, date_)
 {
   var treeview = document.getElementById('treeview');
   var node = treeview;
@@ -164,7 +170,7 @@ function changeRow (path, text)
 
   // set the contents
   var contents = getContent(node);
-  contents.innerHTML = text;
+  contents.innerHTML = text + '<span class="date">' + date_ + '</span>';
 }
 
 function deleteRow (path)
diff --git a/libempathy-gtk/empathy-log-window.c b/libempathy-gtk/empathy-log-window.c
index fdf4333..f2aafda 100644
--- a/libempathy-gtk/empathy-log-window.c
+++ b/libempathy-gtk/empathy-log-window.c
@@ -375,16 +375,18 @@ insert_or_change_row (EmpathyLogWindow *self,
     GtkTreeIter *iter)
 {
   char *str = gtk_tree_path_to_string (path);
-  char *script, *text;
+  char *script, *text, *date;
 
   gtk_tree_model_get (model, iter,
       COL_EVENTS_TEXT, &text,
+      COL_EVENTS_PRETTY_DATE, &date,
       -1);
 
-  script = g_strdup_printf ("javascript:%s([%s], '%s');",
+  script = g_strdup_printf ("javascript:%s([%s], '%s', '%s');",
       method,
       g_strdelimit (str, ":", ','),
-      text);
+      text,
+      date);
 
   // g_print ("%s\n", script);
   webkit_web_view_execute_script (WEBKIT_WEB_VIEW (self->priv->webview),
@@ -392,6 +394,7 @@ insert_or_change_row (EmpathyLogWindow *self,
 
   g_free (str);
   g_free (text);
+  g_free (date);
   g_free (script);
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]