aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@src.gnome.org>2007-12-29 23:58:47 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2007-12-29 23:58:47 +0800
commite4358acdec7b8c278a1950a3da24bab387a0e7b3 (patch)
tree9a15f253d9c45a90a8794143ecdd854650d58af1
parentb8607414ea0e41c44a09d31ebcd0437a3c867a24 (diff)
downloadgsoc2013-empathy-e4358acdec7b8c278a1950a3da24bab387a0e7b3.tar
gsoc2013-empathy-e4358acdec7b8c278a1950a3da24bab387a0e7b3.tar.gz
gsoc2013-empathy-e4358acdec7b8c278a1950a3da24bab387a0e7b3.tar.bz2
gsoc2013-empathy-e4358acdec7b8c278a1950a3da24bab387a0e7b3.tar.lz
gsoc2013-empathy-e4358acdec7b8c278a1950a3da24bab387a0e7b3.tar.xz
gsoc2013-empathy-e4358acdec7b8c278a1950a3da24bab387a0e7b3.tar.zst
gsoc2013-empathy-e4358acdec7b8c278a1950a3da24bab387a0e7b3.zip
Revert "merge git work"
This reverts commit 0cfd80847f0d66967f56c7d6b3eb46793f725859. svn path=/trunk/; revision=519
-rw-r--r--.gitignore5
-rw-r--r--Makefile.am13
-rw-r--r--TODO1
-rw-r--r--configure.ac146
-rw-r--r--libempathy-gtk/Makefile.am10
-rw-r--r--libempathy-gtk/empathy-call-window.c23
-rw-r--r--libempathy-gtk/empathy-call-window.h2
-rw-r--r--libempathy-gtk/empathy-chat-view.c54
-rw-r--r--libempathy-gtk/empathy-contact-list-view.c36
-rw-r--r--libempathy-gtk/empathy-group-chat.glade302
-rw-r--r--libempathy-gtk/empathy-theme-boxes.c332
-rw-r--r--libempathy-gtk/empathy-theme-boxes.h4
-rw-r--r--libempathy-gtk/empathy-theme-irc.c270
-rw-r--r--libempathy-gtk/empathy-theme-manager.c146
-rw-r--r--libempathy-gtk/empathy-theme-utils.c90
-rw-r--r--libempathy-gtk/empathy-theme-utils.h40
-rw-r--r--libempathy-gtk/empathy-theme.c87
-rw-r--r--libempathy-gtk/empathy-theme.h119
-rw-r--r--libempathy-gtk/empathy-ui-utils.c48
-rw-r--r--libempathy-gtk/empathy-ui-utils.h7
-rw-r--r--m4/.gitignore2
-rw-r--r--m4/acinclude.m4 (renamed from acinclude.m4)0
-rw-r--r--m4/empathy-args.m419
-rw-r--r--m4/empathy-valgrind.m431
-rw-r--r--po/.gitignore1
-rw-r--r--po/POTFILES.in3
-rw-r--r--rules/check.mak120
-rw-r--r--src/.gitignore2
-rw-r--r--src/empathy-call-chandler.c19
-rw-r--r--src/empathy-chat-chandler.c15
-rw-r--r--svn2cl.xsl295
-rw-r--r--tests/.gitignore3
-rw-r--r--tests/Makefile.am25
-rw-r--r--tests/check-empathy-utils.c29
-rw-r--r--tests/check-helpers.c63
-rw-r--r--tests/check-helpers.h43
-rw-r--r--tests/check-libempathy.h6
-rw-r--r--tests/check-main.c40
-rw-r--r--tests/dlopen.supp127
-rw-r--r--tests/valgrind.supp711
40 files changed, 1902 insertions, 1387 deletions
diff --git a/.gitignore b/.gitignore
index 267834268..1fdf7e79f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,13 +5,14 @@ Makefile.in
Makefile
.deps
.libs
-*.swp
+*.sw[po]
*enum-types*
*.pc
*.tar.*
*.orig
*.rej
*.bak
+*~
ChangeLog
stamp-h1
@@ -23,6 +24,7 @@ config.h
config.h.in
config.log
config.status
+config.status.lineno
config.sub
configure
depcomp
@@ -35,3 +37,4 @@ ltmain.sh
missing
mkinstalldirs
omf.make
+compile
diff --git a/Makefile.am b/Makefile.am
index 4256f0f86..2d207666b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -33,6 +33,7 @@ EXTRA_DIST = \
$(INTLTOOL)
DISTCLEANFILES = \
+ ChangeLog \
intltool-extract \
intltool-merge \
intltool-update
@@ -41,15 +42,9 @@ DISTCLEANFILES = \
# uninstall.
distuninstallcheck_listfiles = find . -type f -print | grep -v '^\./var/scrollkeeper'
-# 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
+ChangeLog: Makefile.am
+ git-log --pretty=short > ChangeLog
+
dist: ChangeLog
diff --git a/TODO b/TODO
index 937147b61..187f6191e 100644
--- a/TODO
+++ b/TODO
@@ -13,7 +13,6 @@ 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/configure.ac b/configure.ac
index 663306638..76a34cd83 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5,17 +5,6 @@ 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)
@@ -35,18 +24,7 @@ AC_SUBST(LIBEMPATHY_GTK_CURRENT)
AC_SUBST(LIBEMPATHY_GTK_AGE)
AC_SUBST(LIBEMPATHY_GTK_REVISION)
-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])
-
+# Minimal version required
GLIB_REQUIRED=2.14.0
GTK_REQUIRED=2.12.0
GCONF_REQUIRED=1.2.0
@@ -56,37 +34,34 @@ TELEPATHY_REQUIRED=0.3.1
TELEPATHY_GLIB_REQUIRED=0.7.0
MISSION_CONTROL_REQUIRED=4.37
-IDT_COMPILE_WARNINGS
-
-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])
+# 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
GLIB_GENMARSHAL=`$PKG_CONFIG glib-2.0 --variable=glib_genmarshal`
AC_SUBST(GLIB_GENMARSHAL)
-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-Config dependency checks
+# -----------------------------------------------------------
PKG_CHECK_MODULES(LIBEMPATHY,
[
@@ -115,9 +90,19 @@ PKG_CHECK_MODULES(EMPATHY,
libebook-1.2
])
-dnl -----------------------------------------------------------
-dnl ISO codes, used for aspell support
-dnl -----------------------------------------------------------
+# -----------------------------------------------------------
+# 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
+# -----------------------------------------------------------
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])
@@ -133,9 +118,9 @@ fi
AC_DEFINE_UNQUOTED([ISO_CODES_PREFIX],["$iso_codes_prefix"],[ISO codes prefix])
-dnl -----------------------------------------------------------
-dnl ASpell
-dnl -----------------------------------------------------------
+# -----------------------------------------------------------
+# ASpell
+# -----------------------------------------------------------
AC_ARG_ENABLE(aspell,
AS_HELP_STRING([--enable-aspell=@<:@no/yes/auto@:>@],
[compile with aspell support]), ,
@@ -163,9 +148,9 @@ if test "x$enable_aspell" = "xyes" -a "x$have_aspell" != "xyes"; then
fi
-dnl -----------------------------------------------------------
-dnl Megaphone
-dnl -----------------------------------------------------------
+# -----------------------------------------------------------
+# Megaphone
+# -----------------------------------------------------------
AC_ARG_ENABLE(megaphone,
AS_HELP_STRING([--enable-megaphone=@<:@no/yes/auto@:>@],
[build megaphone applet]), ,
@@ -193,9 +178,9 @@ fi
AM_CONDITIONAL(HAVE_MEGAPHONE, test "x$have_megaphone" = "xyes")
-dnl -----------------------------------------------------------
-dnl Nothere
-dnl -----------------------------------------------------------
+# -----------------------------------------------------------
+# Nothere
+# -----------------------------------------------------------
AC_ARG_ENABLE(nothere,
AS_HELP_STRING([--enable-nothere=@<:@no/yes/auto@:>@],
[build nothere applet]), ,
@@ -222,19 +207,32 @@ fi
AM_CONDITIONAL(HAVE_NOTHERE, test "x$have_nothere" = "xyes")
-dnl -----------------------------------------------------------
-dnl Tests
-dnl -----------------------------------------------------------
+# -----------------------------------------------------------
+# Tests
+# -----------------------------------------------------------
AC_ARG_ENABLE(tests,
- AS_HELP_STRING([--enable-tests=@<:@no/yes@:>@],
+ AS_HELP_STRING([--enable-tests=@<:@no/yes/auto@:>@],
[build tests]), ,
enable_tests=no)
-AM_CONDITIONAL(HAVE_TESTS, test "x$enable_tests" = "xyes")
+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")
-dnl -----------------------------------------------------------
-dnl Python Bindings
-dnl -----------------------------------------------------------
+# -----------------------------------------------------------
+# Python Bindings
+# -----------------------------------------------------------
AC_ARG_ENABLE(python,
AS_HELP_STRING([--enable-python=@<:@no/yes/auto@:>@],
[build python bindings to libempathy and libempathy-gtk]), ,
@@ -269,9 +267,9 @@ fi
AM_CONDITIONAL(HAVE_PYTHON, test "x$have_python" = "xyes")
-dnl -----------------------------------------------------------
-dnl VoIP support
-dnl -----------------------------------------------------------
+# -----------------------------------------------------------
+# VoIP support
+# -----------------------------------------------------------
AC_ARG_ENABLE(voip,
AS_HELP_STRING([--enable-voip=@<:@no/yes@:>@],
[Add support for Voice and Video call]), ,
@@ -283,7 +281,7 @@ fi
AM_CONDITIONAL(HAVE_VOIP, test "x$enable_voip" = "xyes")
-dnl -----------------------------------------------------------
+# -----------------------------------------------------------
AC_OUTPUT([
Makefile
diff --git a/libempathy-gtk/Makefile.am b/libempathy-gtk/Makefile.am
index 494e3c4ce..07336f55c 100644
--- a/libempathy-gtk/Makefile.am
+++ b/libempathy-gtk/Makefile.am
@@ -32,11 +32,10 @@ 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 \
@@ -89,11 +88,10 @@ 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 \
diff --git a/libempathy-gtk/empathy-call-window.c b/libempathy-gtk/empathy-call-window.c
index baa169755..a1c7bd799 100644
--- a/libempathy-gtk/empathy-call-window.c
+++ b/libempathy-gtk/empathy-call-window.c
@@ -24,6 +24,7 @@
#include "config.h"
#include <gtk/gtk.h>
+#include <glib/gi18n.h>
#include <libempathy/empathy-debug.h>
@@ -104,6 +105,20 @@ call_window_capabilities_notify_cb (EmpathyContact *contact,
}
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,
EmpathyCallWindow *window)
@@ -124,7 +139,11 @@ 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);
}
}
@@ -142,7 +161,7 @@ call_window_destroy_cb (GtkWidget *widget,
g_slice_free (EmpathyCallWindow, window);
}
-void
+GtkWidget *
empathy_call_window_show (EmpathyTpCall *call)
{
EmpathyCallWindow *window;
@@ -194,5 +213,7 @@ empathy_call_window_show (EmpathyTpCall *call)
window);
gtk_widget_show (window->window);
+
+ return window->window;
}
diff --git a/libempathy-gtk/empathy-call-window.h b/libempathy-gtk/empathy-call-window.h
index ea310d622..c8c6d7f0e 100644
--- a/libempathy-gtk/empathy-call-window.h
+++ b/libempathy-gtk/empathy-call-window.h
@@ -28,7 +28,7 @@
G_BEGIN_DECLS
-void empathy_call_window_show (EmpathyTpCall *call);
+GtkWidget * empathy_call_window_show (EmpathyTpCall *call);
G_END_DECLS
diff --git a/libempathy-gtk/empathy-chat-view.c b/libempathy-gtk/empathy-chat-view.c
index 947281590..c7428e9df 100644
--- a/libempathy-gtk/empathy-chat-view.c
+++ b/libempathy-gtk/empathy-chat-view.c
@@ -68,7 +68,6 @@ struct _EmpathyChatViewPriv {
GtkTextBuffer *buffer;
EmpathyTheme *theme;
- gpointer theme_context;
time_t last_timestamp;
BlockType last_block_type;
@@ -130,7 +129,8 @@ 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_updated_cb (EmpathyTheme *theme,
+static void chat_view_theme_notify_cb (EmpathyTheme *theme,
+ GParamSpec *param,
EmpathyChatView *view);
G_DEFINE_TYPE (EmpathyChatView, empathy_chat_view, GTK_TYPE_TEXT_VIEW);
@@ -233,12 +233,8 @@ chat_view_finalize (GObject *object)
if (priv->theme) {
g_signal_handlers_disconnect_by_func (priv->theme,
- chat_view_theme_updated_cb,
+ chat_view_theme_notify_cb,
view);
-
- empathy_theme_detach_from_view (priv->theme, priv->theme_context,
- view);
-
g_object_unref (priv->theme);
}
@@ -796,8 +792,7 @@ empathy_chat_view_append_message (EmpathyChatView *view,
chat_view_maybe_trim_buffer (view);
- empathy_theme_append_message (priv->theme, priv->theme_context,
- view, msg);
+ empathy_theme_append_message (priv->theme, view, msg);
if (bottom) {
empathy_chat_view_scroll_down (view);
@@ -820,9 +815,7 @@ empathy_chat_view_append_event (EmpathyChatView *view,
chat_view_maybe_trim_buffer (view);
- empathy_theme_append_event (priv->theme,
- priv->theme_context,
- view, str);
+ empathy_theme_append_event (priv->theme, view, str);
if (bottom) {
empathy_chat_view_scroll_down (view);
@@ -852,13 +845,10 @@ empathy_chat_view_append_button (EmpathyChatView *view,
bottom = chat_view_is_scrolled_down (view);
- empathy_theme_append_timestamp (priv->theme, priv->theme_context,
- view, NULL,
- TRUE, TRUE);
+ empathy_theme_append_timestamp (priv->theme, view, NULL, TRUE, TRUE);
if (message) {
- empathy_theme_append_text (priv->theme, priv->theme_context,
- view, message, tag, NULL);
+ empathy_theme_append_text (priv->theme, view, message, tag, NULL);
}
gtk_text_buffer_get_end_iter (priv->buffer, &iter);
@@ -1006,8 +996,6 @@ 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;
}
@@ -1370,16 +1358,11 @@ empathy_chat_view_get_theme (EmpathyChatView *view)
}
static void
-chat_view_theme_updated_cb (EmpathyTheme *theme, EmpathyChatView *view)
+chat_view_theme_notify_cb (EmpathyTheme *theme,
+ GParamSpec *param,
+ EmpathyChatView *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);
+ empathy_theme_update_view (theme, view);
}
void
@@ -1394,24 +1377,19 @@ empathy_chat_view_set_theme (EmpathyChatView *view, EmpathyTheme *theme)
if (priv->theme) {
g_signal_handlers_disconnect_by_func (priv->theme,
- chat_view_theme_updated_cb,
+ chat_view_theme_notify_cb,
view);
- empathy_theme_detach_from_view (priv->theme, priv->theme_context,
- view);
-
g_object_unref (priv->theme);
}
priv->theme = g_object_ref (theme);
- g_signal_connect (priv->theme,
- "updated",
- G_CALLBACK (chat_view_theme_updated_cb),
+ empathy_theme_update_view (theme, view);
+ g_signal_connect (priv->theme, "notify",
+ G_CALLBACK (chat_view_theme_notify_cb),
view);
- priv->theme_context = empathy_theme_setup_with_view (theme, view);
-
- /* FIXME: Possibly redraw the function and make it a property */
+ /* FIXME: Redraw all messages using the new theme */
}
void
diff --git a/libempathy-gtk/empathy-contact-list-view.c b/libempathy-gtk/empathy-contact-list-view.c
index 73afd299a..9b6a98a6a 100644
--- a/libempathy-gtk/empathy-contact-list-view.c
+++ b/libempathy-gtk/empathy-contact-list-view.c
@@ -1034,27 +1034,21 @@ contact_list_view_cell_set_background (EmpathyContactListView *view,
style = gtk_widget_get_style (GTK_WIDGET (view));
- 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);
- }
+ 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);
} else {
g_object_set (cell,
"cell-background-gdk", NULL,
diff --git a/libempathy-gtk/empathy-group-chat.glade b/libempathy-gtk/empathy-group-chat.glade
index 5cb6fc3ef..5b40dc375 100644
--- a/libempathy-gtk/empathy-group-chat.glade
+++ b/libempathy-gtk/empathy-group-chat.glade
@@ -1,183 +1,123 @@
-<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
-<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
-
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
+<!--*- mode: xml -*-->
<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="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>
-
+ <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>
</glade-interface>
diff --git a/libempathy-gtk/empathy-theme-boxes.c b/libempathy-gtk/empathy-theme-boxes.c
index 2905f2bec..87eac87d5 100644
--- a/libempathy-gtk/empathy-theme-boxes.c
+++ b/libempathy-gtk/empathy-theme-boxes.c
@@ -29,7 +29,6 @@
#include "empathy-ui-utils.h"
#include "empathy-main-window.h"
-#include "empathy-theme-utils.h"
#include "empathy-theme-boxes.h"
#define DEBUG_DOMAIN "FancyTheme"
@@ -66,32 +65,20 @@ static void theme_boxes_set_property (GObject *object,
GParamSpec *pspec);
static void theme_boxes_define_theme_tags (EmpathyTheme *theme,
EmpathyChatView *view);
-static EmpathyThemeContext *
-theme_boxes_setup_with_view (EmpathyTheme *theme,
+static void theme_boxes_update_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 {
@@ -129,9 +116,7 @@ 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->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->update_view = theme_boxes_update_view;
theme_class->append_message = theme_boxes_append_message;
theme_class->append_event = theme_boxes_append_event;
theme_class->append_timestamp = theme_boxes_append_timestamp;
@@ -310,9 +295,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;
@@ -322,46 +307,57 @@ 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);
@@ -373,53 +369,42 @@ static void
theme_boxes_define_theme_tags (EmpathyTheme *theme, EmpathyChatView *view)
{
EmpathyThemeBoxesPriv *priv;
- GtkTextBuffer *buffer;
- GtkTextTagTable *table;
- GtkTextTag *tag;
+ GtkTextBuffer *buffer;
+ GtkTextTag *tag;
priv = GET_PRIV (theme);
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
- 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);
+
+ 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);
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_theme_utils_init_tag_by_name (table, "fancy-header-line");
- g_object_set (tag,
- "size", 1,
- NULL);
+ tag = empathy_text_buffer_tag_set (buffer, "fancy-header-line",
+ "size", 1,
+ NULL);
if (priv->header_line_background) {
g_object_set (tag,
"paragraph-background", priv->header_line_background,
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);
+ tag = empathy_text_buffer_tag_set (buffer, "fancy-body",
+ "pixels-above-lines", 4,
+ NULL);
if (priv->text_background) {
g_object_set (tag,
"paragraph-background", priv->text_background,
@@ -431,13 +416,11 @@ theme_boxes_define_theme_tags (EmpathyTheme *theme, EmpathyChatView *view)
"foreground", priv->text_foreground,
NULL);
}
- empathy_theme_utils_add_tag (table, tag);
- tag = empathy_theme_utils_init_tag_by_name (table, "fancy-action");
- g_object_set (tag,
- "style", PANGO_STYLE_ITALIC,
- "pixels-above-lines", 4,
- NULL);
+ tag = empathy_text_buffer_tag_set (buffer, "fancy-action",
+ "style", PANGO_STYLE_ITALIC,
+ "pixels-above-lines", 4,
+ NULL);
if (priv->text_background) {
g_object_set (tag,
@@ -449,16 +432,12 @@ 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_theme_utils_init_tag_by_name (table,
- "fancy-highlight");
- g_object_set (tag,
- "weight", PANGO_WEIGHT_BOLD,
- "pixels-above-lines", 4,
- NULL);
+ tag = empathy_text_buffer_tag_set (buffer, "fancy-highlight",
+ "weight", PANGO_WEIGHT_BOLD,
+ "pixels-above-lines", 4,
+ NULL);
if (priv->text_background) {
g_object_set (tag,
"paragraph-background", priv->text_background,
@@ -471,106 +450,55 @@ theme_boxes_define_theme_tags (EmpathyTheme *theme, EmpathyChatView *view)
"foreground", priv->highlight_foreground,
NULL);
}
- empathy_theme_utils_add_tag (table, tag);
- tag = empathy_theme_utils_init_tag_by_name (table, "fancy-time");
- g_object_set (tag,
- "justification", GTK_JUSTIFY_CENTER,
- NULL);
+ tag = empathy_text_buffer_tag_set (buffer, "fancy-time",
+ "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_theme_utils_init_tag_by_name (table, "fancy-event");
- g_object_set (tag,
- "justification", GTK_JUSTIFY_LEFT,
- NULL);
+ tag = empathy_text_buffer_tag_set (buffer, "fancy-event",
+ "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_theme_utils_init_tag_by_name (table, "invite");
+ tag = empathy_text_buffer_tag_set (buffer, "invite", NULL);
if (priv->invite_foreground) {
g_object_set (tag,
"foreground", priv->invite_foreground,
NULL);
}
- empathy_theme_utils_add_tag (table, tag);
- tag = empathy_theme_utils_init_tag_by_name (table, "fancy-link");
- g_object_set (tag,
- "underline", PANGO_UNDERLINE_SINGLE,
- NULL);
+ tag = empathy_text_buffer_tag_set (buffer, "fancy-link",
+ "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_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)
+theme_boxes_update_view (EmpathyTheme *theme, EmpathyChatView *view)
{
EmpathyThemeBoxesPriv *priv;
- g_return_val_if_fail (EMPATHY_IS_THEME_BOXES (theme), NULL);
+ g_return_if_fail (EMPATHY_IS_THEME_BOXES (theme));
+ g_return_if_fail (EMPATHY_IS_CHAT_VIEW (view));
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
@@ -595,7 +523,6 @@ table_size_allocate_cb (GtkWidget *view,
static void
theme_boxes_maybe_append_header (EmpathyTheme *theme,
- EmpathyThemeContext *context,
EmpathyChatView *view,
EmpathyMessage *msg)
{
@@ -654,7 +581,7 @@ theme_boxes_maybe_append_header (EmpathyTheme *theme,
return;
}
- empathy_theme_append_spacing (theme, context, view);
+ empathy_theme_append_spacing (theme, view);
gtk_text_buffer_get_end_iter (buffer, &iter);
gtk_text_buffer_insert_with_tags_by_name (buffer,
@@ -693,7 +620,8 @@ theme_boxes_maybe_append_header (EmpathyTheme *theme,
"xalign", 0.0,
NULL);
- parse_success = gdk_color_parse (priv->header_foreground, &color);
+ parse_success = priv->header_foreground &&
+ gdk_color_parse (priv->header_foreground, &color);
if (parse_success) {
gtk_widget_modify_fg (label1, GTK_STATE_NORMAL, &color);
@@ -757,14 +685,13 @@ 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, context, view, message);
- theme_boxes_maybe_append_header (theme, context, view, message);
+ empathy_theme_maybe_append_date_and_time (theme, view, message);
+ theme_boxes_maybe_append_header (theme, view, message);
sender = empathy_message_get_sender (message);
@@ -774,10 +701,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, context, view, body,
+ empathy_theme_append_text (theme, view, body,
"fancy-action", "fancy-link");
} else {
- empathy_theme_append_text (theme, context, view,
+ empathy_theme_append_text (theme, view,
empathy_message_get_body (message),
"fancy-body", "fancy-link");
}
@@ -793,7 +720,6 @@ theme_boxes_append_message (EmpathyTheme *theme,
static void
theme_boxes_append_event (EmpathyTheme *theme,
- EmpathyThemeContext *context,
EmpathyChatView *view,
const gchar *str)
{
@@ -803,7 +729,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, context, view, NULL);
+ empathy_theme_maybe_append_date_and_time (theme, view, NULL);
gtk_text_buffer_get_end_iter (buffer, &iter);
@@ -820,7 +746,6 @@ theme_boxes_append_event (EmpathyTheme *theme,
static void
theme_boxes_append_timestamp (EmpathyTheme *theme,
- EmpathyThemeContext *context,
EmpathyChatView *view,
EmpathyMessage *message,
gboolean show_date,
@@ -843,9 +768,7 @@ theme_boxes_append_timestamp (EmpathyTheme *theme,
str = g_string_new (NULL);
if (show_time || show_date) {
- empathy_theme_append_spacing (theme,
- context,
- view);
+ empathy_theme_append_spacing (theme, view);
g_string_append (str, "- ");
}
@@ -891,7 +814,6 @@ theme_boxes_append_timestamp (EmpathyTheme *theme,
static void
theme_boxes_append_spacing (EmpathyTheme *theme,
- EmpathyThemeContext *context,
EmpathyChatView *view)
{
GtkTextBuffer *buffer;
@@ -912,125 +834,3 @@ 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;
-}
-
-
diff --git a/libempathy-gtk/empathy-theme-boxes.h b/libempathy-gtk/empathy-theme-boxes.h
index a54283693..b1f0033f3 100644
--- a/libempathy-gtk/empathy-theme-boxes.h
+++ b/libempathy-gtk/empathy-theme-boxes.h
@@ -45,9 +45,7 @@ struct _EmpathyThemeBoxesClass {
EmpathyThemeClass parent_class;
};
-GType empathy_theme_boxes_get_type (void) G_GNUC_CONST;
-
-EmpathyTheme * empathy_theme_boxes_new (const gchar *name);
+GType empathy_theme_boxes_get_type (void) G_GNUC_CONST;
G_END_DECLS
diff --git a/libempathy-gtk/empathy-theme-irc.c b/libempathy-gtk/empathy-theme-irc.c
index afe71e5ea..7cd9588bb 100644
--- a/libempathy-gtk/empathy-theme-irc.c
+++ b/libempathy-gtk/empathy-theme-irc.c
@@ -24,7 +24,7 @@
#include <libempathy/empathy-debug.h>
#include "empathy-chat.h"
-#include "empathy-theme-utils.h"
+#include "empathy-ui-utils.h"
#include "empathy-theme-irc.h"
#define DEBUG_DOMAIN "Theme"
@@ -37,37 +37,21 @@ struct _EmpathyThemeIrcPriv {
gint my_prop;
};
-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,
+static void theme_irc_finalize (GObject *object);
+static void theme_irc_update_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);
@@ -88,25 +72,13 @@ 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->setup_with_view = theme_irc_setup_with_view;
- theme_class->detach_from_view = theme_irc_detach_from_view;
+ theme_class->update_view = theme_irc_update_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));
}
@@ -129,183 +101,82 @@ theme_irc_finalize (GObject *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;
- GtkTextTagTable *table;
- GtkTextTag *tag;
+ GtkTextBuffer *buffer;
priv = GET_PRIV (theme);
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
- 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);
+
+ 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);
}
-static EmpathyThemeContext *
-theme_irc_setup_with_view (EmpathyTheme *theme, EmpathyChatView *view)
+static void
+theme_irc_update_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)
{
@@ -317,7 +188,7 @@ theme_irc_append_message (EmpathyTheme *theme,
gchar *tmp;
EmpathyContact *contact;
- empathy_theme_maybe_append_date_and_time (theme, context, view, message);
+ empathy_theme_maybe_append_date_and_time (theme, view, message);
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
@@ -334,7 +205,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, context, view, tmp,
+ empathy_theme_append_text (theme, view, tmp,
body_tag, "irc-link");
g_free (tmp);
return;
@@ -367,14 +238,13 @@ theme_irc_append_message (EmpathyTheme *theme,
g_free (tmp);
/* The text body. */
- empathy_theme_append_text (theme, context, view,
+ empathy_theme_append_text (theme, 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)
{
@@ -384,7 +254,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, context, view, NULL);
+ empathy_theme_maybe_append_date_and_time (theme, view, NULL);
gtk_text_buffer_get_end_iter (buffer, &iter);
@@ -398,7 +268,6 @@ theme_irc_append_event (EmpathyTheme *theme,
static void
theme_irc_append_timestamp (EmpathyTheme *theme,
- EmpathyThemeContext *context,
EmpathyChatView *view,
EmpathyMessage *message,
gboolean show_date,
@@ -417,9 +286,7 @@ theme_irc_append_timestamp (EmpathyTheme *theme,
str = g_string_new (NULL);
if (show_time || show_date) {
- empathy_theme_append_spacing (theme,
- context,
- view);
+ empathy_theme_append_spacing (theme, view);
g_string_append (str, "- ");
}
@@ -463,7 +330,6 @@ theme_irc_append_timestamp (EmpathyTheme *theme,
static void
theme_irc_append_spacing (EmpathyTheme *theme,
- EmpathyThemeContext *context,
EmpathyChatView *view)
{
GtkTextBuffer *buffer;
diff --git a/libempathy-gtk/empathy-theme-manager.c b/libempathy-gtk/empathy-theme-manager.c
index 6feea2fc4..6bece7506 100644
--- a/libempathy-gtk/empathy-theme-manager.c
+++ b/libempathy-gtk/empathy-theme-manager.c
@@ -50,7 +50,7 @@ typedef struct {
EmpathyTheme *blue_theme;
EmpathyTheme *classic_theme;
- gboolean irc_style;
+ GtkSettings *settings;
} EmpathyThemeManagerPriv;
static void theme_manager_finalize (GObject *object);
@@ -85,6 +85,114 @@ 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)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
@@ -138,9 +246,39 @@ empathy_theme_manager_init (EmpathyThemeManager *manager)
EMPATHY_PREFS_UI_SHOW_AVATARS,
&priv->show_avatars);
- 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->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->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
deleted file mode 100644
index 56b758e2a..000000000
--- a/libempathy-gtk/empathy-theme-utils.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/* -*- 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
deleted file mode 100644
index af970775f..000000000
--- a/libempathy-gtk/empathy-theme-utils.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* -*- 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__ */
-
-
diff --git a/libempathy-gtk/empathy-theme.c b/libempathy-gtk/empathy-theme.c
index c465ae69a..1895b8ccb 100644
--- a/libempathy-gtk/empathy-theme.c
+++ b/libempathy-gtk/empathy-theme.c
@@ -31,7 +31,6 @@
#include "empathy-chat.h"
#include "empathy-preferences.h"
-#include "empathy-theme-utils.h"
#include "empathy-theme.h"
#include "empathy-smiley-manager.h"
@@ -67,13 +66,6 @@ enum {
PROP_SHOW_AVATARS
};
-enum {
- UPDATED,
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
static void
empathy_theme_class_init (EmpathyThemeClass *class)
{
@@ -85,8 +77,7 @@ empathy_theme_class_init (EmpathyThemeClass *class)
object_class->get_property = theme_get_property;
object_class->set_property = theme_set_property;
- class->setup_with_view = NULL;
- class->view_cleared = NULL;
+ class->update_view = NULL;
class->append_message = NULL;
class->append_event = NULL;
class->append_timestamp = NULL;
@@ -99,16 +90,6 @@ 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));
}
@@ -168,7 +149,8 @@ theme_set_property (GObject *object,
switch (param_id) {
case PROP_SHOW_AVATARS:
- priv->show_avatars = g_value_get_boolean (value);
+ empathy_theme_set_show_avatars (EMPATHY_THEME (object),
+ g_value_get_boolean (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
@@ -178,7 +160,6 @@ theme_set_property (GObject *object,
void
empathy_theme_maybe_append_date_and_time (EmpathyTheme *theme,
- EmpathyThemeContext *context,
EmpathyChatView *view,
EmpathyMessage *message)
{
@@ -207,61 +188,24 @@ empathy_theme_maybe_append_date_and_time (EmpathyTheme *theme,
}
if (append_time || append_date) {
- empathy_theme_append_timestamp (theme, context,
- view, message,
+ empathy_theme_append_timestamp (theme, 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_detach_from_view (EmpathyTheme *theme,
- EmpathyThemeContext *context,
- EmpathyChatView *view)
+empathy_theme_update_view (EmpathyTheme *theme,
+ EmpathyChatView *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;
+ if (!EMPATHY_THEME_GET_CLASS(theme)->update_view) {
+ g_error ("Theme must override update_view");
}
- EMPATHY_THEME_GET_CLASS(theme)->view_cleared (theme, context, view);
+ return EMPATHY_THEME_GET_CLASS(theme)->update_view (theme, view);
}
void
empathy_theme_append_message (EmpathyTheme *theme,
- EmpathyThemeContext *context,
EmpathyChatView *view,
EmpathyMessage *message)
{
@@ -270,8 +214,7 @@ empathy_theme_append_message (EmpathyTheme *theme,
return;
}
- EMPATHY_THEME_GET_CLASS(theme)->append_message (theme, context, view,
- message);
+ EMPATHY_THEME_GET_CLASS(theme)->append_message (theme, view, message);
}
static void
@@ -309,7 +252,6 @@ theme_insert_text_with_emoticons (GtkTextBuffer *buf,
void
empathy_theme_append_text (EmpathyTheme *theme,
- EmpathyThemeContext *context,
EmpathyChatView *view,
const gchar *body,
const gchar *tag,
@@ -410,7 +352,6 @@ empathy_theme_append_text (EmpathyTheme *theme,
void
empathy_theme_append_event (EmpathyTheme *theme,
- EmpathyThemeContext *context,
EmpathyChatView *view,
const gchar *str)
{
@@ -418,25 +359,23 @@ empathy_theme_append_event (EmpathyTheme *theme,
return;
}
- EMPATHY_THEME_GET_CLASS(theme)->append_event (theme, context, view, str);
+ EMPATHY_THEME_GET_CLASS(theme)->append_event (theme, 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, context, view);
+ EMPATHY_THEME_GET_CLASS(theme)->append_spacing (theme, view);
}
void
empathy_theme_append_timestamp (EmpathyTheme *theme,
- EmpathyThemeContext *context,
EmpathyChatView *view,
EmpathyMessage *message,
gboolean show_date,
@@ -446,7 +385,7 @@ empathy_theme_append_timestamp (EmpathyTheme *theme,
return;
}
- EMPATHY_THEME_GET_CLASS(theme)->append_timestamp (theme, context, view,
+ EMPATHY_THEME_GET_CLASS(theme)->append_timestamp (theme, view,
message, show_date,
show_time);
}
diff --git a/libempathy-gtk/empathy-theme.h b/libempathy-gtk/empathy-theme.h
index b05342aa7..34875bcb4 100644
--- a/libempathy-gtk/empathy-theme.h
+++ b/libempathy-gtk/empathy-theme.h
@@ -42,89 +42,54 @@ struct _EmpathyTheme {
GObject parent;
};
-typedef void EmpathyThemeContext;
-
struct _EmpathyThemeClass {
GObjectClass parent_class;
/* <vtable> */
- 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);
+ 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);
};
-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);
+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);
G_END_DECLS
diff --git a/libempathy-gtk/empathy-ui-utils.c b/libempathy-gtk/empathy-ui-utils.c
index 6f1b5a857..2989ce2ac 100644
--- a/libempathy-gtk/empathy-ui-utils.c
+++ b/libempathy-gtk/empathy-ui-utils.c
@@ -1376,3 +1376,51 @@ 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;
+}
+
diff --git a/libempathy-gtk/empathy-ui-utils.h b/libempathy-gtk/empathy-ui-utils.h
index eb189545a..fd1f7c633 100644
--- a/libempathy-gtk/empathy-ui-utils.h
+++ b/libempathy-gtk/empathy-ui-utils.h
@@ -106,9 +106,12 @@ 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
new file mode 100644
index 000000000..e429342b9
--- /dev/null
+++ b/m4/.gitignore
@@ -0,0 +1,2 @@
+gtk-doc.m4
+intltool.m4
diff --git a/acinclude.m4 b/m4/acinclude.m4
index 3120d8620..3120d8620 100644
--- a/acinclude.m4
+++ b/m4/acinclude.m4
diff --git a/m4/empathy-args.m4 b/m4/empathy-args.m4
new file mode 100644
index 000000000..3daacbaba
--- /dev/null
+++ b/m4/empathy-args.m4
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 000000000..7a44e103f
--- /dev/null
+++ b/m4/empathy-valgrind.m4
@@ -0,0 +1,31 @@
+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")
+])
diff --git a/po/.gitignore b/po/.gitignore
index c7d5b9846..90b9b7408 100644
--- a/po/.gitignore
+++ b/po/.gitignore
@@ -3,3 +3,4 @@
Makefile.in.in
POTFILES
stamp-it
+empathy.pot
diff --git a/po/POTFILES.in b/po/POTFILES.in
index c77ef0c12..b23897d87 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -19,6 +19,7 @@ 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
@@ -49,6 +50,8 @@ 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
new file mode 100644
index 000000000..bbb9819f2
--- /dev/null
+++ b/rules/check.mak
@@ -0,0 +1,120 @@
+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"
+
diff --git a/src/.gitignore b/src/.gitignore
index 75a62869e..54397d04f 100644
--- a/src/.gitignore
+++ b/src/.gitignore
@@ -2,3 +2,5 @@ empathy
empathy-accounts
empathy-chat-chandler
org.gnome.Empathy.Chat.service
+empathy-call-chandler
+org.gnome.Empathy.Call.service
diff --git a/src/empathy-call-chandler.c b/src/empathy-call-chandler.c
index 3a1b51137..be9de1175 100644
--- a/src/empathy-call-chandler.c
+++ b/src/empathy-call-chandler.c
@@ -42,6 +42,19 @@
#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,
@@ -50,13 +63,17 @@ 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);
- empathy_call_window_show (call);
+ window = 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
diff --git a/src/empathy-chat-chandler.c b/src/empathy-chat-chandler.c
index dc2eb60f7..79bbe8a35 100644
--- a/src/empathy-chat-chandler.c
+++ b/src/empathy-chat-chandler.c
@@ -48,6 +48,19 @@
#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,
@@ -99,6 +112,8 @@ 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
deleted file mode 100644
index fec81543b..000000000
--- a/svn2cl.xsl
+++ /dev/null
@@ -1,295 +0,0 @@
-<?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
new file mode 100644
index 000000000..edf303249
--- /dev/null
+++ b/tests/.gitignore
@@ -0,0 +1,3 @@
+check-main
+contact-manager
+*.log
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 8c6094c95..f823d4def 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,3 +1,9 @@
+CLEANFILES=
+
+include $(top_srcdir)/rules/check.mak
+
+SUPPRESSIONS=valgrind.supp dlopen.supp
+
AM_CPPFLAGS = \
-I$(top_srcdir) \
$(EMPATHY_CFLAGS) \
@@ -13,3 +19,22 @@ 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
new file mode 100644
index 000000000..faf261058
--- /dev/null
+++ b/tests/check-empathy-utils.c
@@ -0,0 +1,29 @@
+#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
new file mode 100644
index 000000000..1bb14cdec
--- /dev/null
+++ b/tests/check-helpers.c
@@ -0,0 +1,63 @@
+/*
+ * 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
new file mode 100644
index 000000000..b71b3b65b
--- /dev/null
+++ b/tests/check-helpers.h
@@ -0,0 +1,43 @@
+/*
+ * 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
new file mode 100644
index 000000000..1f3302583
--- /dev/null
+++ b/tests/check-libempathy.h
@@ -0,0 +1,6 @@
+#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
new file mode 100644
index 000000000..6dcfe3237
--- /dev/null
+++ b/tests/check-main.c
@@ -0,0 +1,40 @@
+#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
new file mode 100644
index 000000000..f6300a3a7
--- /dev/null
+++ b/tests/dlopen.supp
@@ -0,0 +1,127 @@
+{
+ <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
new file mode 100644
index 000000000..29bb04547
--- /dev/null
+++ b/tests/valgrind.supp
@@ -0,0 +1,711 @@
+### 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
+}