From 7565c39bfa0f118fb513c0af86a5ba0ef7976277 Mon Sep 17 00:00:00 2001 From: Danielle Madeley Date: Mon, 1 Aug 2011 15:42:43 +1000 Subject: Add expander toggles --- data/empathy-log-window.html | 66 +++++++++++++++++++++++++++++++++++++ libempathy-gtk/empathy-log-window.c | 23 +++++++++++++ 2 files changed, 89 insertions(+) diff --git a/data/empathy-log-window.html b/data/empathy-log-window.html index 2b87647fc..f2e0cdfe1 100644 --- a/data/empathy-log-window.html +++ b/data/empathy-log-window.html @@ -15,6 +15,16 @@ div.row p { display: inline; white-space: pre-wrap; } + +span.open:after { + content: "\25BE"; + margin-right: 2px; +} + +span.closed:after { + content: "\25B8"; + margin-right: 2px; +} diff --git a/libempathy-gtk/empathy-log-window.c b/libempathy-gtk/empathy-log-window.c index 9459ce26b..ef6450f36 100644 --- a/libempathy-gtk/empathy-log-window.c +++ b/libempathy-gtk/empathy-log-window.c @@ -429,6 +429,27 @@ store_events_row_deleted (GtkTreeModel *model, g_free (script); } +static void +store_events_has_child_rows (GtkTreeModel *model, + GtkTreePath *path, + GtkTreeIter *iter, + EmpathyLogWindow *self) +{ + char *str = gtk_tree_path_to_string (path); + char *script; + + script = g_strdup_printf ("javascript:hasChildRows([%s], %u);", + g_strdelimit (str, ":", ','), + gtk_tree_model_iter_has_child (model, iter)); + + // g_print ("%s\n", script); + webkit_web_view_execute_script (WEBKIT_WEB_VIEW (self->priv->webview), + script); + + g_free (str); + g_free (script); +} + static void store_events_rows_reordered (GtkTreeModel *model, GtkTreePath *path, @@ -695,6 +716,8 @@ empathy_log_window_init (EmpathyLogWindow *self) G_CALLBACK (store_events_row_deleted), self); g_signal_connect (self->priv->store_events, "rows-reordered", G_CALLBACK (store_events_rows_reordered), self); + g_signal_connect (self->priv->store_events, "row-has-child-toggled", + G_CALLBACK (store_events_has_child_rows), self); // debug gtk_notebook_set_show_tabs (GTK_NOTEBOOK (self->priv->notebook), TRUE); -- cgit v1.2.3