merge git work
authorXavier Claessens <xclaesse@src.gnome.org>
Sat, 29 Dec 2007 15:49:47 +0000 (15:49 +0000)
committerXavier Claessens <xclaesse@src.gnome.org>
Sat, 29 Dec 2007 15:49:47 +0000 (15:49 +0000)
svn path=/trunk/; revision=518

41 files changed:
.gitignore
Makefile.am
TODO
acinclude.m4 [new file with mode: 0644]
configure.ac
libempathy-gtk/Makefile.am
libempathy-gtk/empathy-call-window.c
libempathy-gtk/empathy-call-window.h
libempathy-gtk/empathy-chat-view.c
libempathy-gtk/empathy-contact-list-view.c
libempathy-gtk/empathy-group-chat.glade
libempathy-gtk/empathy-theme-boxes.c
libempathy-gtk/empathy-theme-boxes.h
libempathy-gtk/empathy-theme-irc.c
libempathy-gtk/empathy-theme-manager.c
libempathy-gtk/empathy-theme-utils.c [new file with mode: 0644]
libempathy-gtk/empathy-theme-utils.h [new file with mode: 0644]
libempathy-gtk/empathy-theme.c
libempathy-gtk/empathy-theme.h
libempathy-gtk/empathy-ui-utils.c
libempathy-gtk/empathy-ui-utils.h
m4/.gitignore [deleted file]
m4/acinclude.m4 [deleted file]
m4/empathy-args.m4 [deleted file]
m4/empathy-valgrind.m4 [deleted file]
po/.gitignore
po/POTFILES.in
rules/check.mak [deleted file]
src/.gitignore
src/empathy-call-chandler.c
src/empathy-chat-chandler.c
svn2cl.xsl [new file with mode: 0644]
tests/.gitignore [deleted file]
tests/Makefile.am
tests/check-empathy-utils.c [deleted file]
tests/check-helpers.c [deleted file]
tests/check-helpers.h [deleted file]
tests/check-libempathy.h [deleted file]
tests/check-main.c [deleted file]
tests/dlopen.supp [deleted file]
tests/valgrind.supp [deleted file]

index 1fdf7e7..2678342 100644 (file)
@@ -5,14 +5,13 @@ Makefile.in
 Makefile
 .deps
 .libs
-*.sw[po]
+*.swp
 *enum-types*
 *.pc
 *.tar.*
 *.orig
 *.rej
 *.bak
-*~
 
 ChangeLog
 stamp-h1
@@ -24,7 +23,6 @@ config.h
 config.h.in
 config.log
 config.status
-config.status.lineno
 config.sub
 configure
 depcomp
@@ -37,4 +35,3 @@ ltmain.sh
 missing
 mkinstalldirs
 omf.make
-compile
index 2d20766..4256f0f 100644 (file)
@@ -33,7 +33,6 @@ EXTRA_DIST =                  \
        $(INTLTOOL)
 
 DISTCLEANFILES =               \
-        ChangeLog               \
        intltool-extract        \
        intltool-merge          \
        intltool-update
@@ -42,9 +41,15 @@ DISTCLEANFILES =             \
 # uninstall.
 distuninstallcheck_listfiles = find . -type f -print | grep -v '^\./var/scrollkeeper'
 
-ChangeLog: Makefile.am
-       git-log --pretty=short > ChangeLog
-       
+# Build ChangeLog from SVN history (r470 was the first ChangeLog-less checkin).
+# Only build this when in an svn checkout.
+
+ChangeLog:
+       @if test -f $(top_srcdir)/.svn/entries; then \
+               svn log -v --xml -r HEAD:470 $(SVN_ROOT)/$(SVN_MODULE) | \
+                       xsltproc --stringparam strip-prefix "$(SVN_MODULE)/$(SVN_BRANCH)" \
+                                --stringparam include-rev "yes" $(top_srcdir)/svn2cl.xsl - > $@; \
+       fi
 
 dist: ChangeLog
 
diff --git a/TODO b/TODO
index 187f619..937147b 100644 (file)
--- a/TODO
+++ b/TODO
@@ -13,6 +13,7 @@ Things you can do if you want to help:
  - Add sound events
  - Add register capability in EmpathyAccountsDialog if the profile says
    it's supported.
+ - Import gossip's new chat theme system.
  - Write a manual based on gossip's.
  - Reviewing File Transfer patch, see bug #462172.
  - Drop libtelepathy and use telepathy-glib instead when it gets client-side
diff --git a/acinclude.m4 b/acinclude.m4
new file mode 100644 (file)
index 0000000..3120d86
--- /dev/null
@@ -0,0 +1,65 @@
+dnl Turn on the additional warnings last, so -Werror doesn't affect other tests.
+
+AC_DEFUN([IDT_COMPILE_WARNINGS],[
+   if test -f $srcdir/autogen.sh; then
+       default_compile_warnings="error"
+    else
+       default_compile_warnings="no"
+    fi
+
+    AC_ARG_WITH(compile-warnings,
+                AS_HELP_STRING([--with-compile-warnings=@<:@no/yes/error@:>@],
+                               [Compiler warnings]),
+                [enable_compile_warnings="$withval"],
+                [enable_compile_warnings="$default_compile_warnings"])
+
+    warnCFLAGS=
+    if test "x$GCC" != xyes; then
+       enable_compile_warnings=no
+    fi
+
+    warning_flags=
+    realsave_CFLAGS="$CFLAGS"
+
+    case "$enable_compile_warnings" in
+    no)
+       warning_flags=
+       ;;
+    yes)
+       warning_flags="-Wall -Wunused -Wmissing-prototypes -Wmissing-declarations"
+       ;;
+    maximum|error)
+       warning_flags="-Wall -Wunused -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith"
+       CFLAGS="$warning_flags $CFLAGS"
+       for option in -Wno-sign-compare -Wno-pointer-sign; do
+               SAVE_CFLAGS="$CFLAGS"
+               CFLAGS="$CFLAGS $option"
+               AC_MSG_CHECKING([whether gcc understands $option])
+               AC_TRY_COMPILE([], [],
+                       has_option=yes,
+                       has_option=no,)
+               CFLAGS="$SAVE_CFLAGS"
+               AC_MSG_RESULT($has_option)
+               if test $has_option = yes; then
+                 warning_flags="$warning_flags $option"
+               fi
+               unset has_option
+               unset SAVE_CFLAGS
+       done
+       unset option
+       if test "$enable_compile_warnings" = "error" ; then
+           warning_flags="$warning_flags -Werror"
+       fi
+       ;;
+    *)
+       AC_MSG_ERROR(Unknown argument '$enable_compile_warnings' to --enable-compile-warnings)
+       ;;
+    esac
+    CFLAGS="$realsave_CFLAGS"
+    AC_MSG_CHECKING(what warning flags to pass to the C compiler)
+    AC_MSG_RESULT($warning_flags)
+
+    WARN_CFLAGS="$warning_flags"
+    AC_SUBST(WARN_CFLAGS)
+])
+
index 76a34cd..6633066 100644 (file)
@@ -5,6 +5,17 @@ AC_COPYRIGHT([
   Copyright (C) 2007 Collabora Ltd.
 ])
 
+AC_CONFIG_AUX_DIR(.)
+
+AM_CONFIG_HEADER(config.h)
+AM_INIT_AUTOMAKE(1.9 dist-bzip2 no-define)
+
+AM_MAINTAINER_MODE
+
+AC_ISC_POSIX
+AC_PROG_CC
+AC_HEADER_STDC
+
 # LT Version numbers, remember to change them just *before* a release.
 #   (Interfaces removed:    CURRENT++, AGE=0, REVISION=0)
 #   (Interfaces added:      CURRENT++, AGE++, REVISION=0)
@@ -24,7 +35,18 @@ AC_SUBST(LIBEMPATHY_GTK_CURRENT)
 AC_SUBST(LIBEMPATHY_GTK_AGE)
 AC_SUBST(LIBEMPATHY_GTK_REVISION)
 
-# Minimal version required
+AM_PROG_LIBTOOL
+AM_PATH_GLIB_2_0
+AC_PATH_XTRA
+
+AC_PATH_PROG(DBUS_BINDING_TOOL, dbus-binding-tool)
+AC_PATH_PROG(GCONFTOOL, gconftool-2)
+AM_GCONF_SOURCE_2
+
+IT_PROG_INTLTOOL([0.35.0])
+
+GTK_DOC_CHECK([1.3])
+
 GLIB_REQUIRED=2.14.0
 GTK_REQUIRED=2.12.0
 GCONF_REQUIRED=1.2.0
@@ -34,34 +56,37 @@ TELEPATHY_REQUIRED=0.3.1
 TELEPATHY_GLIB_REQUIRED=0.7.0
 MISSION_CONTROL_REQUIRED=4.37
 
-# Uncomment that to build without deprecated symbols
-# AC_DEFINE(GTK_DISABLE_DEPRECATED, 1, [Disable deprecated GTK symbols])
-# AC_DEFINE(G_DISABLE_DEPRECATED, 1, [Disable deprecated GLib symbols])
-# AC_DEFINE(LIBTELEPATHY_DISABLE_DEPRECATED, 1, [Disable deprecated libtelepathy symbols])
-
-AC_CONFIG_MACRO_DIR([m4])
-AC_CONFIG_AUX_DIR(.)
-AM_CONFIG_HEADER(config.h)
-AM_INIT_AUTOMAKE(1.9 dist-bzip2 no-define)
-AM_MAINTAINER_MODE
-AC_ISC_POSIX
-AC_PROG_CC
-AC_HEADER_STDC
-AM_PROG_LIBTOOL
-AM_PATH_GLIB_2_0
-AC_PATH_XTRA
-IT_PROG_INTLTOOL([0.35.0])
-GTK_DOC_CHECK([1.3])
 IDT_COMPILE_WARNINGS
-AC_PATH_PROG(DBUS_BINDING_TOOL, dbus-binding-tool)
-AC_PATH_PROG(GCONFTOOL, gconftool-2)
-AM_GCONF_SOURCE_2
+
+dnl Uncomment that to build without deprecated symbols
+dnl AC_DEFINE(GTK_DISABLE_DEPRECATED, 1, [Disable deprecated GTK symbols])
+dnl AC_DEFINE(G_DISABLE_DEPRECATED, 1, [Disable deprecated GLib symbols])
+dnl AC_DEFINE(LIBTELEPATHY_DISABLE_DEPRECATED, 1, [Disable deprecated libtelepathy symbols])
+
 GLIB_GENMARSHAL=`$PKG_CONFIG glib-2.0 --variable=glib_genmarshal`
 AC_SUBST(GLIB_GENMARSHAL)
 
-# -----------------------------------------------------------
-# Pkg-Config dependency checks
-# -----------------------------------------------------------
+dnl -----------------------------------------------------------
+dnl SVN for ChangeLog generation
+dnl -----------------------------------------------------------
+
+AC_SUBST([SVN_ROOT],[http://svn.gnome.org/svn])
+AC_SUBST([SVN_MODULE],[empathy])
+AC_SUBST([SVN_BRANCH],["trunk"])
+
+dnl -----------------------------------------------------------
+dnl Language Support
+dnl -----------------------------------------------------------
+
+GETTEXT_PACKAGE=empathy
+AC_SUBST(GETTEXT_PACKAGE)
+AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[Gettext package name])
+
+AM_GLIB_GNU_GETTEXT
+
+dnl -----------------------------------------------------------
+dnl Pkg-Config dependency checks
+dnl -----------------------------------------------------------
 
 PKG_CHECK_MODULES(LIBEMPATHY,
 [
@@ -90,19 +115,9 @@ PKG_CHECK_MODULES(EMPATHY,
    libebook-1.2
 ])
 
-# -----------------------------------------------------------
-# Language Support
-# -----------------------------------------------------------
-
-GETTEXT_PACKAGE=empathy
-AC_SUBST(GETTEXT_PACKAGE)
-AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[Gettext package name])
-
-AM_GLIB_GNU_GETTEXT
-
-# -----------------------------------------------------------
-# ISO codes, used for aspell support
-# -----------------------------------------------------------
+dnl -----------------------------------------------------------
+dnl ISO codes, used for aspell support
+dnl -----------------------------------------------------------
 AC_MSG_CHECKING([whether iso-codes exists and has iso-639 domain])
 if $PKG_CONFIG --variable=domains iso-codes | grep -q 639 ; then
    AC_MSG_RESULT([yes])
@@ -118,9 +133,9 @@ fi
 
 AC_DEFINE_UNQUOTED([ISO_CODES_PREFIX],["$iso_codes_prefix"],[ISO codes prefix])
 
-# -----------------------------------------------------------
-# ASpell
-# -----------------------------------------------------------
+dnl -----------------------------------------------------------
+dnl ASpell
+dnl -----------------------------------------------------------
 AC_ARG_ENABLE(aspell,
               AS_HELP_STRING([--enable-aspell=@<:@no/yes/auto@:>@],
                              [compile with aspell support]), ,
@@ -148,9 +163,9 @@ if test "x$enable_aspell" = "xyes" -a "x$have_aspell" != "xyes"; then
 fi
 
 
-# -----------------------------------------------------------
-# Megaphone
-# -----------------------------------------------------------
+dnl -----------------------------------------------------------
+dnl Megaphone
+dnl -----------------------------------------------------------
 AC_ARG_ENABLE(megaphone,
               AS_HELP_STRING([--enable-megaphone=@<:@no/yes/auto@:>@],
                              [build megaphone applet]), ,
@@ -178,9 +193,9 @@ fi
 
 AM_CONDITIONAL(HAVE_MEGAPHONE, test "x$have_megaphone" = "xyes")
 
-# -----------------------------------------------------------
-# Nothere
-# -----------------------------------------------------------
+dnl -----------------------------------------------------------
+dnl Nothere
+dnl -----------------------------------------------------------
 AC_ARG_ENABLE(nothere,
               AS_HELP_STRING([--enable-nothere=@<:@no/yes/auto@:>@],
                              [build nothere applet]), ,
@@ -207,32 +222,19 @@ fi
 
 AM_CONDITIONAL(HAVE_NOTHERE, test "x$have_nothere" = "xyes")
 
-# -----------------------------------------------------------
-# Tests
-# -----------------------------------------------------------
+dnl -----------------------------------------------------------
+dnl Tests
+dnl -----------------------------------------------------------
 AC_ARG_ENABLE(tests,
-              AS_HELP_STRING([--enable-tests=@<:@no/yes/auto@:>@],
+              AS_HELP_STRING([--enable-tests=@<:@no/yes@:>@],
                              [build tests]), ,
                              enable_tests=no)
 
-if test "x$enable_tests" != "xno"; then
-   PKG_CHECK_MODULES(CHECK,
-   [
-      check >= 0.9.4
-   ], have_check="yes", have_check="no")
-else
-   have_check=no
-fi
-
-if test "x$enable_tests" = "xyes" -a "x$have_check" != "xyes"; then
-   AC_MSG_ERROR([Couldn't find check dependencies.])
-fi
-
-AM_CONDITIONAL(HAVE_TESTS, test "x$have_check" = "xyes")
+AM_CONDITIONAL(HAVE_TESTS, test "x$enable_tests" = "xyes")
 
-# -----------------------------------------------------------
-# Python Bindings
-# -----------------------------------------------------------
+dnl -----------------------------------------------------------
+dnl Python Bindings
+dnl -----------------------------------------------------------
 AC_ARG_ENABLE(python,
               AS_HELP_STRING([--enable-python=@<:@no/yes/auto@:>@],
                              [build python bindings to libempathy and libempathy-gtk]), ,
@@ -267,9 +269,9 @@ fi
 
 AM_CONDITIONAL(HAVE_PYTHON, test "x$have_python" = "xyes")
 
-# -----------------------------------------------------------
-# VoIP support
-# -----------------------------------------------------------
+dnl -----------------------------------------------------------
+dnl VoIP support
+dnl -----------------------------------------------------------
 AC_ARG_ENABLE(voip,
               AS_HELP_STRING([--enable-voip=@<:@no/yes@:>@],
                              [Add support for Voice and Video call]), ,
@@ -281,7 +283,7 @@ fi
 
 AM_CONDITIONAL(HAVE_VOIP, test "x$enable_voip" = "xyes")
 
-# -----------------------------------------------------------
+dnl -----------------------------------------------------------
 
 AC_OUTPUT([
    Makefile
index 07336f5..494e3c4 100644 (file)
@@ -32,10 +32,11 @@ libempathy_gtk_la_SOURCES =                 \
        empathy-contact-list-store.c            \
        empathy-contact-list-view.c             \
        empathy-preferences.c                   \
-       empathy-theme.c                         \
+       empathy-theme.c                                 \
        empathy-theme-boxes.c                   \
-       empathy-theme-irc.c                     \
+       empathy-theme-irc.c                             \
        empathy-theme-manager.c                 \
+       empathy-theme-utils.c                   \
        empathy-smiley-manager.c                \
        empathy-chat-window.c                   \
        empathy-chat.c                          \
@@ -88,10 +89,11 @@ libempathy_gtk_headers =                    \
        empathy-contact-list-store.h            \
        empathy-contact-list-view.h             \
        empathy-preferences.h                   \
-       empathy-theme.h                         \
+       empathy-theme.h                                 \
        empathy-theme-boxes.h                   \
-       empathy-theme-irc.h                     \
+       empathy-theme-irc.h                             \
        empathy-theme-manager.h                 \
+       empathy-theme-utils.h                   \
        empathy-smiley-manager.h                \
        empathy-chat-window.h                   \
        empathy-chat.h                          \
index a1c7bd7..baa1697 100644 (file)
@@ -24,7 +24,6 @@
 #include "config.h"
 
 #include <gtk/gtk.h>
-#include <glib/gi18n.h>
 
 #include <libempathy/empathy-debug.h>
 
@@ -104,20 +103,6 @@ call_window_capabilities_notify_cb (EmpathyContact    *contact,
                                         capabilities & EMPATHY_CAPABILITIES_VIDEO);
 }
 
-static void
-call_window_name_notify_cb (EmpathyContact    *contact,
-                           GParamSpec        *param,
-                           EmpathyCallWindow *window)
-{
-       const gchar *name;
-       gchar       *title;
-
-       name = empathy_contact_get_name (contact);
-       title = g_strdup_printf (_("Call from %s"), name);
-       gtk_window_set_title (GTK_WINDOW (window->window), title);
-       g_free (title);
-}
-
 static void
 call_window_status_notify_cb (EmpathyTpCall     *call,
                              GParamSpec        *param,
@@ -139,11 +124,7 @@ call_window_status_notify_cb (EmpathyTpCall     *call,
                        g_signal_connect (contact, "notify::capabilities",
                                          G_CALLBACK (call_window_capabilities_notify_cb),
                                          window);
-                       g_signal_connect (contact, "notify::name",
-                                         G_CALLBACK (call_window_name_notify_cb),
-                                         window);
                        call_window_capabilities_notify_cb (contact, NULL, window);
-                       call_window_name_notify_cb (contact, NULL, window);
                }
        }
 
@@ -161,7 +142,7 @@ call_window_destroy_cb (GtkWidget         *widget,
        g_slice_free (EmpathyCallWindow, window);
 }
 
-GtkWidget *
+void
 empathy_call_window_show (EmpathyTpCall *call)
 {
        EmpathyCallWindow *window;
@@ -213,7 +194,5 @@ empathy_call_window_show (EmpathyTpCall *call)
                          window);
 
        gtk_widget_show (window->window);
-
-       return window->window;
 }
 
index c8c6d7f..ea310d6 100644 (file)
@@ -28,7 +28,7 @@
 
 G_BEGIN_DECLS
 
-GtkWidget * empathy_call_window_show (EmpathyTpCall *call);
+void empathy_call_window_show (EmpathyTpCall *call);
 
 G_END_DECLS
 
index c7428e9..9472815 100644 (file)
@@ -68,6 +68,7 @@ struct _EmpathyChatViewPriv {
        GtkTextBuffer *buffer;
 
        EmpathyTheme   *theme;
+       gpointer       theme_context;
 
        time_t         last_timestamp;
        BlockType      last_block_type;
@@ -129,8 +130,7 @@ static void     chat_view_clear_view_cb              (GtkMenuItem              *
 static gboolean chat_view_is_scrolled_down           (EmpathyChatView           *view);
 static void     chat_view_theme_changed_cb           (EmpathyThemeManager       *manager,
                                                      EmpathyChatView           *view);
-static void     chat_view_theme_notify_cb            (EmpathyTheme              *theme,
-                                                     GParamSpec                *param,
+static void     chat_view_theme_updated_cb           (EmpathyTheme              *theme, 
                                                      EmpathyChatView           *view);
 
 G_DEFINE_TYPE (EmpathyChatView, empathy_chat_view, GTK_TYPE_TEXT_VIEW);
@@ -233,8 +233,12 @@ chat_view_finalize (GObject *object)
 
        if (priv->theme) {
                g_signal_handlers_disconnect_by_func (priv->theme,
-                                                     chat_view_theme_notify_cb,
+                                                     chat_view_theme_updated_cb,
                                                      view);
+
+               empathy_theme_detach_from_view (priv->theme, priv->theme_context,
+                                              view);
+
                g_object_unref (priv->theme);
        }
 
@@ -792,7 +796,8 @@ empathy_chat_view_append_message (EmpathyChatView *view,
        
        chat_view_maybe_trim_buffer (view);
 
-       empathy_theme_append_message (priv->theme, view, msg);
+       empathy_theme_append_message (priv->theme, priv->theme_context,
+                                     view, msg);
 
        if (bottom) {
                empathy_chat_view_scroll_down (view);
@@ -815,7 +820,9 @@ empathy_chat_view_append_event (EmpathyChatView *view,
 
        chat_view_maybe_trim_buffer (view);
 
-       empathy_theme_append_event (priv->theme, view, str);
+       empathy_theme_append_event (priv->theme, 
+                                  priv->theme_context,
+                                  view, str);
 
        if (bottom) {
                empathy_chat_view_scroll_down (view);
@@ -845,10 +852,13 @@ empathy_chat_view_append_button (EmpathyChatView *view,
 
        bottom = chat_view_is_scrolled_down (view);
 
-       empathy_theme_append_timestamp (priv->theme, view, NULL, TRUE, TRUE);
+       empathy_theme_append_timestamp (priv->theme, priv->theme_context,
+                                      view, NULL,
+                                      TRUE, TRUE);
 
        if (message) {
-               empathy_theme_append_text (priv->theme, view, message, tag, NULL);
+               empathy_theme_append_text (priv->theme, priv->theme_context,
+                                         view, message, tag, NULL);
        }
 
        gtk_text_buffer_get_end_iter (priv->buffer, &iter);
@@ -996,6 +1006,8 @@ empathy_chat_view_clear (EmpathyChatView *view)
         */
        priv = GET_PRIV (view);
 
+       empathy_theme_view_cleared (priv->theme, priv->theme_context, view);
+
        priv->last_block_type = BLOCK_TYPE_NONE;
        priv->last_timestamp = 0;
 }
@@ -1358,11 +1370,16 @@ empathy_chat_view_get_theme (EmpathyChatView *view)
 }
 
 static void
-chat_view_theme_notify_cb (EmpathyTheme    *theme,
-                          GParamSpec      *param,
-                          EmpathyChatView *view)
+chat_view_theme_updated_cb (EmpathyTheme *theme, EmpathyChatView *view)
 {
-       empathy_theme_update_view (theme, view);
+       EmpathyChatViewPriv *priv;
+
+       priv = GET_PRIV (view);
+       
+       empathy_theme_detach_from_view (priv->theme, priv->theme_context,
+                                      view);
+
+       priv->theme_context = empathy_theme_setup_with_view (theme, view);
 }
 
 void
@@ -1377,19 +1394,24 @@ empathy_chat_view_set_theme (EmpathyChatView *view, EmpathyTheme *theme)
 
        if (priv->theme) {
                g_signal_handlers_disconnect_by_func (priv->theme,
-                                                     chat_view_theme_notify_cb,
+                                                     chat_view_theme_updated_cb,
                                                      view);
+               empathy_theme_detach_from_view (priv->theme, priv->theme_context,
+                                              view);
+
                g_object_unref (priv->theme);
        }
 
        priv->theme = g_object_ref (theme);
 
-       empathy_theme_update_view (theme, view);
-       g_signal_connect (priv->theme, "notify",
-                         G_CALLBACK (chat_view_theme_notify_cb),
+       g_signal_connect (priv->theme,
+                         "updated",
+                         G_CALLBACK (chat_view_theme_updated_cb),
                          view);
 
-       /* FIXME: Redraw all messages using the new theme */
+       priv->theme_context = empathy_theme_setup_with_view (theme, view);
+
+       /* FIXME: Possibly redraw the function and make it a property */
 }
 
 void
index 9b6a98a..73afd29 100644 (file)
@@ -1034,21 +1034,27 @@ contact_list_view_cell_set_background (EmpathyContactListView *view,
 
        style = gtk_widget_get_style (GTK_WIDGET (view));
 
-       if (!is_group && is_active) {
-               color = style->bg[GTK_STATE_SELECTED];
-
-               /* Here we take the current theme colour and add it to
-                * the colour for white and average the two. This
-                * gives a colour which is inline with the theme but
-                * slightly whiter.
-                */
-               color.red = (color.red + (style->white).red) / 2;
-               color.green = (color.green + (style->white).green) / 2;
-               color.blue = (color.blue + (style->white).blue) / 2;
-
-               g_object_set (cell,
-                             "cell-background-gdk", &color,
-                             NULL);
+       if (!is_group) {
+               if (is_active) {
+                       color = style->bg[GTK_STATE_SELECTED];
+
+                       /* Here we take the current theme colour and add it to
+                        * the colour for white and average the two. This
+                        * gives a colour which is inline with the theme but
+                        * slightly whiter.
+                        */
+                       color.red = (color.red + (style->white).red) / 2;
+                       color.green = (color.green + (style->white).green) / 2;
+                       color.blue = (color.blue + (style->white).blue) / 2;
+
+                       g_object_set (cell,
+                                     "cell-background-gdk", &color,
+                                     NULL);
+               } else {
+                       g_object_set (cell,
+                                     "cell-background-gdk", NULL,
+                                     NULL);
+               }
        } else {
                g_object_set (cell,
                              "cell-background-gdk", NULL,
index 5b40dc3..5cb6fc3 100644 (file)
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
-<!--*- mode: xml -*-->
+<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
+<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
+
 <glade-interface>
-  <widget class="GtkWindow" id="group_chat_window">
-    <property name="border_width">6</property>
-    <property name="title" translatable="yes">Group Chat</property>
-    <property name="default_width">1000</property>
-    <property name="default_height">800</property>
-    <property name="icon_name">system-users</property>
-    <child>
-      <widget class="GtkVBox" id="group_chat_widget">
-        <property name="visible">True</property>
-        <property name="border_width">4</property>
-        <property name="spacing">6</property>
-        <child>
-          <widget class="GtkHBox" id="hbox_topic">
-            <property name="visible">True</property>
-            <property name="spacing">6</property>
-            <child>
-              <widget class="GtkLabel" id="label80">
-                <property name="visible">True</property>
-                <property name="xalign">0</property>
-                <property name="yalign">0</property>
-                <property name="label" translatable="yes">&lt;b&gt;Topic:&lt;/b&gt;</property>
-                <property name="use_markup">True</property>
-              </widget>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-              </packing>
-            </child>
-            <child>
-              <widget class="GtkLabel" id="label_topic">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="xalign">0</property>
-                <property name="use_markup">True</property>
-                <property name="wrap">True</property>
-                <property name="selectable">True</property>
-                <property name="ellipsize">PANGO_ELLIPSIZE_END</property>
-                <property name="single_line_mode">True</property>
-              </widget>
-              <packing>
-                <property name="position">1</property>
-              </packing>
-            </child>
-          </widget>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">False</property>
-            <property name="padding">2</property>
-          </packing>
-        </child>
-        <child>
-          <widget class="GtkHPaned" id="hpaned">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <child>
-              <widget class="GtkVBox" id="vbox_left">
-                <property name="width_request">600</property>
-                <property name="height_request">500</property>
-                <property name="visible">True</property>
-                <property name="spacing">6</property>
-                <child>
-                  <widget class="GtkScrolledWindow" id="scrolled_window_chat">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
-                    <property name="shadow_type">GTK_SHADOW_IN</property>
-                    <child>
-                      <placeholder/>
-                    </child>
-                  </widget>
-                </child>
-                <child>
-                  <widget class="GtkScrolledWindow" id="scrolled_window_input">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
-                    <property name="vscrollbar_policy">GTK_POLICY_NEVER</property>
-                    <property name="shadow_type">GTK_SHADOW_IN</property>
-                    <child>
-                      <placeholder/>
-                    </child>
-                  </widget>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="position">1</property>
-                  </packing>
-                </child>
-              </widget>
-              <packing>
-                <property name="resize">True</property>
-                <property name="shrink">True</property>
-              </packing>
-            </child>
-            <child>
-              <widget class="GtkScrolledWindow" id="scrolled_window_contacts">
-                <property name="width_request">200</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
-                <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
-                <property name="shadow_type">GTK_SHADOW_IN</property>
-                <child>
-                  <placeholder/>
-                </child>
-              </widget>
-              <packing>
-                <property name="resize">True</property>
-                <property name="shrink">True</property>
-              </packing>
-            </child>
-          </widget>
-          <packing>
-            <property name="position">1</property>
-          </packing>
-        </child>
-      </widget>
-    </child>
-  </widget>
+
+<widget class="GtkWindow" id="group_chat_window">
+  <property name="border_width">6</property>
+  <property name="title" translatable="yes">Group Chat</property>
+  <property name="type">GTK_WINDOW_TOPLEVEL</property>
+  <property name="window_position">GTK_WIN_POS_NONE</property>
+  <property name="modal">False</property>
+  <property name="default_width">600</property>
+  <property name="default_height">400</property>
+  <property name="resizable">True</property>
+  <property name="destroy_with_parent">False</property>
+  <property name="icon_name">system-users</property>
+  <property name="decorated">True</property>
+  <property name="skip_taskbar_hint">False</property>
+  <property name="skip_pager_hint">False</property>
+  <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
+  <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+  <property name="focus_on_map">True</property>
+  <property name="urgency_hint">False</property>
+
+  <child>
+    <widget class="GtkVBox" id="group_chat_widget">
+      <property name="border_width">4</property>
+      <property name="visible">True</property>
+      <property name="homogeneous">False</property>
+      <property name="spacing">6</property>
+
+      <child>
+       <widget class="GtkHBox" id="hbox_topic">
+         <property name="visible">True</property>
+         <property name="homogeneous">False</property>
+         <property name="spacing">6</property>
+
+         <child>
+           <widget class="GtkLabel" id="label80">
+             <property name="visible">True</property>
+             <property name="label" translatable="yes">&lt;b&gt;Topic:&lt;/b&gt;</property>
+             <property name="use_underline">False</property>
+             <property name="use_markup">True</property>
+             <property name="justify">GTK_JUSTIFY_LEFT</property>
+             <property name="wrap">False</property>
+             <property name="selectable">False</property>
+             <property name="xalign">0</property>
+             <property name="yalign">0</property>
+             <property name="xpad">0</property>
+             <property name="ypad">0</property>
+             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+             <property name="width_chars">-1</property>
+             <property name="single_line_mode">False</property>
+             <property name="angle">0</property>
+           </widget>
+           <packing>
+             <property name="padding">0</property>
+             <property name="expand">False</property>
+             <property name="fill">False</property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkLabel" id="label_topic">
+             <property name="visible">True</property>
+             <property name="can_focus">True</property>
+             <property name="label" translatable="yes"></property>
+             <property name="use_underline">False</property>
+             <property name="use_markup">True</property>
+             <property name="justify">GTK_JUSTIFY_LEFT</property>
+             <property name="wrap">True</property>
+             <property name="selectable">True</property>
+             <property name="xalign">0</property>
+             <property name="yalign">0.5</property>
+             <property name="xpad">0</property>
+             <property name="ypad">0</property>
+             <property name="ellipsize">PANGO_ELLIPSIZE_END</property>
+             <property name="width_chars">-1</property>
+             <property name="single_line_mode">True</property>
+             <property name="angle">0</property>
+           </widget>
+           <packing>
+             <property name="padding">0</property>
+             <property name="expand">True</property>
+             <property name="fill">True</property>
+           </packing>
+         </child>
+       </widget>
+       <packing>
+         <property name="padding">2</property>
+         <property name="expand">False</property>
+         <property name="fill">False</property>
+       </packing>
+      </child>
+
+      <child>
+       <widget class="GtkHPaned" id="hpaned">
+         <property name="visible">True</property>
+         <property name="can_focus">True</property>
+
+         <child>
+           <widget class="GtkVBox" id="vbox_left">
+             <property name="visible">True</property>
+             <property name="homogeneous">False</property>
+             <property name="spacing">6</property>
+
+             <child>
+               <widget class="GtkScrolledWindow" id="scrolled_window_chat">
+                 <property name="visible">True</property>
+                 <property name="can_focus">True</property>
+                 <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+                 <property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property>
+                 <property name="shadow_type">GTK_SHADOW_IN</property>
+                 <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+                 <child>
+                   <placeholder/>
+                 </child>
+               </widget>
+               <packing>
+                 <property name="padding">0</property>
+                 <property name="expand">True</property>
+                 <property name="fill">True</property>
+               </packing>
+             </child>
+
+             <child>
+               <widget class="GtkScrolledWindow" id="scrolled_window_input">
+                 <property name="visible">True</property>
+                 <property name="can_focus">True</property>
+                 <property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
+                 <property name="vscrollbar_policy">GTK_POLICY_NEVER</property>
+                 <property name="shadow_type">GTK_SHADOW_IN</property>
+                 <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+                 <child>
+                   <placeholder/>
+                 </child>
+               </widget>
+               <packing>
+                 <property name="padding">0</property>
+                 <property name="expand">False</property>
+                 <property name="fill">True</property>
+               </packing>
+             </child>
+           </widget>
+           <packing>
+             <property name="shrink">True</property>
+             <property name="resize">True</property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkScrolledWindow" id="scrolled_window_contacts">
+             <property name="width_request">0</property>
+             <property name="visible">True</property>
+             <property name="can_focus">True</property>
+             <property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
+             <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+             <property name="shadow_type">GTK_SHADOW_IN</property>
+             <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+             <child>
+               <placeholder/>
+             </child>
+           </widget>
+           <packing>
+             <property name="shrink">False</property>
+             <property name="resize">False</property>
+           </packing>
+         </child>
+       </widget>
+       <packing>
+         <property name="padding">0</property>
+         <property name="expand">True</property>
+         <property name="fill">True</property>
+       </packing>
+      </child>
+    </widget>
+  </child>
+</widget>
+
 </glade-interface>
index 87eac87..2905f2b 100644 (file)
@@ -29,6 +29,7 @@
 
 #include "empathy-ui-utils.h"
 #include "empathy-main-window.h"
+#include "empathy-theme-utils.h"
 #include "empathy-theme-boxes.h"
 
 #define DEBUG_DOMAIN "FancyTheme"
@@ -65,20 +66,32 @@ static void     theme_boxes_set_property      (GObject            *object,
                                               GParamSpec         *pspec);
 static void     theme_boxes_define_theme_tags (EmpathyTheme        *theme,
                                               EmpathyChatView     *view);
-static void     theme_boxes_update_view       (EmpathyTheme        *theme,
+static EmpathyThemeContext *
+theme_boxes_setup_with_view                   (EmpathyTheme        *theme,
                                               EmpathyChatView     *view);
+static void     theme_boxes_detach_from_view  (EmpathyTheme        *theme,
+                                              EmpathyThemeContext *context,
+                                              EmpathyChatView     *view);
+static void     theme_boxes_view_cleared      (EmpathyTheme        *theme,
+                                              EmpathyThemeContext *context,
+                                              EmpathyChatView     *view);
+
 static void     theme_boxes_append_message    (EmpathyTheme        *theme,
+                                              EmpathyThemeContext *context,
                                               EmpathyChatView     *view,
                                               EmpathyMessage      *message);
 static void     theme_boxes_append_event      (EmpathyTheme        *theme,
+                                              EmpathyThemeContext *context,
                                               EmpathyChatView     *view,
                                               const gchar        *str);
 static void     theme_boxes_append_timestamp  (EmpathyTheme        *theme,
+                                              EmpathyThemeContext *context,
                                               EmpathyChatView     *view,
                                               EmpathyMessage      *message,
                                               gboolean            show_date,
                                               gboolean            show_time);
 static void     theme_boxes_append_spacing    (EmpathyTheme        *theme,
+                                              EmpathyThemeContext *context,
                                               EmpathyChatView     *view);
 
 enum {
@@ -116,7 +129,9 @@ empathy_theme_boxes_class_init (EmpathyThemeBoxesClass *class)
        object_class->get_property   = theme_boxes_get_property;
        object_class->set_property   = theme_boxes_set_property;
 
-       theme_class->update_view      = theme_boxes_update_view;
+       theme_class->setup_with_view  = theme_boxes_setup_with_view;
+       theme_class->detach_from_view = theme_boxes_detach_from_view;
+       theme_class->view_cleared     = theme_boxes_view_cleared;
        theme_class->append_message   = theme_boxes_append_message;
        theme_class->append_event     = theme_boxes_append_event;
        theme_class->append_timestamp = theme_boxes_append_timestamp;
@@ -295,9 +310,9 @@ theme_boxes_get_property (GObject    *object,
 }
 static void
 theme_boxes_set_property (GObject      *object,
-                         guint         param_id,
-                         const GValue *value,
-                         GParamSpec   *pspec)
+                   guint         param_id,
+                   const GValue *value,
+                   GParamSpec   *pspec)
 {
        EmpathyThemeBoxesPriv *priv;
 
@@ -307,57 +322,46 @@ theme_boxes_set_property (GObject      *object,
        case PROP_HEADER_FOREGROUND:
                g_free (priv->header_foreground);
                priv->header_foreground = g_value_dup_string (value);
-               g_object_notify (object, "header-foreground");
                break;
        case PROP_HEADER_BACKGROUND:
                g_free (priv->header_background);
                priv->header_background = g_value_dup_string (value);
-               g_object_notify (object, "header-background");
                break;
        case PROP_HEADER_LINE_BACKGROUND:
                g_free (priv->header_line_background);
                priv->header_line_background = g_value_dup_string (value);
-               g_object_notify (object, "header-line_background");
                break;
        case PROP_TEXT_FOREGROUND:
                g_free (priv->text_foreground);
                priv->text_foreground = g_value_dup_string (value);
-               g_object_notify (object, "text-foreground");
                break;
        case PROP_TEXT_BACKGROUND:
                g_free (priv->text_background);
                priv->text_background = g_value_dup_string (value);
-               g_object_notify (object, "text-background");
                break;
        case PROP_ACTION_FOREGROUND:
                g_free (priv->action_foreground);
                priv->action_foreground = g_value_dup_string (value);
-               g_object_notify (object, "action-foreground");
                break;
        case PROP_HIGHLIGHT_FOREGROUND:
                g_free (priv->highlight_foreground);
                priv->highlight_foreground = g_value_dup_string (value);
-               g_object_notify (object, "highlight-foreground");
                break;
        case PROP_TIME_FOREGROUND:
                g_free (priv->time_foreground);
                priv->time_foreground = g_value_dup_string (value);
-               g_object_notify (object, "time-foreground");
                break;
        case PROP_EVENT_FOREGROUND:
                g_free (priv->event_foreground);
                priv->event_foreground = g_value_dup_string (value);
-               g_object_notify (object, "event-foreground");
                break;
        case PROP_INVITE_FOREGROUND:
                g_free (priv->invite_foreground);
                priv->invite_foreground = g_value_dup_string (value);
-               g_object_notify (object, "invite-foreground");
                break;
        case PROP_LINK_FOREGROUND:
                g_free (priv->link_foreground);
                priv->link_foreground = g_value_dup_string (value);
-               g_object_notify (object, "link-foreground");
                break;
        default:
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
@@ -369,42 +373,53 @@ static void
 theme_boxes_define_theme_tags (EmpathyTheme *theme, EmpathyChatView *view)
 {
        EmpathyThemeBoxesPriv *priv;
-       GtkTextBuffer         *buffer;
-       GtkTextTag            *tag;
+       GtkTextBuffer   *buffer;
+       GtkTextTagTable *table;
+       GtkTextTag      *tag;
 
        priv = GET_PRIV (theme);
 
        buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
-
-       empathy_text_buffer_tag_set (buffer, "fancy-spacing",
-                                    "size", 3000,
-                                    "pixels-above-lines", 8,
-                                    NULL);
-
-       tag = empathy_text_buffer_tag_set (buffer, "fancy-header",
-                                          "weight", PANGO_WEIGHT_BOLD,
-                                          "pixels-above-lines", HEADER_PADDING,
-                                          "pixels-below-lines", HEADER_PADDING,
-                                          NULL);
+       table = gtk_text_buffer_get_tag_table (buffer);
+
+       tag = empathy_theme_utils_init_tag_by_name (table, "fancy-spacing");
+       g_object_set (tag,
+                     "size", 3000,
+                     "pixels-above-lines", 8,
+                     NULL);
+       empathy_theme_utils_add_tag (table, tag);
+
+       tag = empathy_theme_utils_init_tag_by_name (table, 
+                                                  "fancy-header");
+       g_object_set (tag,
+                     "weight", PANGO_WEIGHT_BOLD,
+                     "pixels-above-lines", HEADER_PADDING,
+                     "pixels-below-lines", HEADER_PADDING,
+                     NULL);
        if (priv->header_foreground) {
                g_object_set (tag,
                              "foreground", priv->header_foreground,
                              "paragraph-background", priv->header_background,
                              NULL);
        }
+       empathy_theme_utils_add_tag (table, tag);
 
-       tag = empathy_text_buffer_tag_set (buffer, "fancy-header-line",
-                                          "size", 1,
-                                          NULL);
+       tag = empathy_theme_utils_init_tag_by_name (table, "fancy-header-line");
+       g_object_set (tag,
+                     "size", 1,
+                     NULL);
        if (priv->header_line_background) {
                g_object_set (tag,
                              "paragraph-background", priv->header_line_background,
                              NULL);
        }
 
-       tag = empathy_text_buffer_tag_set (buffer, "fancy-body",
-                                          "pixels-above-lines", 4,
-                                          NULL);
+       empathy_theme_utils_add_tag (table, tag);
+
+       tag = empathy_theme_utils_init_tag_by_name (table, "fancy-body");
+       g_object_set (tag,
+                     "pixels-above-lines", 4,
+                     NULL);
        if (priv->text_background) {
                g_object_set (tag,
                              "paragraph-background", priv->text_background,
@@ -416,11 +431,13 @@ theme_boxes_define_theme_tags (EmpathyTheme *theme, EmpathyChatView *view)
                              "foreground", priv->text_foreground,
                              NULL);
        }
+       empathy_theme_utils_add_tag (table, tag);
 
-       tag = empathy_text_buffer_tag_set (buffer, "fancy-action",
-                                          "style", PANGO_STYLE_ITALIC,
-                                          "pixels-above-lines", 4,
-                                          NULL);
+       tag = empathy_theme_utils_init_tag_by_name (table, "fancy-action");
+       g_object_set (tag,
+                     "style", PANGO_STYLE_ITALIC,
+                     "pixels-above-lines", 4,
+                     NULL);
 
        if (priv->text_background) {
                g_object_set (tag,
@@ -432,12 +449,16 @@ theme_boxes_define_theme_tags (EmpathyTheme *theme, EmpathyChatView *view)
                g_object_set (tag,
                              "foreground", priv->action_foreground,
                              NULL);
-       }
+       } 
+
+       empathy_theme_utils_add_tag (table, tag);
 
-       tag = empathy_text_buffer_tag_set (buffer, "fancy-highlight",
-                                          "weight", PANGO_WEIGHT_BOLD,
-                                          "pixels-above-lines", 4,
-                                          NULL);
+       tag = empathy_theme_utils_init_tag_by_name (table,
+                                                  "fancy-highlight");
+       g_object_set (tag,
+                     "weight", PANGO_WEIGHT_BOLD,
+                     "pixels-above-lines", 4,
+                     NULL);
        if (priv->text_background) {
                g_object_set (tag,
                              "paragraph-background", priv->text_background,
@@ -450,55 +471,106 @@ theme_boxes_define_theme_tags (EmpathyTheme *theme, EmpathyChatView *view)
                              "foreground", priv->highlight_foreground,
                              NULL);
        }
+       empathy_theme_utils_add_tag (table, tag);
 
-       tag = empathy_text_buffer_tag_set (buffer, "fancy-time",
-                                          "justification", GTK_JUSTIFY_CENTER,
-                                          NULL);
+       tag = empathy_theme_utils_init_tag_by_name (table, "fancy-time");
+       g_object_set (tag,
+                     "justification", GTK_JUSTIFY_CENTER,
+                     NULL);
        if (priv->time_foreground) {
                g_object_set (tag,
                              "foreground", priv->time_foreground,
                              NULL);
        }
+       empathy_theme_utils_add_tag (table, tag);
 
-       tag = empathy_text_buffer_tag_set (buffer, "fancy-event",
-                                          "justification", GTK_JUSTIFY_LEFT,
-                                          NULL);
+       tag = empathy_theme_utils_init_tag_by_name (table, "fancy-event");
+       g_object_set (tag,
+                     "justification", GTK_JUSTIFY_LEFT,
+                     NULL);
        if (priv->event_foreground) {
                g_object_set (tag,
                              "foreground", priv->event_foreground,
                              NULL);
        }
+       empathy_theme_utils_add_tag (table, tag);
 
-       tag = empathy_text_buffer_tag_set (buffer, "invite", NULL);
+       tag = empathy_theme_utils_init_tag_by_name (table, "invite");
        if (priv->invite_foreground) {
                g_object_set (tag,
                              "foreground", priv->invite_foreground,
                              NULL);
        }
+       empathy_theme_utils_add_tag (table, tag);
 
-       tag = empathy_text_buffer_tag_set (buffer, "fancy-link",
-                                          "underline", PANGO_UNDERLINE_SINGLE,
-                                          NULL);
+       tag = empathy_theme_utils_init_tag_by_name (table, "fancy-link");
+       g_object_set (tag,
+                     "underline", PANGO_UNDERLINE_SINGLE,
+                     NULL);
        if (priv->link_foreground) {
                g_object_set (tag,
                              "foreground", priv->link_foreground,
                              NULL);
        } 
+       empathy_theme_utils_add_tag (table, tag);
 }
 
 static void
-theme_boxes_update_view (EmpathyTheme *theme, EmpathyChatView *view)
+theme_boxes_fixup_tag_table (EmpathyTheme *theme, EmpathyChatView *view)
+{
+       GtkTextBuffer *buffer;
+
+       buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
+
+       /* "Fancy" style tags. */
+       empathy_theme_utils_ensure_tag_by_name (buffer, "fancy-header");
+       empathy_theme_utils_ensure_tag_by_name (buffer, "fancy-header-line");
+       empathy_theme_utils_ensure_tag_by_name (buffer, "fancy-body");
+       empathy_theme_utils_ensure_tag_by_name (buffer, "fancy-action");
+       empathy_theme_utils_ensure_tag_by_name (buffer, "fancy-highlight");
+       empathy_theme_utils_ensure_tag_by_name (buffer, "fancy-spacing");
+       empathy_theme_utils_ensure_tag_by_name (buffer, "fancy-time");
+       empathy_theme_utils_ensure_tag_by_name (buffer, "fancy-event");
+       empathy_theme_utils_ensure_tag_by_name (buffer, "fancy-link");
+}
+
+typedef struct {
+       BlockType last_block_type;
+       time_t    last_timestamp;
+} FancyContext;
+
+static EmpathyThemeContext *
+theme_boxes_setup_with_view (EmpathyTheme *theme, EmpathyChatView *view)
 {
        EmpathyThemeBoxesPriv *priv;
 
-       g_return_if_fail (EMPATHY_IS_THEME_BOXES (theme));
-       g_return_if_fail (EMPATHY_IS_CHAT_VIEW (view));
+       g_return_val_if_fail (EMPATHY_IS_THEME_BOXES (theme), NULL);
 
        priv = GET_PRIV (theme);
 
+       theme_boxes_fixup_tag_table (theme, view);
+
        theme_boxes_define_theme_tags (theme, view);
        
        empathy_chat_view_set_margin (view, MARGIN);
+
+       return NULL;
+}
+
+static void
+theme_boxes_detach_from_view (EmpathyTheme        *theme,
+                             EmpathyThemeContext *context,
+                             EmpathyChatView     *view)
+{
+       /* FIXME: Free the context */
+}
+
+static void 
+theme_boxes_view_cleared (EmpathyTheme        *theme,
+                         EmpathyThemeContext *context,
+                         EmpathyChatView     *view)
+{
+       /* FIXME: clear the context data */
 }
 
 static void
@@ -523,6 +595,7 @@ table_size_allocate_cb (GtkWidget     *view,
 
 static void
 theme_boxes_maybe_append_header (EmpathyTheme        *theme,
+                                EmpathyThemeContext *context,
                                 EmpathyChatView     *view,
                                 EmpathyMessage      *msg)
 {
@@ -581,7 +654,7 @@ theme_boxes_maybe_append_header (EmpathyTheme        *theme,
                return;
        }
 
-       empathy_theme_append_spacing (theme, view);
+       empathy_theme_append_spacing (theme, context, view);
 
        gtk_text_buffer_get_end_iter (buffer, &iter);
        gtk_text_buffer_insert_with_tags_by_name (buffer,
@@ -620,8 +693,7 @@ theme_boxes_maybe_append_header (EmpathyTheme        *theme,
                               "xalign", 0.0,
                               NULL);
 
-       parse_success = priv->header_foreground &&
-                       gdk_color_parse (priv->header_foreground, &color);
+       parse_success = gdk_color_parse (priv->header_foreground, &color);
 
        if (parse_success) {
                gtk_widget_modify_fg (label1, GTK_STATE_NORMAL, &color);
@@ -685,13 +757,14 @@ theme_boxes_maybe_append_header (EmpathyTheme        *theme,
 
 static void
 theme_boxes_append_message (EmpathyTheme        *theme,
+                           EmpathyThemeContext *context,
                            EmpathyChatView     *view,
                            EmpathyMessage      *message)
 {
        EmpathyContact *sender;
 
-       empathy_theme_maybe_append_date_and_time (theme, view, message);
-       theme_boxes_maybe_append_header (theme, view, message);
+       empathy_theme_maybe_append_date_and_time (theme, context, view, message);
+       theme_boxes_maybe_append_header (theme, context, view, message);
 
        sender = empathy_message_get_sender (message);
 
@@ -701,10 +774,10 @@ theme_boxes_append_message (EmpathyTheme        *theme,
                body = g_strdup_printf (" * %s %s", 
                                        empathy_contact_get_name (sender),
                                        empathy_message_get_body (message));
-               empathy_theme_append_text (theme, view, body,
+               empathy_theme_append_text (theme, context, view, body,
                                           "fancy-action", "fancy-link");
        } else {
-               empathy_theme_append_text (theme, view,
+               empathy_theme_append_text (theme, context, view,
                                           empathy_message_get_body (message),
                                           "fancy-body", "fancy-link");
        }
@@ -720,6 +793,7 @@ theme_boxes_append_message (EmpathyTheme        *theme,
 
 static void
 theme_boxes_append_event (EmpathyTheme        *theme,
+                         EmpathyThemeContext *context,
                          EmpathyChatView     *view,
                          const gchar        *str)
 {
@@ -729,7 +803,7 @@ theme_boxes_append_event (EmpathyTheme        *theme,
 
        buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
 
-       empathy_theme_maybe_append_date_and_time (theme, view, NULL);
+       empathy_theme_maybe_append_date_and_time (theme, context, view, NULL);
 
        gtk_text_buffer_get_end_iter (buffer, &iter);
 
@@ -746,6 +820,7 @@ theme_boxes_append_event (EmpathyTheme        *theme,
 
 static void
 theme_boxes_append_timestamp (EmpathyTheme        *theme,
+                             EmpathyThemeContext *context,
                              EmpathyChatView     *view,
                              EmpathyMessage      *message,
                              gboolean            show_date,
@@ -768,7 +843,9 @@ theme_boxes_append_timestamp (EmpathyTheme        *theme,
        str = g_string_new (NULL);
 
        if (show_time || show_date) {
-               empathy_theme_append_spacing (theme, view);
+               empathy_theme_append_spacing (theme, 
+                                            context,
+                                            view);
 
                g_string_append (str, "- ");
        }
@@ -814,6 +891,7 @@ theme_boxes_append_timestamp (EmpathyTheme        *theme,
 
 static void
 theme_boxes_append_spacing (EmpathyTheme        *theme,
+                           EmpathyThemeContext *context,
                            EmpathyChatView     *view)
 {
        GtkTextBuffer *buffer;
@@ -834,3 +912,125 @@ theme_boxes_append_spacing (EmpathyTheme        *theme,
                                                  NULL);
 }
 
+static void
+theme_boxes_setup_clean (EmpathyTheme *theme)
+{
+       g_object_set (theme,
+                     "header-foreground", "black",
+                     "header-background", "#efefdf",
+                     "header_line_background", "#e3e3d3",
+                     "action_foreground", "brown4",
+                     "time_foreground", "darkgrey",
+                     "event_foreground", "darkgrey",
+                     "invite_foreground", "sienna",
+                     "link_foreground","#49789e",
+                     NULL);
+}
+
+static void
+theme_boxes_gdk_color_to_hex (GdkColor *gdk_color, gchar *str_color)
+{
+       g_snprintf (str_color, 10, 
+                   "#%02x%02x%02x", 
+                   gdk_color->red >> 8, 
+                   gdk_color->green >> 8, 
+                   gdk_color->blue >> 8);
+}
+
+static void
+theme_boxes_setup_themed (EmpathyTheme *theme)
+{
+       EmpathyThemeBoxesPriv *priv;
+       GtkWidget            *widget;
+       GtkStyle             *style;
+       gchar                 color[10];
+
+       priv = GET_PRIV (theme);
+
+       widget = gtk_entry_new ();
+       style = gtk_widget_get_style (widget);
+       gtk_widget_destroy (widget);
+
+       theme_boxes_gdk_color_to_hex (&style->base[GTK_STATE_SELECTED], color);
+
+       g_object_set (theme,
+                     "action-foreground", color,
+                     "link-foreground", color,
+                     NULL);
+
+       theme_boxes_gdk_color_to_hex (&style->bg[GTK_STATE_SELECTED], color);
+
+       g_object_set (theme,
+                     "header-background", color,
+                     NULL);
+
+       theme_boxes_gdk_color_to_hex (&style->dark[GTK_STATE_SELECTED], color);
+
+       g_object_set (theme,
+                     "header_line-background", color,
+                     NULL);
+
+       theme_boxes_gdk_color_to_hex (&style->fg[GTK_STATE_SELECTED], color);
+
+       g_object_set (theme,
+                     "header-foreground", color,
+                     NULL);
+}
+
+static void
+theme_boxes_theme_changed_cb (GtkWidget *widget,
+                             GtkStyle  *previous_style,
+                             gpointer   user_data)
+{
+       theme_boxes_setup_themed (EMPATHY_THEME (user_data));
+
+       g_signal_emit_by_name (G_OBJECT (user_data), "updated");
+}
+
+static void
+theme_boxes_setup_blue (EmpathyTheme *theme)
+{
+       g_object_set (theme,
+                     "header_foreground", "black",
+                     "header_background", "#88a2b4",
+                     "header_line_background", "#7f96a4",
+                     "text_foreground", "black",
+                     "text_background", "#adbdc8",
+                     "highlight_foreground", "black",
+                     "action_foreground", "brown4",
+                     "time_foreground", "darkgrey",
+                     "event_foreground", "#7f96a4",
+                     "invite_foreground", "sienna",
+                     "link_foreground", "#49789e",
+                     NULL);
+}
+
+EmpathyTheme *
+empathy_theme_boxes_new (const gchar *name)
+{
+       EmpathyTheme          *theme;
+       EmpathyThemeBoxesPriv *priv;
+
+       theme = g_object_new (EMPATHY_TYPE_THEME_BOXES, NULL);
+       priv  = GET_PRIV (theme);
+
+       if (strcmp (name, "clean") == 0) {
+               theme_boxes_setup_clean (theme);
+       }
+       else if (strcmp (name, "simple") == 0) {
+               /* FIXME: Make an actual accessor function */
+               g_signal_connect (empathy_main_window_show (),
+                                 "style-set",
+                                 G_CALLBACK (theme_boxes_theme_changed_cb),
+                                 theme);
+
+               theme_boxes_setup_themed (theme);
+       }
+       else if (strcmp (name, "blue") == 0) {
+               theme_boxes_setup_blue (theme);
+       }
+
+       return theme;
+}
+
+
index b1f0033..a542836 100644 (file)
@@ -45,7 +45,9 @@ struct _EmpathyThemeBoxesClass {
        EmpathyThemeClass parent_class;
 };
 
-GType empathy_theme_boxes_get_type (void) G_GNUC_CONST;
+GType         empathy_theme_boxes_get_type      (void) G_GNUC_CONST;
+
+EmpathyTheme * empathy_theme_boxes_new           (const gchar *name);
 
 G_END_DECLS
 
index 7cd9588..afe71e5 100644 (file)
@@ -24,7 +24,7 @@
 #include <libempathy/empathy-debug.h>
 
 #include "empathy-chat.h"
-#include "empathy-ui-utils.h"
+#include "empathy-theme-utils.h"
 #include "empathy-theme-irc.h"
 
 #define DEBUG_DOMAIN "Theme"
@@ -37,21 +37,37 @@ struct _EmpathyThemeIrcPriv {
        gint my_prop;
 };
 
-static void         theme_irc_finalize         (GObject             *object);
-static void         theme_irc_update_view      (EmpathyTheme         *theme,
+static void         theme_irc_finalize      (GObject             *object);
+static void         theme_irc_get_property  (GObject             *object,
+                                            guint                param_id,
+                                            GValue              *value,
+                                            GParamSpec          *pspec);
+static void         theme_irc_set_property  (GObject             *object,
+                                            guint                param_id,
+                                            const GValue        *value,
+                                            GParamSpec          *pspec);
+static EmpathyThemeContext *
+theme_irc_setup_with_view                      (EmpathyTheme         *theme,
                                                EmpathyChatView      *view);
+static void         theme_irc_detach_from_view (EmpathyTheme        *theme,
+                                               EmpathyThemeContext *context,
+                                               EmpathyChatView     *view);
 static void         theme_irc_append_message   (EmpathyTheme        *theme,
+                                               EmpathyThemeContext *context,
                                                EmpathyChatView     *view,
                                                EmpathyMessage      *message);
 static void         theme_irc_append_event     (EmpathyTheme        *theme,
+                                               EmpathyThemeContext *context,
                                                EmpathyChatView     *view,
                                                const gchar        *str);
 static void         theme_irc_append_timestamp (EmpathyTheme        *theme,
+                                               EmpathyThemeContext *context,
                                                EmpathyChatView     *view,
                                                EmpathyMessage      *message,
                                                gboolean            show_date,
                                                gboolean            show_time);
 static void         theme_irc_append_spacing   (EmpathyTheme        *theme,
+                                               EmpathyThemeContext *context,
                                                EmpathyChatView     *view);
 
 
@@ -72,13 +88,25 @@ empathy_theme_irc_class_init (EmpathyThemeIrcClass *class)
        theme_class  = EMPATHY_THEME_CLASS (class);
 
        object_class->finalize     = theme_irc_finalize;
+       object_class->get_property = theme_irc_get_property;
+       object_class->set_property = theme_irc_set_property;
 
-       theme_class->update_view      = theme_irc_update_view;
+       theme_class->setup_with_view  = theme_irc_setup_with_view;
+       theme_class->detach_from_view = theme_irc_detach_from_view;
        theme_class->append_message   = theme_irc_append_message;
        theme_class->append_event     = theme_irc_append_event;
        theme_class->append_timestamp = theme_irc_append_timestamp;
        theme_class->append_spacing   = theme_irc_append_spacing;
 
+       g_object_class_install_property (object_class,
+                                        PROP_MY_PROP,
+                                        g_param_spec_int ("my-prop",
+                                                          "",
+                                                          "",
+                                                          0, 1,
+                                                          1,
+                                                          G_PARAM_READWRITE));
+
        g_type_class_add_private (object_class, sizeof (EmpathyThemeIrcPriv));
 }
 
@@ -100,83 +128,184 @@ theme_irc_finalize (GObject *object)
        (G_OBJECT_CLASS (empathy_theme_irc_parent_class)->finalize) (object);
 }
 
+static void
+theme_irc_get_property (GObject    *object,
+                   guint       param_id,
+                   GValue     *value,
+                   GParamSpec *pspec)
+{
+       EmpathyThemeIrcPriv *priv;
+
+       priv = GET_PRIV (object);
+
+       switch (param_id) {
+       case PROP_MY_PROP:
+               g_value_set_int (value, priv->my_prop);
+               break;
+       default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+               break;
+       }
+}
+static void
+theme_irc_set_property (GObject      *object,
+                   guint         param_id,
+                   const GValue *value,
+                   GParamSpec   *pspec)
+{
+       EmpathyThemeIrcPriv *priv;
+
+       priv = GET_PRIV (object);
+
+       switch (param_id) {
+       case PROP_MY_PROP:
+               priv->my_prop = g_value_get_int (value);
+               break;
+       default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+               break;
+       }
+}
+
+static void
+theme_irc_fixup_tag_table (EmpathyTheme *theme, EmpathyChatView *view)
+{
+       GtkTextBuffer *buffer;
+
+       buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
+
+       /* IRC style tags. */
+       empathy_theme_utils_ensure_tag_by_name (buffer, "irc-nick-self");
+       empathy_theme_utils_ensure_tag_by_name (buffer, "irc-body-self");
+       empathy_theme_utils_ensure_tag_by_name (buffer, "irc-action-self");
+
+       empathy_theme_utils_ensure_tag_by_name (buffer, "irc-nick-other");
+       empathy_theme_utils_ensure_tag_by_name (buffer, "irc-body-other");
+       empathy_theme_utils_ensure_tag_by_name (buffer, "irc-action-other");
+
+       empathy_theme_utils_ensure_tag_by_name (buffer, "irc-nick-highlight");
+       empathy_theme_utils_ensure_tag_by_name (buffer, "irc-spacing");
+       empathy_theme_utils_ensure_tag_by_name (buffer, "irc-time");
+       empathy_theme_utils_ensure_tag_by_name (buffer, "irc-event");
+       empathy_theme_utils_ensure_tag_by_name (buffer, "irc-link");
+}
+
 static void
 theme_irc_apply_theme_classic (EmpathyTheme *theme, EmpathyChatView *view)
 {
        EmpathyThemeIrcPriv *priv;
-       GtkTextBuffer       *buffer;
+       GtkTextBuffer      *buffer;
+       GtkTextTagTable    *table;
+       GtkTextTag         *tag;
 
        priv = GET_PRIV (theme);
 
        buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
-
-       empathy_text_buffer_tag_set (buffer, "irc-spacing",
-                                    "size", 2000,
-                                    NULL);
-
-       empathy_text_buffer_tag_set (buffer, "irc-nick-self",
-                                    "foreground", "sea green",
-                                    NULL);
-
-       empathy_text_buffer_tag_set (buffer, "irc-body-self",
-                                    /* To get the default theme color: */
-                                    "foreground-set", FALSE,
-                                    NULL);
-
-       empathy_text_buffer_tag_set (buffer, "irc-action-self",
-                                    "foreground", "brown4",
-                                    "style", PANGO_STYLE_ITALIC,
-                                    NULL);
-
-       empathy_text_buffer_tag_set (buffer, "irc-nick-highlight",
-                                    "foreground", "indian red",
-                                    "weight", PANGO_WEIGHT_BOLD,
-                                    NULL);
-
-       empathy_text_buffer_tag_set (buffer, "irc-nick-other",
-                                    "foreground", "skyblue4",
-                                    NULL);
-
-       empathy_text_buffer_tag_set (buffer, "irc-body-other",
-                                    /* To get the default theme color: */
-                                    "foreground-set", FALSE,
-                                    NULL);
-
-       empathy_text_buffer_tag_set (buffer, "irc-action-other",
-                                    "foreground", "brown4",
-                                    "style", PANGO_STYLE_ITALIC,
-                                    NULL);
-
-       empathy_text_buffer_tag_set (buffer, "irc-time",
-                                    "foreground", "darkgrey",
-                                    "justification", GTK_JUSTIFY_CENTER,
-                                    NULL);
-
-       empathy_text_buffer_tag_set (buffer, "irc-event",
-                                    "foreground", "PeachPuff4",
-                                    "justification", GTK_JUSTIFY_LEFT,
-                                    NULL);
-
-       empathy_text_buffer_tag_set (buffer, "invite",
-                                    "foreground", "sienna",
-                                    NULL);
-
-       empathy_text_buffer_tag_set (buffer, "irc-link",
-                                    "foreground", "steelblue",
-                                    "underline", PANGO_UNDERLINE_SINGLE,
-                                    NULL);
+       table = gtk_text_buffer_get_tag_table (buffer);
+
+       tag = empathy_theme_utils_init_tag_by_name (table, "irc-spacing");
+       g_object_set (tag,
+                     "size", 2000,
+                     NULL);
+       empathy_theme_utils_add_tag (table, tag);
+
+       tag = empathy_theme_utils_init_tag_by_name (table, "irc-nick-self");
+       g_object_set (tag,
+                     "foreground", "sea green",
+                     NULL);
+       empathy_theme_utils_add_tag (table, tag);
+
+       tag = empathy_theme_utils_init_tag_by_name (table, "irc-body-self");
+       g_object_set (tag,
+                     /* To get the default theme color: */
+                     "foreground-set", FALSE,
+                     NULL);
+       empathy_theme_utils_add_tag (table, tag);
+
+       tag = empathy_theme_utils_init_tag_by_name (table, "irc-action-self");
+       g_object_set (tag,
+                     "foreground", "brown4",
+                     "style", PANGO_STYLE_ITALIC,
+                     NULL);
+       empathy_theme_utils_add_tag (table, tag);
+
+       tag = empathy_theme_utils_init_tag_by_name (table, "irc-nick-highlight");
+       g_object_set (tag,
+                     "foreground", "indian red",
+                     "weight", PANGO_WEIGHT_BOLD,
+                     NULL);
+       empathy_theme_utils_add_tag (table, tag);
+
+       tag = empathy_theme_utils_init_tag_by_name (table, "irc-nick-other");
+       g_object_set (tag,
+                     "foreground", "skyblue4",
+                     NULL);
+       empathy_theme_utils_add_tag (table, tag);
+
+       tag = empathy_theme_utils_init_tag_by_name (table, "irc-body-other");
+       g_object_set (tag,
+                     /* To get the default theme color: */
+                     "foreground-set", FALSE,
+                     NULL);
+       empathy_theme_utils_add_tag (table, tag);
+
+       tag = empathy_theme_utils_init_tag_by_name (table, "irc-action-other");
+       g_object_set (tag,
+                     "foreground", "brown4",
+                     "style", PANGO_STYLE_ITALIC,
+                     NULL);
+       empathy_theme_utils_add_tag (table, tag);
+
+       tag = empathy_theme_utils_init_tag_by_name (table, "irc-time");
+       g_object_set (tag,
+                     "foreground", "darkgrey",
+                     "justification", GTK_JUSTIFY_CENTER,
+                     NULL);
+       empathy_theme_utils_add_tag (table, tag);
+
+       tag = empathy_theme_utils_init_tag_by_name (table, "irc-event");
+       g_object_set (tag,
+                     "foreground", "PeachPuff4",
+                     "justification", GTK_JUSTIFY_LEFT,
+                     NULL);
+       empathy_theme_utils_add_tag (table, tag);
+
+       tag = empathy_theme_utils_init_tag_by_name (table, "invite");
+       g_object_set (tag,
+                     "foreground", "sienna",
+                     NULL);
+       empathy_theme_utils_add_tag (table, tag);
+
+       tag = empathy_theme_utils_init_tag_by_name (table, "irc-link");
+       g_object_set (tag,
+                     "foreground", "steelblue",
+                     "underline", PANGO_UNDERLINE_SINGLE,
+                     NULL);
+       empathy_theme_utils_add_tag (table, tag);
 }
 
 
-static void
-theme_irc_update_view (EmpathyTheme *theme, EmpathyChatView *view)
+static EmpathyThemeContext *
+theme_irc_setup_with_view (EmpathyTheme *theme, EmpathyChatView *view)
 {
+       theme_irc_fixup_tag_table (theme, view);
        theme_irc_apply_theme_classic (theme, view);
        empathy_chat_view_set_margin (view, 3);
+
+       return NULL;
+}
+
+static void
+theme_irc_detach_from_view (EmpathyTheme        *theme,
+                           EmpathyThemeContext *context,
+                           EmpathyChatView     *view)
+{
+       /* Free the context */
 }
 
 static void
 theme_irc_append_message (EmpathyTheme        *theme,
+                         EmpathyThemeContext *context,
                          EmpathyChatView     *view,
                          EmpathyMessage      *message)
 {
@@ -188,7 +317,7 @@ theme_irc_append_message (EmpathyTheme        *theme,
        gchar         *tmp;
        EmpathyContact *contact;
 
-       empathy_theme_maybe_append_date_and_time (theme, view, message);
+       empathy_theme_maybe_append_date_and_time (theme, context, view, message);
 
        buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
 
@@ -205,7 +334,7 @@ theme_irc_append_message (EmpathyTheme        *theme,
                tmp = g_strdup_printf (" * %s %s", 
                                       empathy_contact_get_name (contact),
                                       empathy_message_get_body (message));
-               empathy_theme_append_text (theme, view, tmp,
+               empathy_theme_append_text (theme, context, view, tmp,
                                           body_tag, "irc-link");
                g_free (tmp);
                return;
@@ -238,13 +367,14 @@ theme_irc_append_message (EmpathyTheme        *theme,
        g_free (tmp);
 
        /* The text body. */
-       empathy_theme_append_text (theme, view, 
+       empathy_theme_append_text (theme, context, view, 
                                  empathy_message_get_body (message),
                                  body_tag, "irc-link");
 }
 
 static void
 theme_irc_append_event (EmpathyTheme        *theme,
+                       EmpathyThemeContext *context,
                    EmpathyChatView     *view,
                    const gchar        *str)
 {
@@ -254,7 +384,7 @@ theme_irc_append_event (EmpathyTheme        *theme,
 
        buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
        
-       empathy_theme_maybe_append_date_and_time (theme, view, NULL);
+       empathy_theme_maybe_append_date_and_time (theme, context, view, NULL);
 
        gtk_text_buffer_get_end_iter (buffer, &iter);
 
@@ -268,6 +398,7 @@ theme_irc_append_event (EmpathyTheme        *theme,
 
 static void
 theme_irc_append_timestamp (EmpathyTheme        *theme,
+                           EmpathyThemeContext *context,
                            EmpathyChatView     *view,
                            EmpathyMessage      *message,
                            gboolean            show_date,
@@ -286,7 +417,9 @@ theme_irc_append_timestamp (EmpathyTheme        *theme,
        str = g_string_new (NULL);
 
        if (show_time || show_date) {
-               empathy_theme_append_spacing (theme, view);
+               empathy_theme_append_spacing (theme, 
+                                            context,
+                                            view);
 
                g_string_append (str, "- ");
        }
@@ -330,6 +463,7 @@ theme_irc_append_timestamp (EmpathyTheme        *theme,
 
 static void
 theme_irc_append_spacing (EmpathyTheme        *theme,
+                         EmpathyThemeContext *context,
                          EmpathyChatView     *view)
 {
        GtkTextBuffer *buffer;
index 6bece75..6feea2f 100644 (file)
@@ -50,7 +50,7 @@ typedef struct {
        EmpathyTheme *blue_theme;
        EmpathyTheme *classic_theme;
 
-       GtkSettings  *settings;
+       gboolean     irc_style;
 } EmpathyThemeManagerPriv;
 
 static void        theme_manager_finalize                 (GObject            *object);
@@ -84,114 +84,6 @@ static const gchar *themes[] = {
 
 G_DEFINE_TYPE (EmpathyThemeManager, empathy_theme_manager, G_TYPE_OBJECT);
 
-static void
-theme_manager_gdk_color_to_hex (GdkColor *gdk_color, gchar *str_color)
-{
-       g_snprintf (str_color, 10, 
-                   "#%02x%02x%02x", 
-                   gdk_color->red >> 8,
-                   gdk_color->green >> 8,
-                   gdk_color->blue >> 8);
-}
- static void
-theme_manager_color_hash_notify_cb (EmpathyThemeManager *manager)
-{
-       EmpathyThemeManagerPriv *priv;
-       GtkStyle                *style;
-       gchar                    color[10];
-
-       priv = GET_PRIV (manager);
-
-       style = gtk_widget_get_default_style ();
-
-       g_object_freeze_notify (G_OBJECT (priv->simple_theme));
-
-       theme_manager_gdk_color_to_hex (&style->base[GTK_STATE_SELECTED], color);
-       g_object_set (priv->simple_theme,
-                     "action-foreground", color,
-                     "link-foreground", color,
-                     NULL);
-       theme_manager_gdk_color_to_hex (&style->bg[GTK_STATE_SELECTED], color);
-       g_object_set (priv->simple_theme,
-                     "header-background", color,
-                     NULL);
-
-       theme_manager_gdk_color_to_hex (&style->dark[GTK_STATE_SELECTED], color);
-       g_object_set (priv->simple_theme,
-                     "header-line-background", color,
-                     NULL);
-
-       theme_manager_gdk_color_to_hex (&style->fg[GTK_STATE_SELECTED], color);
-       g_object_set (priv->simple_theme,
-                     "header-foreground", color,
-                     NULL);
-
-       g_object_thaw_notify (G_OBJECT (priv->simple_theme));
-
-#if 0
-
-FIXME: Make that work, it should update color when theme changes but it
-       doesnt seems to work with all themes.
-  
-       g_object_get (priv->settings,
-                     "color-hash", &color_hash,
-                     NULL);
-
-       /*
-        * base_color: #ffffffffffff
-        * fg_color: #000000000000
-        * bg_color: #e6e6e7e7e8e8
-        * text_color: #000000000000
-        * selected_bg_color: #58589a9adbdb
-        * selected_fg_color: #ffffffffffff
-        */
-
-       color = g_hash_table_lookup (color_hash, "base_color");
-       if (color) {
-               theme_manager_gdk_color_to_hex (color, color_str);
-               g_object_set (priv->simple_theme,
-                             "action-foreground", color_str,
-                             "link-foreground", color_str,
-                             NULL);
-       }
-
-       color = g_hash_table_lookup (color_hash, "selected_bg_color");
-       if (color) {
-               theme_manager_gdk_color_to_hex (color, color_str);
-               g_object_set (priv->simple_theme,
-                             "header-background", color_str,
-                             NULL);
-       }
-
-       color = g_hash_table_lookup (color_hash, "bg_color");
-       if (color) {
-               GdkColor tmp;
-
-               tmp = *color;
-               tmp.red /= 2;
-               tmp.green /= 2;
-               tmp.blue /= 2;
-               theme_manager_gdk_color_to_hex (&tmp, color_str);
-               g_object_set (priv->simple_theme,
-                             "header-line-background", color_str,
-                             NULL);
-       }
-
-       color = g_hash_table_lookup (color_hash, "selected_fg_color");
-       if (color) {
-               theme_manager_gdk_color_to_hex (color, color_str);
-               g_object_set (priv->simple_theme,
-                             "header-foreground", color_str,
-                             NULL);
-       }
-
-       g_hash_table_unref (color_hash);
-
-#endif
-}
-
 static void
 empathy_theme_manager_class_init (EmpathyThemeManagerClass *klass)
 {
@@ -246,39 +138,9 @@ empathy_theme_manager_init (EmpathyThemeManager *manager)
                              EMPATHY_PREFS_UI_SHOW_AVATARS,
                              &priv->show_avatars);
 
-       priv->settings = gtk_settings_get_default ();
-       g_signal_connect_swapped (priv->settings, "notify::color-hash",
-                                 G_CALLBACK (theme_manager_color_hash_notify_cb),
-                                 manager);
-
-       priv->simple_theme = g_object_new (EMPATHY_TYPE_THEME_BOXES, NULL);
-       theme_manager_color_hash_notify_cb (manager);
-
-       priv->clean_theme = g_object_new (EMPATHY_TYPE_THEME_BOXES,
-                                         "header-foreground", "black",
-                                         "header-background", "#efefdf",
-                                         "header_line_background", "#e3e3d3",
-                                         "action_foreground", "brown4",
-                                         "time_foreground", "darkgrey",
-                                         "event_foreground", "darkgrey",
-                                         "invite_foreground", "sienna",
-                                         "link_foreground","#49789e",
-                                         NULL);
-
-       priv->blue_theme = g_object_new (EMPATHY_TYPE_THEME_BOXES,
-                                        "header_foreground", "black",
-                                        "header_background", "#88a2b4",
-                                        "header_line_background", "#7f96a4",
-                                        "text_foreground", "black",
-                                        "text_background", "#adbdc8",
-                                        "highlight_foreground", "black",
-                                        "action_foreground", "brown4",
-                                        "time_foreground", "darkgrey",
-                                        "event_foreground", "#7f96a4",
-                                        "invite_foreground", "sienna",
-                                        "link_foreground", "#49789e",
-                                        NULL);
-
+       priv->clean_theme   = empathy_theme_boxes_new ("clean");
+       priv->simple_theme  = empathy_theme_boxes_new ("simple");
+       priv->blue_theme    = empathy_theme_boxes_new ("blue");
        priv->classic_theme = g_object_new (EMPATHY_TYPE_THEME_IRC, NULL);
 }
 
diff --git a/libempathy-gtk/empathy-theme-utils.c b/libempathy-gtk/empathy-theme-utils.c
new file mode 100644 (file)
index 0000000..56b758e
--- /dev/null
@@ -0,0 +1,90 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2007 Imendio AB
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <config.h>
+
+#include <gtk/gtktexttag.h>
+
+#include "empathy-theme-utils.h"
+
+void
+empathy_theme_utils_ensure_tag_by_name (GtkTextBuffer *buffer, const gchar *name)
+{
+       GtkTextTagTable *table;
+       GtkTextTag      *tag;
+
+       table = gtk_text_buffer_get_tag_table (buffer);
+       tag = gtk_text_tag_table_lookup (table, name);
+
+       if (!tag) {
+               gtk_text_buffer_create_tag (buffer,
+                                           name,
+                                           NULL);
+       }
+}
+
+GtkTextTag *
+empathy_theme_utils_init_tag_by_name (GtkTextTagTable *table, const gchar *name)
+{
+       GtkTextTag *tag;
+
+       tag = gtk_text_tag_table_lookup (table, name);
+
+       if (!tag) {
+               return gtk_text_tag_new (name);
+       }
+
+       /* Clear the old values so that we don't affect the new theme. */
+       g_object_set (tag,
+                     "background-set", FALSE,
+                     "foreground-set", FALSE,
+                     "invisible-set", FALSE,
+                     "justification-set", FALSE,
+                     "paragraph-background-set", FALSE,
+                     "pixels-above-lines-set", FALSE,
+                     "pixels-below-lines-set", FALSE,
+                     "rise-set", FALSE,
+                     "scale-set", FALSE,
+                     "size-set", FALSE,
+                     "style-set", FALSE,
+                     "weight-set", FALSE,
+                     NULL);
+
+       return tag;
+}
+
+void
+empathy_theme_utils_add_tag (GtkTextTagTable *table, GtkTextTag *tag)
+{
+       gchar      *name;
+       GtkTextTag *check_tag;
+
+       g_object_get (tag, "name", &name, NULL);
+       check_tag = gtk_text_tag_table_lookup (table, name);
+       g_free (name);
+       if (check_tag) {
+               return;
+       }
+
+       gtk_text_tag_table_add (table, tag);
+
+       g_object_unref (tag);
+}
+
diff --git a/libempathy-gtk/empathy-theme-utils.h b/libempathy-gtk/empathy-theme-utils.h
new file mode 100644 (file)
index 0000000..af97077
--- /dev/null
@@ -0,0 +1,40 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2007 Imendio AB
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __EMPATHY_THEME_UTILS_H__
+#define __EMPATHY_THEME_UTILS_H__
+
+#include <gtk/gtktextbuffer.h>
+#include <gtk/gtktexttag.h>
+
+G_BEGIN_DECLS
+
+void          empathy_theme_utils_ensure_tag_by_name  (GtkTextBuffer   *buffer,
+                                                      const gchar     *name);
+GtkTextTag *  empathy_theme_utils_init_tag_by_name    (GtkTextTagTable *table,
+                                                      const gchar     *name);
+void          empathy_theme_utils_add_tag             (GtkTextTagTable *table,
+                                                      GtkTextTag      *tag);
+
+G_END_DECLS
+
+#endif /* __EMPATHY_THEME_UTILS_H__ */
+
+
index 1895b8c..c465ae6 100644 (file)
@@ -31,6 +31,7 @@
 
 #include "empathy-chat.h"
 #include "empathy-preferences.h"
+#include "empathy-theme-utils.h"
 #include "empathy-theme.h"
 #include "empathy-smiley-manager.h"
 
@@ -66,6 +67,13 @@ enum {
        PROP_SHOW_AVATARS
 };
 
+enum {
+       UPDATED,
+       LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = { 0 };
+
 static void
 empathy_theme_class_init (EmpathyThemeClass *class)
 {
@@ -77,7 +85,8 @@ empathy_theme_class_init (EmpathyThemeClass *class)
        object_class->get_property = theme_get_property;
        object_class->set_property = theme_set_property;
 
-       class->update_view      = NULL;
+       class->setup_with_view  = NULL;
+       class->view_cleared     = NULL;
        class->append_message   = NULL;
        class->append_event     = NULL;
        class->append_timestamp = NULL;
@@ -90,6 +99,16 @@ empathy_theme_class_init (EmpathyThemeClass *class)
                                                               TRUE,
                                                               G_PARAM_READWRITE));
 
+       signals[UPDATED] =
+               g_signal_new ("updated",
+                             G_TYPE_FROM_CLASS (class),
+                             G_SIGNAL_RUN_LAST,
+                             0,
+                             NULL, NULL,
+                             empathy_marshal_VOID__VOID,
+                             G_TYPE_NONE, 
+                             0);
+
        g_type_class_add_private (object_class, sizeof (EmpathyThemePriv));
 }
 
@@ -149,8 +168,7 @@ theme_set_property (GObject      *object,
 
        switch (param_id) {
        case PROP_SHOW_AVATARS:
-               empathy_theme_set_show_avatars (EMPATHY_THEME (object),
-                                               g_value_get_boolean (value));
+               priv->show_avatars = g_value_get_boolean (value);
                break;
        default:
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
@@ -160,6 +178,7 @@ theme_set_property (GObject      *object,
 
 void
 empathy_theme_maybe_append_date_and_time (EmpathyTheme        *theme,
+                                        EmpathyThemeContext *context,
                                         EmpathyChatView     *view,
                                         EmpathyMessage      *message)
 {
@@ -188,24 +207,61 @@ empathy_theme_maybe_append_date_and_time (EmpathyTheme        *theme,
        }
 
        if (append_time || append_date) {
-               empathy_theme_append_timestamp (theme, view, message,
+               empathy_theme_append_timestamp (theme, context,
+                                              view, message,
                                               append_date, append_time);
        }
 }
 
+EmpathyTheme *
+empathy_theme_new (void)
+{
+       EmpathyTheme     *theme;
+
+       theme = g_object_new (EMPATHY_TYPE_THEME, NULL);
+
+       return theme;
+}
+
+EmpathyThemeContext *
+empathy_theme_setup_with_view (EmpathyTheme    *theme,
+                             EmpathyChatView *view)
+{
+       if (!EMPATHY_THEME_GET_CLASS(theme)->setup_with_view) {
+               g_error ("Theme must override setup_with_view");
+       }
+
+       return EMPATHY_THEME_GET_CLASS(theme)->setup_with_view (theme, view);
+}
+
 void
-empathy_theme_update_view (EmpathyTheme    *theme,
-                          EmpathyChatView *view)
+empathy_theme_detach_from_view (EmpathyTheme        *theme,
+                              EmpathyThemeContext *context,
+                              EmpathyChatView     *view)
 {
-       if (!EMPATHY_THEME_GET_CLASS(theme)->update_view) {
-               g_error ("Theme must override update_view");
+       if (!EMPATHY_THEME_GET_CLASS(theme)->detach_from_view) {
+               g_error ("Theme must override detach_from_view");
+       }
+
+       return EMPATHY_THEME_GET_CLASS(theme)->detach_from_view (theme, context,
+                                                               view);
+}
+
+void
+empathy_theme_view_cleared (EmpathyTheme        *theme,
+                          EmpathyThemeContext *context,
+                          EmpathyChatView     *view)
+{
+       if (!EMPATHY_THEME_GET_CLASS(theme)->view_cleared) {
+               return;
        }
 
-       return EMPATHY_THEME_GET_CLASS(theme)->update_view (theme, view);
+       EMPATHY_THEME_GET_CLASS(theme)->view_cleared (theme, context, view);
 }
 
 void
 empathy_theme_append_message (EmpathyTheme        *theme,
+                            EmpathyThemeContext *context,
                             EmpathyChatView     *view,
                             EmpathyMessage      *message)
 {
@@ -214,7 +270,8 @@ empathy_theme_append_message (EmpathyTheme        *theme,
                return;
        }
 
-       EMPATHY_THEME_GET_CLASS(theme)->append_message (theme, view, message);
+       EMPATHY_THEME_GET_CLASS(theme)->append_message (theme, context, view,
+                                                      message);
 }
 
 static void
@@ -252,6 +309,7 @@ theme_insert_text_with_emoticons (GtkTextBuffer *buf,
 
 void
 empathy_theme_append_text (EmpathyTheme        *theme,
+                         EmpathyThemeContext *context,
                          EmpathyChatView     *view,
                          const gchar        *body,
                          const gchar        *tag,
@@ -352,6 +410,7 @@ empathy_theme_append_text (EmpathyTheme        *theme,
 
 void 
 empathy_theme_append_event (EmpathyTheme        *theme,
+                          EmpathyThemeContext *context,
                           EmpathyChatView     *view,
                           const gchar        *str)
 {
@@ -359,23 +418,25 @@ empathy_theme_append_event (EmpathyTheme        *theme,
                return;
        }
 
-       EMPATHY_THEME_GET_CLASS(theme)->append_event (theme, view, str);
+       EMPATHY_THEME_GET_CLASS(theme)->append_event (theme, context, view, str);
 }
 
 void
 empathy_theme_append_spacing (EmpathyTheme        *theme, 
+                            EmpathyThemeContext *context,
                             EmpathyChatView     *view)
 {
        if (!EMPATHY_THEME_GET_CLASS(theme)->append_spacing) {
                return;
        }
 
-       EMPATHY_THEME_GET_CLASS(theme)->append_spacing (theme, view);
+       EMPATHY_THEME_GET_CLASS(theme)->append_spacing (theme, context, view);
 }
 
 
 void 
 empathy_theme_append_timestamp (EmpathyTheme        *theme,
+                              EmpathyThemeContext *context,
                               EmpathyChatView     *view,
                               EmpathyMessage      *message,
                               gboolean            show_date,
@@ -385,7 +446,7 @@ empathy_theme_append_timestamp (EmpathyTheme        *theme,
                return;
        }
 
-       EMPATHY_THEME_GET_CLASS(theme)->append_timestamp (theme, view,
+       EMPATHY_THEME_GET_CLASS(theme)->append_timestamp (theme, context, view,
                                                         message, show_date,
                                                         show_time);
 }
index 34875bc..b05342a 100644 (file)
@@ -42,54 +42,89 @@ struct _EmpathyTheme {
        GObject parent;
 };
 
+typedef void EmpathyThemeContext;
+
 struct _EmpathyThemeClass {
        GObjectClass parent_class;
 
        /* <vtable> */
-       void (*update_view)         (EmpathyTheme    *theme,
-                                    EmpathyChatView *view);
-       void (*append_message)      (EmpathyTheme    *theme,
-                                    EmpathyChatView *view,
-                                    EmpathyMessage  *message);
-       void (*append_event)        (EmpathyTheme    *theme,
-                                    EmpathyChatView *view,
-                                    const gchar     *str);
-       void (*append_timestamp)    (EmpathyTheme    *theme,
-                                    EmpathyChatView *view,
-                                    EmpathyMessage  *message,
-                                    gboolean         show_date,
-                                    gboolean         show_time);
-       void (*append_spacing)      (EmpathyTheme    *theme,
-                                    EmpathyChatView *view);
+       EmpathyThemeContext * (*setup_with_view)  (EmpathyTheme        *theme,
+                                                 EmpathyChatView     *view);
+       void                 (*detach_from_view) (EmpathyTheme        *theme,
+                                                 EmpathyThemeContext *context,
+                                                 EmpathyChatView     *view);
+       void                 (*view_cleared)     (EmpathyTheme        *theme,
+                                                 EmpathyThemeContext *context,
+                                                 EmpathyChatView     *view);
+       void                 (*append_message)   (EmpathyTheme        *theme,
+                                                 EmpathyThemeContext *context,
+                                                 EmpathyChatView     *view,
+                                                 EmpathyMessage      *message);
+       void                 (*append_event)     (EmpathyTheme        *theme,
+                                                 EmpathyThemeContext *context,
+                                                 EmpathyChatView     *view,
+                                                 const gchar        *str);
+       void                 (*append_timestamp) (EmpathyTheme        *theme,
+                                                 EmpathyThemeContext *context,
+                                                 EmpathyChatView     *view,
+                                                 EmpathyMessage      *message,
+                                                 gboolean            show_date,
+                                                 gboolean            show_time);
+       void                 (*append_spacing)   (EmpathyTheme        *theme,
+                                                 EmpathyThemeContext *context,
+                                                 EmpathyChatView     *view);
+       void                 (*update_show_avatars) (EmpathyTheme     *theme,
+                                                    EmpathyThemeContext *context,
+                                                    EmpathyChatView  *view,
+                                                    gboolean         show);
 };
 
-GType          empathy_theme_get_type                   (void) G_GNUC_CONST;
-void           empathy_theme_update_view                (EmpathyTheme    *theme,
-                                                        EmpathyChatView *view);
-void           empathy_theme_append_message             (EmpathyTheme    *theme,
-                                                        EmpathyChatView *view,
-                                                        EmpathyMessage  *msg);
-void           empathy_theme_append_text                (EmpathyTheme    *theme,
-                                                        EmpathyChatView *view,
-                                                        const gchar     *body,
-                                                        const gchar     *tag, 
-                                                        const gchar     *link_tag);
-void           empathy_theme_append_spacing             (EmpathyTheme    *theme,
-                                                        EmpathyChatView *view);
-void           empathy_theme_append_event               (EmpathyTheme    *theme,
-                                                        EmpathyChatView *view,
-                                                        const gchar     *str);
-void           empathy_theme_append_timestamp           (EmpathyTheme    *theme,
-                                                        EmpathyChatView *view,
-                                                        EmpathyMessage  *message,
-                                                        gboolean         show_date,
-                                                        gboolean         show_time);
-void           empathy_theme_maybe_append_date_and_time (EmpathyTheme    *theme,
-                                                        EmpathyChatView *view,
-                                                        EmpathyMessage  *message);
-gboolean       empathy_theme_get_show_avatars           (EmpathyTheme    *theme);
-void           empathy_theme_set_show_avatars           (EmpathyTheme    *theme,
-                                                        gboolean         show);
+GType         empathy_theme_get_type             (void) G_GNUC_CONST;
+
+EmpathyTheme * empathy_theme_new                  (void);
+
+EmpathyThemeContext *
+empathy_theme_setup_with_view                    (EmpathyTheme        *theme,
+                                                EmpathyChatView     *view);
+void         empathy_theme_detach_from_view      (EmpathyTheme        *theme,
+                                                EmpathyThemeContext *context,
+                                                EmpathyChatView     *view);
+void         empathy_theme_view_cleared          (EmpathyTheme        *theme,
+                                                EmpathyThemeContext *context,
+                                                EmpathyChatView     *view);
+
+void         empathy_theme_append_message        (EmpathyTheme        *theme,
+                                                EmpathyThemeContext *context,
+                                                EmpathyChatView     *view,
+                                                EmpathyMessage      *msg);
+void         empathy_theme_append_text           (EmpathyTheme        *theme,
+                                                EmpathyThemeContext *context,
+                                                EmpathyChatView     *view,
+                                                const gchar        *body,
+                                                const gchar        *tag, 
+                                                const gchar        *link_tag);
+void         empathy_theme_append_spacing        (EmpathyTheme        *theme,
+                                                EmpathyThemeContext *context,
+                                                EmpathyChatView     *view);
+void         empathy_theme_append_event          (EmpathyTheme        *theme,
+                                                EmpathyThemeContext *context,
+                                                EmpathyChatView     *view,
+                                                const gchar        *str);
+void         empathy_theme_append_timestamp      (EmpathyTheme        *theme,
+                                                EmpathyThemeContext *context,
+                                                EmpathyChatView     *view,
+                                                EmpathyMessage      *message,
+                                                gboolean            show_date,
+                                                gboolean            show_time);
+
+void      
+empathy_theme_maybe_append_date_and_time         (EmpathyTheme        *theme,
+                                                EmpathyThemeContext *context,
+                                                EmpathyChatView     *view,
+                                                EmpathyMessage      *message);
+gboolean     empathy_theme_get_show_avatars      (EmpathyTheme        *theme);
+void         empathy_theme_set_show_avatars      (EmpathyTheme        *theme,
+                                                gboolean            show);
 
 G_END_DECLS
 
index 2989ce2..6f1b5a8 100644 (file)
@@ -1376,51 +1376,3 @@ empathy_toggle_button_set_state_quietly (GtkWidget *widget,
        g_signal_handlers_unblock_by_func (widget, callback, user_data);
 }
 
-GtkTextTag *
-empathy_text_buffer_tag_set (GtkTextBuffer *buffer,
-                            const gchar   *tag_name,
-                            const gchar   *first_property_name,
-                            ...)
-{
-       GtkTextTagTable *table;
-       GtkTextTag      *tag;
-
-       g_return_val_if_fail (GTK_IS_TEXT_BUFFER (buffer), NULL);
-       g_return_val_if_fail (tag_name != NULL, NULL);
-
-       table = gtk_text_buffer_get_tag_table (buffer);
-       tag = gtk_text_tag_table_lookup (table, tag_name);
-
-       if (!tag) {
-               tag = gtk_text_tag_new (tag_name);
-               gtk_text_tag_table_add (table, tag);
-               g_object_unref (tag);
-       } else {
-               /* Clear the old values so that we don't affect the new theme. */
-               g_object_set (tag,
-                             "background-set", FALSE,
-                             "foreground-set", FALSE,
-                             "invisible-set", FALSE,
-                             "justification-set", FALSE,
-                             "paragraph-background-set", FALSE,
-                             "pixels-above-lines-set", FALSE,
-                             "pixels-below-lines-set", FALSE,
-                             "rise-set", FALSE,
-                             "scale-set", FALSE,
-                             "size-set", FALSE,
-                             "style-set", FALSE,
-                             "weight-set", FALSE,
-                             NULL);
-       }
-
-       if (first_property_name) {
-               va_list list;
-
-               va_start (list, first_property_name);
-               g_object_set_valist (G_OBJECT (tag), first_property_name, list);
-               va_end (list);
-       }
-
-       return tag;
-}
-
index fd1f7c6..eb18954 100644 (file)
@@ -106,12 +106,9 @@ void        empathy_toggle_button_set_state_quietly     (GtkWidget        *widge
                                                         GCallback         callback,
                                                         gpointer          user_data,
                                                         gboolean          active);
-GtkWidget * empathy_link_button_new                     (const gchar      *url,
+GtkWidget *empathy_link_button_new                      (const gchar      *url,
                                                         const gchar      *title);
-GtkTextTag *empathy_text_buffer_tag_set                 (GtkTextBuffer *buffer,
-                                                        const gchar   *tag_name,
-                                                        const gchar   *first_property_name,
-                                                        ...);
+
 
 G_END_DECLS
 
diff --git a/m4/.gitignore b/m4/.gitignore
deleted file mode 100644 (file)
index e429342..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-gtk-doc.m4
-intltool.m4
diff --git a/m4/acinclude.m4 b/m4/acinclude.m4
deleted file mode 100644 (file)
index 3120d86..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-dnl Turn on the additional warnings last, so -Werror doesn't affect other tests.
-
-AC_DEFUN([IDT_COMPILE_WARNINGS],[
-   if test -f $srcdir/autogen.sh; then
-       default_compile_warnings="error"
-    else
-       default_compile_warnings="no"
-    fi
-
-    AC_ARG_WITH(compile-warnings,
-                AS_HELP_STRING([--with-compile-warnings=@<:@no/yes/error@:>@],
-                               [Compiler warnings]),
-                [enable_compile_warnings="$withval"],
-                [enable_compile_warnings="$default_compile_warnings"])
-
-    warnCFLAGS=
-    if test "x$GCC" != xyes; then
-       enable_compile_warnings=no
-    fi
-
-    warning_flags=
-    realsave_CFLAGS="$CFLAGS"
-
-    case "$enable_compile_warnings" in
-    no)
-       warning_flags=
-       ;;
-    yes)
-       warning_flags="-Wall -Wunused -Wmissing-prototypes -Wmissing-declarations"
-       ;;
-    maximum|error)
-       warning_flags="-Wall -Wunused -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith"
-       CFLAGS="$warning_flags $CFLAGS"
-       for option in -Wno-sign-compare -Wno-pointer-sign; do
-               SAVE_CFLAGS="$CFLAGS"
-               CFLAGS="$CFLAGS $option"
-               AC_MSG_CHECKING([whether gcc understands $option])
-               AC_TRY_COMPILE([], [],
-                       has_option=yes,
-                       has_option=no,)
-               CFLAGS="$SAVE_CFLAGS"
-               AC_MSG_RESULT($has_option)
-               if test $has_option = yes; then
-                 warning_flags="$warning_flags $option"
-               fi
-               unset has_option
-               unset SAVE_CFLAGS
-       done
-       unset option
-       if test "$enable_compile_warnings" = "error" ; then
-           warning_flags="$warning_flags -Werror"
-       fi
-       ;;
-    *)
-       AC_MSG_ERROR(Unknown argument '$enable_compile_warnings' to --enable-compile-warnings)
-       ;;
-    esac
-    CFLAGS="$realsave_CFLAGS"
-    AC_MSG_CHECKING(what warning flags to pass to the C compiler)
-    AC_MSG_RESULT($warning_flags)
-
-    WARN_CFLAGS="$warning_flags"
-    AC_SUBST(WARN_CFLAGS)
-])
-
diff --git a/m4/empathy-args.m4 b/m4/empathy-args.m4
deleted file mode 100644 (file)
index 3daacba..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-dnl configure-time options for Empathy
-
-dnl EMPATHY_ARG_VALGRIND
-
-AC_DEFUN([EMPATHY_ARG_VALGRIND],
-[
-  dnl valgrind inclusion
-  AC_ARG_ENABLE(valgrind,
-    AC_HELP_STRING([--enable-valgrind],[enable valgrind checking and run-time detection]),
-    [
-      case "${enableval}" in
-        yes|no) enable="${enableval}" ;;
-        *)   AC_MSG_ERROR(bad value ${enableval} for --enable-valgrind) ;;
-      esac
-    ],
-    [enable=no])
-
-  EMPATHY_VALGRIND($enable, [2.1])
-])
diff --git a/m4/empathy-valgrind.m4 b/m4/empathy-valgrind.m4
deleted file mode 100644 (file)
index 7a44e10..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-dnl Detect Valgrind location and flags
-
-AC_DEFUN([EMPATHY_VALGRIND],
-[
-  enable=$1
-  if test -n "$2"; then
-    valgrind_req=$2
-  else
-    valgrind_req="2.1"
-  fi
-
-  PKG_CHECK_MODULES(VALGRIND, valgrind > "$valgrind_req",
-    have_valgrind_runtime="yes", have_valgrind_runtime="no")
-
-  AC_PATH_PROG(VALGRIND_PATH, valgrind)
-
-  # Compile the instrumentation for valgrind only if the valgrind
-  # libraries are installed and the valgrind executable is found
-  if test "x$enable" = xyes &&
-     test "$have_valgrind_runtime" = yes &&
-     test -n "$VALGRIND_PATH" ;
-  then
-    AC_DEFINE(HAVE_VALGRIND, 1, [Define if valgrind should be used])
-    AC_MSG_NOTICE(using compile-time instrumentation for valgrind)
-  fi
-
-  AC_SUBST(VALGRIND_CFLAGS)
-  AC_SUBST(VALGRIND_LIBS)
-
-  AM_CONDITIONAL(HAVE_VALGRIND, test -n "$VALGRIND_PATH")
-])
index 90b9b74..c7d5b98 100644 (file)
@@ -3,4 +3,3 @@
 Makefile.in.in
 POTFILES
 stamp-it
-empathy.pot
index b23897d..c77ef0c 100644 (file)
@@ -19,7 +19,6 @@ libempathy-gtk/empathy-accounts-dialog.c
 libempathy-gtk/empathy-accounts-dialog.glade
 libempathy-gtk/empathy-avatar-chooser.c
 libempathy-gtk/empathy-avatar-image.c
-libempathy-gtk/empathy-call-window.c
 libempathy-gtk/empathy-call-window.glade
 libempathy-gtk/empathy-chat.c
 libempathy-gtk/empathy-chat.glade
@@ -50,8 +49,6 @@ libempathy-gtk/empathy-spell-dialog.c
 libempathy-gtk/empathy-spell-dialog.glade
 libempathy-gtk/empathy-status-icon.c
 libempathy-gtk/empathy-status-icon.glade
-libempathy-gtk/empathy-theme-boxes.c
-libempathy-gtk/empathy-theme-irc.c
 libempathy-gtk/empathy-theme-manager.c
 
 megaphone/data/GNOME_Megaphone_Applet.schemas.in
diff --git a/rules/check.mak b/rules/check.mak
deleted file mode 100644 (file)
index bbb9819..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-LOOPS = 10
-CLEANFILES += valgrind.*.log
-
-# run any given test by running make test.check
-# if the test fails, run it again at at least debug level 2
-%.check: %
-       @$(TESTS_ENVIRONMENT)                                   \
-       $* ||                                                   \
-       $(TESTS_ENVIRONMENT)                                    \
-       $*
-
-# run any given test in a loop
-%.torture: %
-       @for i in `seq 1 $(LOOPS)`; do                          \
-       $(TESTS_ENVIRONMENT)                                    \
-       $*; done
-
-# run any given test in an infinite loop
-%.forever: %
-       @while true; do                                         \
-       $(TESTS_ENVIRONMENT)                                    \
-       $* || break; done
-
-# valgrind any given test by running make test.valgrind
-%.valgrind: %
-       $(TESTS_ENVIRONMENT)                                    \
-       CK_DEFAULT_TIMEOUT=360                                  \
-       G_SLICE=always-malloc                                   \
-       G_DEBUG=gc-friendly                                     \
-       libtool --mode=execute                                  \
-       $(VALGRIND_PATH) -q                                     \
-       $(foreach s,$(SUPPRESSIONS),--suppressions=$(s))        \
-       --tool=memcheck --leak-check=full --trace-children=yes  \
-       --leak-resolution=high --num-callers=20                 \
-       ./$* 2>&1 | tee "valgrind.$*.log"
-       @if grep "==" "valgrind.$*.log" > /dev/null 2>&1; then  \
-           exit 1;                                             \
-       fi
-       
-# valgrind any given test and generate suppressions for it
-%.valgrind.gen-suppressions: %
-       $(TESTS_ENVIRONMENT)                                    \
-       CK_DEFAULT_TIMEOUT=360                                  \
-       G_SLICE=always-malloc                                   \
-       G_DEBUG=gc-friendly                                     \
-       libtool --mode=execute                                  \
-       $(VALGRIND_PATH) -q                                     \
-       $(foreach s,$(SUPPRESSIONS),--suppressions=$(s))        \
-       --tool=memcheck --leak-check=full --trace-children=yes  \
-       --leak-resolution=high --num-callers=20                 \
-       --gen-suppressions=all                                  \
-       ./$* 2>&1 | tee suppressions.log
-       
-# valgrind any given test until failure by running make test.valgrind-forever
-%.valgrind-forever: %
-       @while $(MAKE) $*.valgrind; do                          \
-         true; done
-
-# gdb any given test by running make test.gdb
-%.gdb: %
-       $(TESTS_ENVIRONMENT)                                    \
-       CK_FORK=no                                              \
-       libtool --mode=execute                                  \
-       gdb $*
-
-# torture tests
-torture: $(TESTS)
-       @echo "Torturing tests ..."
-       for i in `seq 1 $(LOOPS)`; do                           \
-               $(MAKE) check ||                                \
-               (echo "Failure after $$i runs"; exit 1) ||      \
-               exit 1;                                         \
-       done
-       @banner="All $(LOOPS) loops passed";                    \
-       dashes=`echo "$$banner" | sed s/./=/g`;                 \
-       echo $$dashes; echo $$banner; echo $$dashes
-
-# forever tests
-forever: $(TESTS)
-       @echo "Forever tests ..."
-       while true; do                                          \
-               $(MAKE) check ||                                \
-               (echo "Failure"; exit 1) ||                     \
-               exit 1;                                         \
-       done
-
-# valgrind all tests
-valgrind: $(TESTS)
-       @echo "Valgrinding tests ..."
-       @failed=0;                                                      \
-       for t in $(filter-out $(VALGRIND_TESTS_DISABLE),$(TESTS)); do   \
-               $(MAKE) $$t.valgrind;                                   \
-               if test "$$?" -ne 0; then                               \
-                        echo "Valgrind error for test $$t";            \
-                       failed=`expr $$failed + 1`;                     \
-                       whicht="$$whicht $$t";                          \
-                fi;                                                    \
-       done;                                                           \
-       if test "$$failed" -ne 0; then                                  \
-               echo "$$failed tests had leaks or errors under valgrind:";      \
-               echo "$$whicht";                                        \
-               false;                                                  \
-       fi
-
-help:
-       @echo "make check                         -- run all checks"
-       @echo "make torture                       -- run all checks $(LOOPS) times"
-       @echo "make (dir)/(test).check            -- run the given check once"
-       @echo "make (dir)/(test).forever          -- run the given check forever"
-       @echo "make (dir)/(test).torture          -- run the given check $(LOOPS) times"
-       @echo
-       @echo "make (dir)/(test).gdb              -- start up gdb for the given test"
-       @echo
-       @echo "make valgrind                      -- valgrind all tests"
-       @echo "make (dir)/(test).valgrind         -- valgrind the given test"
-       @echo "make (dir)/(test).valgrind-forever -- valgrind the given test forever"
-       @echo "make (dir)/(test).valgrind.gen-suppressions -- generate suppressions"
-       @echo "                                               and save to suppressions.log"
-       @echo "make inspect                       -- inspect all plugin features"
-
index 54397d0..75a6286 100644 (file)
@@ -2,5 +2,3 @@ empathy
 empathy-accounts
 empathy-chat-chandler
 org.gnome.Empathy.Chat.service
-empathy-call-chandler
-org.gnome.Empathy.Call.service
index be9de11..3a1b511 100644 (file)
 #define BUS_NAME "org.gnome.Empathy.CallChandler"
 #define OBJECT_PATH "/org/gnome/Empathy/CallChandler"
 
-static guint nb_calls = 0;
-
-static void
-call_chandler_weak_notify (gpointer  data,
-                          GObject  *where_the_object_was)
-{
-       nb_calls--;
-       if (nb_calls == 0) {
-               empathy_debug (DEBUG_DOMAIN, "No more calls, leaving...");
-               gtk_main_quit ();
-       }
-}
-
 static void
 call_chandler_new_channel_cb (EmpathyChandler *chandler,
                              TpConn          *tp_conn,
@@ -63,17 +50,13 @@ call_chandler_new_channel_cb (EmpathyChandler *chandler,
 {
        EmpathyTpCall *call;
        McAccount     *account;
-       GtkWidget     *window;
 
        account = mission_control_get_account_for_connection (mc, tp_conn, NULL);
 
        call = empathy_tp_call_new (account, tp_chan);
-       window = empathy_call_window_show (call);
+       empathy_call_window_show (call);
        g_object_unref (account);
        g_object_unref (call);
-
-       nb_calls++;
-       g_object_weak_ref (G_OBJECT (window), call_chandler_weak_notify, NULL);
 }
 
 int
index 79bbe8a..dc2eb60 100644 (file)
 #define BUS_NAME "org.gnome.Empathy.ChatChandler"
 #define OBJECT_PATH "/org/gnome/Empathy/ChatChandler"
 
-static guint nb_chats = 0;
-
-static void
-chat_chandler_weak_notify (gpointer  data,
-                          GObject  *where_the_object_was)
-{
-       nb_chats--;
-       if (nb_chats == 0) {
-               empathy_debug (DEBUG_DOMAIN, "No more chats, leaving...");
-               gtk_main_quit ();
-       }
-}
-
 static void
 chat_chandler_new_channel_cb (EmpathyChandler *chandler,
                              TpConn          *tp_conn,
@@ -112,8 +99,6 @@ chat_chandler_new_channel_cb (EmpathyChandler *chandler,
                return;
        }
 
-       nb_chats++;
-       g_object_weak_ref (G_OBJECT (chat), chat_chandler_weak_notify, NULL);
        empathy_chat_present (chat);
 
        g_object_unref (chat);
diff --git a/svn2cl.xsl b/svn2cl.xsl
new file mode 100644 (file)
index 0000000..fec8154
--- /dev/null
@@ -0,0 +1,295 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+
+   svn2cl.xsl - xslt stylesheet for converting svn log to a normal
+                changelog
+
+   Usage (replace ++ with two minus signs):
+     svn ++verbose ++xml log | \
+       xsltproc ++stringparam strip-prefix `basename $(pwd)` \
+                ++stringparam linelen 75 \
+                ++stringparam groupbyday yes \
+                ++stringparam include-rev yes \
+                svn2cl.xsl - > ChangeLog
+
+   This file is based on several implementations of this conversion
+   that I was not completely happy with and some other common
+   xslt constructs found on the web.
+
+   Copyright (C) 2004, 2005 Arthur de Jong.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in
+      the documentation and/or other materials provided with the
+      distribution.
+   3. The name of the author may not be used to endorse or promote
+      products derived from this software without specific prior
+      written permission.
+
+   THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+   IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+   WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+   DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+   GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+   IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+   OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+   IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+-->
+
+<!DOCTYPE page [
+ <!ENTITY tab "&#9;">
+ <!ENTITY newl "&#13;">
+ <!ENTITY space "&#32;">
+]>
+
+<!--
+   TODO
+   - make external lookups of author names possible
+   - find a place for revision numbers
+   - mark deleted files as such
+   - combine paths
+   - make path formatting nicer
+-->
+
+<xsl:stylesheet
+  version="1.0"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns="http://www.w3.org/1999/xhtml">
+
+ <xsl:output
+   method="text"
+   encoding="utf-8"
+   media-type="text/plain"
+   omit-xml-declaration="yes"
+   standalone="yes"
+   indent="no" />
+
+ <xsl:strip-space elements="*" />
+
+ <!-- the prefix of pathnames to strip -->
+ <xsl:param name="strip-prefix" select="'/'" />
+
+ <!-- the length of a line to wrap messages at -->
+ <xsl:param name="linelen" select="75" />
+ <!-- whether entries should be grouped by day -->
+ <xsl:param name="groupbyday" select="'no'" />
+
+ <!-- whether entries should be grouped by day -->
+ <xsl:param name="include-rev" select="'no'" />
+
+ <!-- add newlines at the end of the changelog -->
+ <xsl:template match="log">
+  <xsl:apply-templates/>
+  <xsl:text>&newl;</xsl:text>
+ </xsl:template>
+
+ <!-- format one entry from the log -->
+ <xsl:template match="logentry">
+  <!-- save log entry number -->
+  <xsl:variable name="pos" select="position()"/>
+  <!-- fetch previous entry's date -->
+  <xsl:variable name="prevdate">
+   <xsl:apply-templates select="../logentry[position()=(($pos)-1)]/date"/>
+  </xsl:variable>
+  <!-- fetch previous entry's author -->
+  <xsl:variable name="prevauthor">
+   <xsl:apply-templates select="../logentry[position()=(($pos)-1)]/author"/>
+  </xsl:variable>
+  <!-- fetch this entry's date -->
+  <xsl:variable name="date">
+   <xsl:apply-templates select="date" />
+  </xsl:variable>
+  <!-- fetch this entry's author -->
+  <xsl:variable name="author">
+   <xsl:apply-templates select="author" />
+  </xsl:variable>
+  <!-- check if header is changed -->
+  <xsl:if test="($prevdate!=$date) or ($prevauthor!=$author)">
+   <!-- add newline -->
+   <xsl:if test="not(position()=1)">
+     <xsl:text>&newl;</xsl:text>
+   </xsl:if>
+   <!-- date -->
+   <xsl:apply-templates select="date" />
+   <!-- two spaces -->
+   <xsl:text>&space;&space;</xsl:text>
+   <!-- author's name -->
+   <xsl:apply-templates select="author" />
+   <!-- two newlines -->
+   <xsl:text>&newl;&newl;</xsl:text>
+  </xsl:if>
+  <!-- get paths string -->
+  <xsl:variable name="paths">
+   <xsl:apply-templates select="paths" />
+  </xsl:variable>
+  <!-- get revision number -->
+  <xsl:variable name="rev">
+   <xsl:if test="$include-rev='yes'">
+    <xsl:text>[r</xsl:text>
+    <xsl:value-of select="@revision"/>
+    <xsl:text>]&space;</xsl:text>
+   </xsl:if>
+  </xsl:variable>
+  <!-- first line is indented (other indents are done in wrap template) -->
+  <xsl:text>&tab;*&space;</xsl:text>
+  <!-- print the paths and message nicely wrapped -->
+  <xsl:call-template name="wrap">
+   <xsl:with-param name="txt" select="concat($rev,$paths,normalize-space(msg))" />
+  </xsl:call-template>
+ </xsl:template>
+
+ <!-- format date -->
+ <xsl:template match="date">
+  <xsl:variable name="date" select="normalize-space(.)" />
+  <!-- output date part -->
+  <xsl:value-of select="substring($date,1,10)" />
+  <!-- output time part -->
+  <xsl:if test="$groupbyday!='yes'">
+   <xsl:text>&space;</xsl:text>
+   <xsl:value-of select="substring($date,12,5)" />
+  </xsl:if>
+ </xsl:template>
+
+ <!-- format author -->
+ <xsl:template match="author">
+  <xsl:value-of select="normalize-space(.)" />
+ </xsl:template>
+
+ <!-- present a list of paths names -->
+ <xsl:template match="paths">
+  <xsl:for-each select="path">
+   <xsl:sort select="normalize-space(.)" data-type="text" />
+   <!-- unless we are the first entry, add a comma -->
+   <xsl:if test="not(position()=1)">
+    <xsl:text>,&space;</xsl:text>
+   </xsl:if>
+   <!-- print the path name -->
+   <xsl:apply-templates select="."/>
+  </xsl:for-each>
+  <!-- end the list with a colon -->
+  <xsl:text>:&space;</xsl:text>
+ </xsl:template>
+
+ <!-- transform path to something printable -->
+ <xsl:template match="path">
+  <!-- fetch the pathname -->
+  <xsl:variable name="p1" select="normalize-space(.)" />
+  <!-- strip leading slash -->
+  <xsl:variable name="p2">
+   <xsl:choose>
+    <xsl:when test="starts-with($p1,'/')">
+     <xsl:value-of select="substring($p1,2)" />
+    </xsl:when>
+    <xsl:otherwise>
+     <xsl:value-of select="$p1" />
+    </xsl:otherwise>
+   </xsl:choose>
+  </xsl:variable>
+  <!-- strip trailing slash from strip-prefix -->
+  <xsl:variable name="sp">
+   <xsl:choose>
+    <xsl:when test="substring($strip-prefix,string-length($strip-prefix),1)='/'">
+     <xsl:value-of select="substring($strip-prefix,1,string-length($strip-prefix)-1)" />
+    </xsl:when>
+    <xsl:otherwise>
+     <xsl:value-of select="$strip-prefix" />
+    </xsl:otherwise>
+   </xsl:choose>
+  </xsl:variable>
+  <!-- strip strip-prefix -->
+  <xsl:variable name="p3">
+   <xsl:choose>
+    <xsl:when test="starts-with($p2,$sp)">
+     <xsl:value-of select="substring($p2,1+string-length($sp))" />
+    </xsl:when>
+    <xsl:otherwise>
+     <!-- TODO: do not print strings that do not begin with strip-prefix -->
+     <xsl:value-of select="$p2" />
+    </xsl:otherwise>
+   </xsl:choose>
+  </xsl:variable>
+  <!-- strip another slash -->
+  <xsl:variable name="p4">
+   <xsl:choose>
+    <xsl:when test="starts-with($p3,'/')">
+     <xsl:value-of select="substring($p3,2)" />
+    </xsl:when>
+    <xsl:otherwise>
+     <xsl:value-of select="$p3" />
+    </xsl:otherwise>
+   </xsl:choose>
+  </xsl:variable>
+  <!-- translate empty string to dot -->
+  <xsl:choose>
+   <xsl:when test="$p4 = ''">
+    <xsl:text>.</xsl:text>
+   </xsl:when>
+   <xsl:otherwise>
+    <xsl:value-of select="$p4" />
+   </xsl:otherwise>
+  </xsl:choose>
+ </xsl:template>
+
+ <!-- string-wrapping template -->
+ <xsl:template name="wrap">
+  <xsl:param name="txt" />
+  <xsl:choose>
+   <xsl:when test="(string-length($txt) &lt; (($linelen)-9)) or not(contains($txt,' '))">
+    <!-- this is easy, nothing to do -->
+    <xsl:value-of select="$txt" />
+    <!-- add newline -->
+    <xsl:text>&newl;</xsl:text>
+   </xsl:when>
+   <xsl:otherwise>
+    <!-- find the first line -->
+    <xsl:variable name="tmp" select="substring($txt,1,(($linelen)-10))" />
+    <xsl:variable name="line">
+     <xsl:choose>
+      <xsl:when test="contains($tmp,' ')">
+       <xsl:call-template name="find-line">
+        <xsl:with-param name="txt" select="$tmp" />
+       </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+       <xsl:value-of select="substring-before($txt,' ')" />
+      </xsl:otherwise>
+     </xsl:choose>
+    </xsl:variable>
+    <!-- print newline and tab -->
+    <xsl:value-of select="$line" />
+    <xsl:text>&newl;&tab;&space;&space;</xsl:text>
+    <!-- wrap the rest of the text -->
+    <xsl:call-template name="wrap">
+     <xsl:with-param name="txt" select="normalize-space(substring($txt,string-length($line)+1))" />
+    </xsl:call-template>
+   </xsl:otherwise>
+  </xsl:choose>
+ </xsl:template>
+
+ <!-- template to trim line to contain space as last char -->
+ <xsl:template name="find-line">
+  <xsl:param name="txt" />
+  <xsl:choose>
+   <xsl:when test="substring($txt,string-length($txt),1) = ' '">
+    <xsl:value-of select="normalize-space($txt)" />
+   </xsl:when>
+   <xsl:otherwise>
+    <xsl:call-template name="find-line">
+     <xsl:with-param name="txt" select="substring($txt,1,string-length($txt)-1)" />
+    </xsl:call-template>
+   </xsl:otherwise>
+  </xsl:choose>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/tests/.gitignore b/tests/.gitignore
deleted file mode 100644 (file)
index edf3032..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-check-main
-contact-manager
-*.log
index f823d4d..8c6094c 100644 (file)
@@ -1,9 +1,3 @@
-CLEANFILES=
-
-include $(top_srcdir)/rules/check.mak
-
-SUPPRESSIONS=valgrind.supp dlopen.supp
-
 AM_CPPFLAGS =                                          \
        -I$(top_srcdir)                                 \
        $(EMPATHY_CFLAGS)                               \
@@ -19,22 +13,3 @@ bin_PROGRAMS =                       \
 
 contact_manager_SOURCES = contact-manager.c
 
-check_PROGRAMS = check-main
-TESTS = check-main
-check_main_SOURCES =                             \
-    check-main.c                                 \
-    check-helpers.c                              \
-    check-helpers.h                              \
-    check-libempathy.h                           \
-    check-empathy-utils.c
-
-check_main_LDADD = \
-    @CHECK_LIBS@ \
-    $(top_builddir)/libempathy-gtk/libempathy-gtk.la   \
-    $(top_builddir)/libempathy/libempathy.la           \
-    $(AM_LDFLAGS)
-
-check_main_CFLAGS = \
-    @CHECK_CFLAGS@ \
-    $(AM_CFLAGS)
-
diff --git a/tests/check-empathy-utils.c b/tests/check-empathy-utils.c
deleted file mode 100644 (file)
index faf2610..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <check.h>
-#include "check-helpers.h"
-#include "check-libempathy.h"
-
-#include <libempathy/empathy-utils.h>
-
-START_TEST (test_empathy_substring)
-{
-  gchar *tmp;
-
-  tmp = empathy_substring ("empathy", 2, 6);
-  fail_if (tmp == NULL);
-  fail_if (strcmp (tmp, "path") != 0);
-
-  g_free (tmp);
-}
-END_TEST
-
-TCase *
-make_empathy_utils_tcase (void)
-{
-    TCase *tc = tcase_create ("empathy-utils");
-    tcase_add_test (tc, test_empathy_substring);
-    return tc;
-}
diff --git a/tests/check-helpers.c b/tests/check-helpers.c
deleted file mode 100644 (file)
index 1bb14cd..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * check-helpers.c - Source for some check helpers
- * Copyright (C) 2007 Collabora Ltd.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "check-helpers.h"
-
-static gboolean expecting_critical = FALSE;
-static gboolean received_critical  = FALSE;
-
-static void
-check_helper_log_critical_func (const gchar *log_damain,
-                                GLogLevelFlags log_level,
-                                const gchar *message,
-                                gpointer user_data)
-{
-
-  if (!expecting_critical)
-    {
-      fail("Unexpected critical message: %s\n", message);
-    }
-
-  g_assert (log_level & G_LOG_LEVEL_CRITICAL);
-
-  received_critical = TRUE;
-}
-
-gboolean
-got_critical (void)
-{
-  return received_critical;
-}
-
-void
-expect_critical (gboolean expected)
-{
-  expecting_critical = expected;
-  received_critical = FALSE;
-}
-
-void
-check_helpers_init (void)
-{
-  g_log_set_handler (NULL, G_LOG_LEVEL_CRITICAL,
-      check_helper_log_critical_func, NULL);
-}
diff --git a/tests/check-helpers.h b/tests/check-helpers.h
deleted file mode 100644 (file)
index b71b3b6..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * check-helpers.c - Source for some check helpers
- * Copyright (C) 2007 Collabora Ltd.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- */
-#ifndef __CHECK_HELPERS_H__
-#define __CHECK_HELPERS_H__
-
-#include <glib.h>
-#include <check.h>
-
-void
-check_helpers_init (void);
-
-void
-expect_critical (gboolean expected);
-
-gboolean
-got_critical (void);
-
-#define fail_unless_critical(expr, ...)                          \
-G_STMT_START {                                                    \
-  expect_critical (TRUE);                                         \
-  expr;                                                           \
-  _fail_unless (got_critical (), __FILE__, __LINE__,              \
-      "Expected g_critical, got none", ## __VA_ARGS__, NULL);     \
-  expect_critical (FALSE);                                        \
-} G_STMT_END;
-
-#endif /* #ifndef __CHECK_HELPERS_H__ */
diff --git a/tests/check-libempathy.h b/tests/check-libempathy.h
deleted file mode 100644 (file)
index 1f33025..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef __CHECK_LIBEMPATHY__
-#define __CHECK_LIBEMPATHY__
-
-TCase * make_empathy_utils_tcase (void);
-
-#endif /* #ifndef __CHECK_LIBEMPATHY__ */
diff --git a/tests/check-main.c b/tests/check-main.c
deleted file mode 100644 (file)
index 6dcfe32..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <glib-object.h>
-
-#include <check.h>
-
-#include "check-helpers.h"
-#include "check-libempathy.h"
-
-#include "config.h"
-
-static Suite *
-make_libempathy_suite (void)
-{
-    Suite *s = suite_create ("libempathy");
-
-    suite_add_tcase (s, make_empathy_utils_tcase ());
-
-    return s;
-}
-
-int
-main (void)
-{
-    int number_failed = 0;
-    Suite *s;
-    SRunner *sr;
-
-    check_helpers_init ();
-    g_type_init ();
-
-    s = make_libempathy_suite ();
-    sr = srunner_create (s);
-    srunner_run_all (sr, CK_NORMAL);
-    number_failed += srunner_ntests_failed (sr);
-    srunner_free (sr);
-
-    return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
-}
diff --git a/tests/dlopen.supp b/tests/dlopen.supp
deleted file mode 100644 (file)
index f6300a3..0000000
+++ /dev/null
@@ -1,127 +0,0 @@
-{
-   <dlopen>
-   Addrcheck,Memcheck:Cond
-   obj:/lib/ld-2.5.so
-   obj:/lib/ld-2.5.so
-   obj:/lib/ld-2.5.so
-   obj:/lib/i686/cmov/libdl-2.5.so
-   obj:/lib/ld-2.5.so
-   obj:/lib/i686/cmov/libdl-2.5.so
-   fun:dlopen
-}
-{
-   <dlopen>
-   Addrcheck,Memcheck:Addr4
-   obj:/lib/ld-2.5.so
-   obj:/lib/ld-2.5.so
-   obj:/lib/ld-2.5.so
-   obj:/lib/ld-2.5.so
-   obj:/lib/ld-2.5.so
-   obj:/lib/ld-2.5.so
-   obj:/lib/i686/cmov/libdl-2.5.so
-   obj:/lib/ld-2.5.so
-   obj:/lib/i686/cmov/libdl-2.5.so
-   fun:dlopen
-}
-{
-   <dlopen>
-   Addrcheck,Memcheck:Cond
-   obj:/lib/ld-2.5.so
-   obj:/lib/ld-2.5.so
-   obj:/lib/ld-2.5.so
-   obj:/lib/ld-2.5.so
-   obj:/lib/i686/cmov/libdl-2.5.so
-   obj:/lib/ld-2.5.so
-   obj:/lib/i686/cmov/libdl-2.5.so
-   fun:dlopen
-}
-{
-   <dlsym>
-   Addrcheck,Memcheck:Addr4
-   obj:/lib/ld-2.5.so
-   obj:/lib/ld-2.5.so
-   obj:/lib/ld-2.5.so
-   obj:/lib/i686/cmov/libc-2.5.so
-   fun:_dl_sym
-   obj:/lib/i686/cmov/libdl-2.5.so
-   obj:/lib/ld-2.5.so
-   obj:/lib/i686/cmov/libdl-2.5.so
-   fun:dlsym
-}
-{
-   <dlsym>
-   Addrcheck,Memcheck:Cond
-   obj:/lib/ld-2.5.so
-   obj:/lib/ld-2.5.so
-   obj:/lib/ld-2.5.so
-   obj:/lib/i686/cmov/libc-2.5.so
-   fun:_dl_sym
-   obj:/lib/i686/cmov/libdl-2.5.so
-   obj:/lib/ld-2.5.so
-   obj:/lib/i686/cmov/libdl-2.5.so
-   fun:dlsym
-}
-{
-   <dlopen>
-   Addrcheck,Memcheck:Addr1
-   fun:malloc
-   obj:/lib/ld-2.5.so
-   obj:/lib/ld-2.5.so
-   obj:/lib/ld-2.5.so
-   obj:/lib/ld-2.5.so
-   obj:/lib/ld-2.5.so
-   obj:/lib/ld-2.5.so
-   obj:/lib/ld-2.5.so
-   obj:/lib/i686/cmov/libdl-2.5.so
-   obj:/lib/ld-2.5.so
-   obj:/lib/i686/cmov/libdl-2.5.so
-   fun:dlopen
-}
-{
-   <dlopen>
-   Addrcheck,Memcheck:Addr1
-   fun:malloc
-   obj:/lib/ld-2.5.so
-   obj:/lib/ld-2.5.so
-   obj:/lib/ld-2.5.so
-   obj:/lib/ld-2.5.so
-   obj:/lib/ld-2.5.so
-   obj:/lib/ld-2.5.so
-   obj:/lib/ld-2.5.so
-   obj:/lib/i686/cmov/libdl-2.5.so
-   obj:/lib/ld-2.5.so
-   obj:/lib/i686/cmov/libdl-2.5.so
-   fun:dlopen
-}
-{
-   <dlopen>
-   Addrcheck,Memcheck:Addr1
-   fun:malloc
-   obj:/lib/ld-2.5.so
-   obj:/lib/ld-2.5.so
-   obj:/lib/ld-2.5.so
-   obj:/lib/ld-2.5.so
-   obj:/lib/ld-2.5.so
-   obj:/lib/ld-2.5.so
-   obj:/lib/ld-2.5.so
-   obj:/lib/i686/cmov/libdl-2.5.so
-   obj:/lib/ld-2.5.so
-   obj:/lib/i686/cmov/libdl-2.5.so
-   fun:dlopen
-}
-{
-   <libdl>
-   Addrcheck,Memcheck:Addr4
-   obj:/lib/ld-2.5.so
-   obj:/lib/ld-2.5.so
-   obj:/lib/ld-2.5.so
-   obj:/lib/ld-2.5.so
-   obj:/lib/ld-2.5.so
-   obj:/lib/ld-2.5.so
-   obj:/lib/ld-2.5.so
-   obj:/lib/ld-2.5.so
-   obj:/lib/ld-2.5.so
-   obj:/lib/i686/cmov/libdl-2.5.so
-   obj:/lib/ld-2.5.so
-   obj:/lib/i686/cmov/libdl-2.5.so
-}
diff --git a/tests/valgrind.supp b/tests/valgrind.supp
deleted file mode 100644 (file)
index 29bb045..0000000
+++ /dev/null
@@ -1,711 +0,0 @@
-### this file contains suppressions for valgrind when running
-### the gibber/telepathy-salut unit tests based on the gstreamer one
-
-### syscall suppressions
-
-{
-   <clone on Wim's Debian>
-   Memcheck:Param
-   clone(parent_tidptr)
-   fun:clone
-   fun:clone
-}
-
-{
-   <clone on Wim's Debian>
-   Memcheck:Param
-   clone(child_tidptr)
-   fun:clone
-   fun:clone
-}
-
-{
-   <clone on Wim's Debian>
-   Memcheck:Param
-   clone(tlsinfo)
-   fun:clone
-   fun:clone
-}
-
-### glibc suppressions
-
-{
-   <conditional jump on wim's debian 2/2/06>
-   Memcheck:Cond
-   obj:/lib/ld-2.3.*.so
-   fun:dl_open_worker
-   obj:/lib/ld-2.3.*.so
-   fun:_dl_open
-   fun:dlopen_doit
-   obj:/lib/ld-2.3.*.so
-   fun:_dlerror_run
-   fun:dlopen@@GLIBC_2.1
-   fun:g_module_open
-}
-
-# glibc does not deallocate thread-local storage
-
-{
-   <tls>
-   Memcheck:Leak
-   fun:calloc
-   fun:_dl_allocate_tls
-   fun:pthread_create@@*
-}
-
-# I get an extra stack entry on x86/dapper
-{
-   <tls>
-   Memcheck:Leak
-   fun:calloc
-   obj:/lib/ld-2.3.*.so
-   fun:_dl_allocate_tls
-   fun:pthread_create@@*
-}
-
-
-{
-   <pthread strstr>
-   Memcheck:Cond
-   fun:strstr
-   fun:__pthread_initialize_minimal
-   obj:/lib/libpthread-*.so
-   obj:/lib/libpthread-*.so
-   fun:call_init
-   fun:_dl_init
-   obj:/lib/ld-*.so
-}
-
-# a thread-related free problem in glibc from Edgard
-{
-   __libc_freeres_rw_acess
-   Memcheck:Addr4
-   obj:*
-   obj:*
-   obj:*
-   obj:*
-   obj:*
-   fun:__libc_freeres
-}
-
-{
-   <a conditional jump on wim's debian>
-   Memcheck:Cond
-   obj:/lib/ld-2.3.*.so
-   obj:/lib/ld-2.3.*.so
-   obj:/lib/ld-2.3.*.so
-   obj:/lib/ld-2.3.*.so
-   obj:/lib/ld-2.3.*.so
-}
-
-# g_module_open-related problems
-{
-   <started showing up on fc4-quick>
-   Memcheck:Addr2
-   fun:memcpy
-   fun:_dl_map_object_deps
-   fun:dl_open_worker
-   fun:_dl_catch_error
-   fun:_dl_open
-   fun:dlopen_doit
-   fun:_dl_catch_error
-   fun:_dlerror_run
-   fun:dlopen@@GLIBC_2.1
-   fun:g_module_open
-}
-
-{
-   <started showing up on fc4-quick>
-   Memcheck:Addr4
-   fun:memcpy
-   fun:_dl_map_object_deps
-   fun:dl_open_worker
-   fun:_dl_catch_error
-   fun:_dl_open
-   fun:dlopen_doit
-   fun:_dl_catch_error
-   fun:_dlerror_run
-   fun:dlopen@@GLIBC_2.1
-   fun:g_module_open
-}
-
-{
-   <g_module_open on wim's debian>
-   Memcheck:Cond
-   obj:/lib/ld-2.3.*.so
-   obj:/lib/ld-2.3.*.so
-   obj:/lib/ld-2.3.*.so
-   fun:do_sym
-   fun:_dl_sym
-   fun:dlsym_doit
-   obj:/lib/ld-2.3.*.so
-   fun:_dlerror_run
-   fun:dlsym
-   fun:g_module_symbol
-   fun:g_module_open
-}
-
-{
-   <g_module_open on wim's debian>
-   Memcheck:Cond
-   obj:/lib/ld-2.3.*.so
-   obj:/lib/ld-2.3.*.so
-   obj:/lib/ld-2.3.*.so
-   fun:dl_open_worker
-   obj:/lib/ld-2.3.*.so
-   fun:_dl_open
-   fun:dlopen_doit
-   obj:/lib/ld-2.3.*.so
-   fun:_dlerror_run
-   fun:dlopen@@GLIBC_2.1
-   fun:g_module_open
-}
-{
-   <g_module_open on wim's debian>
-   Memcheck:Cond
-   obj:/lib/ld-2.3.*.so
-   fun:dl_open_worker
-   obj:/lib/ld-2.3.*.so
-   fun:_dl_open
-   fun:dlopen_doit
-   obj:/lib/ld-2.3.*.so
-   fun:_dlerror_run
-   fun:dlopen@@GLIBC_2.1
-   fun:g_module_open
-}
-
-{
-   <leak on wim's debian in g_module_open>
-   Memcheck:Leak
-   fun:malloc
-   obj:/lib/ld-2.3.*.so
-   fun:dl_open_worker
-   obj:/lib/ld-2.3.*.so
-   fun:_dl_open
-   fun:dlopen_doit
-   obj:/lib/ld-2.3.*.so
-   fun:_dlerror_run
-   fun:dlopen@@GLIBC_2.1
-   fun:g_module_open
-}
-
-{
-   <invalid read on wim's debian>
-   Memcheck:Addr4
-   obj:/lib/ld-2.3.*.so
-   obj:/lib/ld-2.3.*.so
-   obj:/lib/ld-2.3.*.so
-   obj:/lib/ld-2.3.*.so
-   obj:/lib/ld-2.3.*.so
-   obj:/lib/ld-2.3.*.so
-   obj:/lib/ld-2.3.*.so
-   fun:dl_open_worker
-   obj:/lib/ld-2.3.*.so
-   fun:_dl_open
-   fun:dlopen_doit
-   obj:/lib/ld-2.3.*.so
-}
-
-{
-   <invalid read on wim's debian>
-   Memcheck:Addr4
-   obj:/lib/ld-2.3.*.so
-   obj:/lib/ld-2.3.*.so
-   obj:/lib/ld-2.3.*.so
-   obj:/lib/ld-2.3.*.so
-   obj:/lib/ld-2.3.*.so
-   obj:/lib/ld-2.3.*.so
-   fun:dl_open_worker
-   obj:/lib/ld-2.3.*.so
-   fun:_dl_open
-   fun:dlopen_doit
-   obj:/lib/ld-2.3.*.so
-   fun:_dlerror_run
-}
-
-{
-   <invalid read on wim's debian - 2006-02-02>
-   Memcheck:Addr4
-   obj:/lib/ld-2.3.*.so
-   obj:/lib/ld-2.3.*.so
-   obj:/lib/ld-2.3.*.so
-   fun:dl_open_worker
-   obj:/lib/ld-2.3.*.so
-   fun:_dl_open
-   fun:dlopen_doit
-   obj:/lib/ld-2.3.*.so
-   fun:_dlerror_run
-   fun:dlopen@@GLIBC_2.1
-   fun:g_module_open
-}
-
-{
-   <invalid read on wim's debian - 2006-02-02>
-   Memcheck:Addr4
-   obj:/lib/ld-2.3.*.so
-   obj:/lib/ld-2.3.*.so
-   fun:dl_open_worker
-   obj:/lib/ld-2.3.*.so
-   fun:_dl_open
-   fun:dlopen_doit
-   obj:/lib/ld-2.3.*.so
-   fun:_dlerror_run
-   fun:dlopen@@GLIBC_2.1
-   fun:g_module_open
-}
-
-{
-   <invalid read on wim's debian - 2006-02-02>
-   Memcheck:Addr4
-   obj:/lib/ld-2.3.*.so
-   obj:/lib/ld-2.3.*.so
-   obj:/lib/ld-2.3.*.so
-   fun:do_sym
-   fun:_dl_sym
-   fun:dlsym_doit
-   obj:/lib/ld-2.3.*.so
-   fun:_dlerror_run
-   fun:dlsym
-   fun:g_module_symbol
-   fun:g_module_open
-}
-
-{
-   <futex on Andy's 64-bit ubuntu>
-   Memcheck:Param
-   futex(uaddr2)
-   fun:pthread_once
-   obj:/lib/libc-2.3.*.so
-   obj:/lib/libc-2.3.*.so
-   fun:mbsnrtowcs
-   fun:vfprintf
-   fun:vsprintf
-   fun:sprintf
-   obj:/lib/libc-2.3.*.so
-}
-
-# valgrind doesn't allow me to specify a suppression for Addr1, Addr2, Addr4
-# as Addr*, so 3 copies for that; and then 2 of each for that pesky memcpy
-{
-   <Invalid read of size 1, 2, 4 on thomas's FC4>
-   Memcheck:Addr1
-   fun:_dl_signal_error
-   fun:_dl_map_object_deps
-   fun:dl_open_worker
-   fun:_dl_catch_error
-   fun:_dl_open
-   fun:dlopen_doit
-   fun:_dl_catch_error
-   fun:_dlerror_run
-   fun:dlopen@@GLIBC_2.1
-   fun:g_module_open
-}
-
-{
-   <Invalid read of size 1, 2, 4 on thomas's FC4>
-   Memcheck:Addr2
-   fun:_dl_signal_error
-   fun:_dl_map_object_deps
-   fun:dl_open_worker
-   fun:_dl_catch_error
-   fun:_dl_open
-   fun:dlopen_doit
-   fun:_dl_catch_error
-   fun:_dlerror_run
-   fun:dlopen@@GLIBC_2.1
-   fun:g_module_open
-}
-{
-   <Invalid read of size 1, 2, 4 on thomas's FC4>
-   Memcheck:Addr4
-   fun:_dl_signal_error
-   fun:_dl_map_object_deps
-   fun:dl_open_worker
-   fun:_dl_catch_error
-   fun:_dl_open
-   fun:dlopen_doit
-   fun:_dl_catch_error
-   fun:_dlerror_run
-   fun:dlopen@@GLIBC_2.1
-   fun:g_module_open
-}
-
-{
-   <Invalid read of size 1, 2, 4 on thomas's FC4>
-   Memcheck:Addr1
-   fun:memcpy
-   fun:_dl_signal_error
-   fun:_dl_map_object_deps
-   fun:dl_open_worker
-   fun:_dl_catch_error
-   fun:_dl_open
-   fun:dlopen_doit
-   fun:_dl_catch_error
-   fun:_dlerror_run
-   fun:dlopen@@GLIBC_2.1
-   fun:g_module_open
-}
-
-{
-   <Invalid read of size 1, 2, 4 on thomas's FC4>
-   Memcheck:Addr2
-   fun:memcpy
-   fun:_dl_signal_error
-   fun:_dl_map_object_deps
-   fun:dl_open_worker
-   fun:_dl_catch_error
-   fun:_dl_open
-   fun:dlopen_doit
-   fun:_dl_catch_error
-   fun:_dlerror_run
-   fun:dlopen@@GLIBC_2.1
-   fun:g_module_open
-}
-{
-   <Invalid read of size 1, 2, 4 on thomas's FC4>
-   Memcheck:Addr4
-   fun:memcpy
-   fun:_dl_signal_error
-   fun:_dl_map_object_deps
-   fun:dl_open_worker
-   fun:_dl_catch_error
-   fun:_dl_open
-   fun:dlopen_doit
-   fun:_dl_catch_error
-   fun:_dlerror_run
-   fun:dlopen@@GLIBC_2.1
-   fun:g_module_open
-}
-
-{
-   <Addr8 on Andy's AMD64 ubuntu in dl_open>
-   Memcheck:Addr8
-   obj:/lib/ld-2.3.*.so
-   obj:/lib/ld-2.3.*.so
-   obj:/lib/ld-2.3.*.so
-   obj:/lib/ld-2.3.*.so
-   obj:/lib/ld-2.3.*.so
-   obj:/lib/ld-2.3.*.so
-   obj:/lib/ld-2.3.*.so
-   obj:/lib/libc-2.3.*.so
-   obj:/lib/ld-2.3.*.so
-   fun:_dl_open
-   obj:/lib/libdl-2.3.*.so
-   obj:/lib/ld-2.3.*.so
-}
-
-{
-   <Conditional jump on Andy's AMD64 ubuntu>
-   Memcheck:Cond
-   obj:/lib/ld-2.3.*.so
-   obj:/lib/libc-2.3.*.so
-   obj:/lib/ld-2.3.*.so
-   fun:_dl_open
-   obj:/lib/libdl-2.3.*.so
-   obj:/lib/ld-2.3.*.so
-   obj:/lib/libdl-2.3.*.so
-   fun:dlopen
-   fun:g_module_open
-}
-
-{
-   <Mike's x86 dapper>
-   Memcheck:Addr4
-   obj:/lib/ld-2.3.6.so
-   obj:/lib/ld-2.3.6.so
-   obj:/lib/tls/i686/cmov/libc-2.3.6.so
-   obj:/lib/ld-2.3.6.so
-   fun:_dl_open
-   obj:/lib/tls/i686/cmov/libdl-2.3.6.so
-   obj:/lib/ld-2.3.6.so
-   obj:/lib/tls/i686/cmov/libdl-2.3.6.so
-   fun:dlopen
-}
-
-{
-   <Mike's x86 dapper>
-   Memcheck:Cond
-   obj:/lib/ld-2.3.6.so
-   obj:/lib/tls/i686/cmov/libc-2.3.6.so
-   obj:/lib/ld-2.3.6.so
-   fun:_dl_open
-   obj:/lib/tls/i686/cmov/libdl-2.3.6.so
-   obj:/lib/ld-2.3.6.so
-   obj:/lib/tls/i686/cmov/libdl-2.3.6.so
-   fun:dlopen
-}
-
-{
-   <Another dapper one>
-   Memcheck:Cond
-   obj:/lib/ld-2.3.6.so
-   obj:/lib/ld-2.3.6.so
-   obj:/lib/ld-2.3.6.so
-   obj:/lib/tls/i686/cmov/libc-2.3.6.so
-   obj:/lib/ld-2.3.6.so
-   fun:_dl_open
-   obj:/lib/tls/i686/cmov/libdl-2.3.6.so
-   obj:/lib/ld-2.3.6.so
-   obj:/lib/tls/i686/cmov/libdl-2.3.6.so
-   fun:dlopen
-}
-
-### glib suppressions
-{
-   <g_parse_debug_string>
-   Memcheck:Cond
-   fun:g_parse_debug_string
-   obj:/usr/lib*/libglib-2.0.so.*
-   fun:g_slice_alloc
-   fun:g_slice_alloc0
-}
-
-{
-   <g_type_init malloc>
-   Memcheck:Leak
-   fun:malloc
-   fun:g_malloc
-   fun:g_strdup
-   fun:g_quark_from_string
-   obj:*
-   obj:*
-   fun:g_type_register_fundamental
-   obj:*
-   fun:g_type_init_with_debug_flags
-   fun:g_type_init
-}
-
-{
-   <g_type_init calloc>
-   Memcheck:Leak
-   fun:calloc
-   fun:g_malloc0
-   obj:*
-   obj:*
-   fun:g_type_register_fundamental
-}
-
-{
-   <g_type_init calloc 2>
-   Memcheck:Leak
-   fun:calloc
-   fun:g_malloc0
-   obj:*
-   obj:*
-   fun:g_type_init_with_debug_flags
-}
-
-{
-   <g_type_init calloc 3, GSlice version>
-   Memcheck:Leak
-   fun:calloc
-   fun:g_malloc0
-   fun:g_slice_alloc
-   obj:*
-   obj:*
-   fun:g_type_init_with_debug_flags
-}
-
-#pthread memleaks
-
-{
-   Thread creation leak
-   Memcheck:Leak
-   fun:calloc
-   fun:allocate_dtv
-   fun:_dl_allocate*
-   fun:_dl_allocate*
-   fun:__pthread_initialize_minimal
-}
-
-{
-   Thread management leak
-   Memcheck:Leak
-   fun:calloc
-   fun:allocate_dtv
-   fun:_dl_allocate*
-   fun:_dl_allocate*
-   fun:__pthread_*
-}
-
-{
-   Thread management leak 2
-   Memcheck:Leak
-   fun:memalign
-   fun:_dl_allocate*
-   fun:_dl_allocate*
-   fun:__pthread_*
-}
-
-{
-   pthread_create Syscall param write(buf) points to uninitialised byte(s)
-   Memcheck:Param
-   write(buf)
-   fun:pthread_create@@GLIBC_2.2.5
-   fun:g_thread_create*
-
-}
-
-# nss_parse_* memleak (used by g_option_context_parse)
-{
-   nss_parse_* memleak
-   Memcheck:Leak
-   fun:malloc
-   fun:nss_parse_service_list
-   fun:__nss_database_lookup
-}
-
-{
-   <annoying read error inside dlopen stuff on Ubuntu Dapper x86_64>
-   Memcheck:Addr8
-   obj:/lib/ld-2.3.6.so
-}
-
-{
-   <Ubuntu Dapper x86_64>
-   Memcheck:Param
-   futex(uaddr2)
-   fun:pthread_once
-   obj:/lib/libc-2.3.6.so
-   obj:/lib/libc-2.3.6.so
-   fun:setlocale
-   fun:init_pre
-   fun:g_option_context_parse
-}
-
-{
-   <Ubuntu Dapper x86_64 dlopen stuff again>
-   Memcheck:Cond
-   obj:/lib/ld-2.3.6.so
-   obj:/lib/ld-2.3.6.so
-   fun:_dl_open
-   obj:/lib/libdl-2.3.6.so
-   obj:/lib/ld-2.3.6.so
-   obj:/lib/libdl-2.3.6.so
-   fun:dlopen
-   fun:g_module_open
-}
-# this exists in a bunch of different variations, hence the short tail/trace
-{
-   <dlopen invalid read of size 4 suppression on tpm's Ubuntu edgy/x86>
-   Memcheck:Addr4
-   obj:/lib/ld-2.4.so
-   obj:/lib/ld-2.4.so
-}
-{
-   <and the same for 64bit systems>
-   Memcheck:Addr8
-   obj:/lib/ld-2.4.so
-   obj:/lib/ld-2.4.so
-}
-
-# More edgy suppressions (Mike)
-{  
-   <dlopen Condition jump suppressions for Ubuntu Edgy/x86>
-   Memcheck:Cond
-   obj:/lib/ld-2.4.so
-   obj:/lib/ld-2.4.so
-   obj:/lib/ld-2.4.so
-   obj:/lib/ld-2.4.so
-   fun:dlopen_doit
-   obj:/lib/ld-2.4.so
-   fun:_dlerror_run
-   fun:dlopen@@GLIBC_2.1
-}
-
-{  
-   <dlopen Condition jump suppressions for Ubuntu Edgy/x86>
-   Memcheck:Cond
-   obj:/lib/ld-2.4.so
-   obj:/lib/ld-2.4.so
-   obj:/lib/ld-2.4.so
-   obj:/lib/ld-2.4.so
-   obj:/lib/ld-2.4.so
-   obj:/lib/ld-2.4.so
-   fun:dlopen_doit
-   obj:/lib/ld-2.4.so
-   fun:_dlerror_run
-   fun:dlopen@@GLIBC_2.1
-}
-
-{  
-   <dlopen Condition jump suppressions for Ubuntu Edgy/x86>
-   Memcheck:Cond
-   obj:/lib/ld-2.4.so
-   obj:/lib/ld-2.4.so
-   obj:/lib/ld-2.4.so
-   fun:do_sym
-   fun:_dl_sym
-}
-
-# This one's overly general, but there's zero other information in the stack
-# trace - just these five lines!
-{  
-   <dlopen Condition jump suppressions for Ubuntu Edgy/x86>
-   Memcheck:Cond
-   obj:/lib/ld-2.4.so
-   obj:/lib/ld-2.4.so
-   obj:/lib/ld-2.4.so
-   obj:/lib/ld-2.4.so
-   obj:/lib/ld-2.4.so
-}
-
-{
-   <tls leaks on Edgy/x86>
-   Memcheck:Leak
-   fun:calloc
-   obj:/lib/ld-2.4.so
-   fun:_dl_allocate_tls
-   fun:pthread_create@@GLIBC_2.1
-}
-
-{
-   <libcdio 0.76 leak>
-   Memcheck:Leak
-   fun:calloc
-   obj:/usr/lib/libcdio.so.6.0.1
-   fun:cdio_open_am_linux
-   obj:/usr/lib/libcdio.so.6.0.1
-   fun:cdio_open_am
-}
-
-# TLS leaks for feisty/x86
-{
-   <tls leaks on Feisty/x86>
-   Memcheck:Leak
-   fun:calloc
-   fun:allocate_dtv
-   fun:_dl_allocate_tls
-   fun:pthread_create@@GLIBC_2.1
-}
-
-{
-   <Addr8 on Jan's AMD64 ubuntu Feisty in dl_open>
-   Memcheck:Addr8
-   obj:/lib/ld-2.5.so
-}
-
-{
-   <GLib caching the home dir>
-   Memcheck:Leak
-   fun:malloc
-   obj:/lib/libc-*.so
-   fun:__nss_database_lookup
-   obj:*
-   obj:*
-   fun:getpwnam_r
-   fun:g_get_any_init_do
-   fun:g_get_home_dir
-}
-{
-   <GLib caching the user name>
-   Memcheck:Leak
-   fun:malloc
-   obj:/lib/libc-*.so
-   fun:__nss_database_lookup
-   obj:*
-   obj:*
-   fun:getpwnam_r
-   fun:g_get_any_init_do
-   fun:g_get_user_name
-}