From: Xavier Claessens Date: Sat, 29 Dec 2007 15:58:47 +0000 (+0000) Subject: Revert "merge git work" X-Git-Url: https://git.0d.be/?p=empathy.git;a=commitdiff_plain;h=e4358acdec7b8c278a1950a3da24bab387a0e7b3 Revert "merge git work" This reverts commit 0cfd80847f0d66967f56c7d6b3eb46793f725859. svn path=/trunk/; revision=519 --- diff --git a/.gitignore b/.gitignore index 26783426..1fdf7e79 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 4256f0f8..2d207666 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 937147b6..187f6191 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/acinclude.m4 b/acinclude.m4 deleted file mode 100644 index 3120d862..00000000 --- a/acinclude.m4 +++ /dev/null @@ -1,65 +0,0 @@ -dnl Turn on the additional warnings last, so -Werror doesn't affect other tests. - -AC_DEFUN([IDT_COMPILE_WARNINGS],[ - if test -f $srcdir/autogen.sh; then - default_compile_warnings="error" - else - default_compile_warnings="no" - fi - - AC_ARG_WITH(compile-warnings, - AS_HELP_STRING([--with-compile-warnings=@<:@no/yes/error@:>@], - [Compiler warnings]), - [enable_compile_warnings="$withval"], - [enable_compile_warnings="$default_compile_warnings"]) - - warnCFLAGS= - if test "x$GCC" != xyes; then - enable_compile_warnings=no - fi - - warning_flags= - realsave_CFLAGS="$CFLAGS" - - case "$enable_compile_warnings" in - no) - warning_flags= - ;; - yes) - warning_flags="-Wall -Wunused -Wmissing-prototypes -Wmissing-declarations" - ;; - maximum|error) - warning_flags="-Wall -Wunused -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith" - CFLAGS="$warning_flags $CFLAGS" - for option in -Wno-sign-compare -Wno-pointer-sign; do - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $option" - AC_MSG_CHECKING([whether gcc understands $option]) - AC_TRY_COMPILE([], [], - has_option=yes, - has_option=no,) - CFLAGS="$SAVE_CFLAGS" - AC_MSG_RESULT($has_option) - if test $has_option = yes; then - warning_flags="$warning_flags $option" - fi - unset has_option - unset SAVE_CFLAGS - done - unset option - if test "$enable_compile_warnings" = "error" ; then - warning_flags="$warning_flags -Werror" - fi - ;; - *) - AC_MSG_ERROR(Unknown argument '$enable_compile_warnings' to --enable-compile-warnings) - ;; - esac - CFLAGS="$realsave_CFLAGS" - AC_MSG_CHECKING(what warning flags to pass to the C compiler) - AC_MSG_RESULT($warning_flags) - - WARN_CFLAGS="$warning_flags" - AC_SUBST(WARN_CFLAGS) -]) - diff --git a/configure.ac b/configure.ac index 66330663..76a34cd8 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 494e3c4c..07336f55 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 baa16975..a1c7bd79 100644 --- a/libempathy-gtk/empathy-call-window.c +++ b/libempathy-gtk/empathy-call-window.c @@ -24,6 +24,7 @@ #include "config.h" #include +#include #include @@ -103,6 +104,20 @@ call_window_capabilities_notify_cb (EmpathyContact *contact, capabilities & EMPATHY_CAPABILITIES_VIDEO); } +static void +call_window_name_notify_cb (EmpathyContact *contact, + GParamSpec *param, + EmpathyCallWindow *window) +{ + const gchar *name; + gchar *title; + + name = empathy_contact_get_name (contact); + title = g_strdup_printf (_("Call from %s"), name); + gtk_window_set_title (GTK_WINDOW (window->window), title); + g_free (title); +} + static void call_window_status_notify_cb (EmpathyTpCall *call, GParamSpec *param, @@ -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 ea310d62..c8c6d7f0 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 94728159..c7428e9d 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 73afd299..9b6a98a6 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 5cb6fc3e..5b40dc37 100644 --- a/libempathy-gtk/empathy-group-chat.glade +++ b/libempathy-gtk/empathy-group-chat.glade @@ -1,183 +1,123 @@ - - - + + + - - - 6 - Group Chat - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - 600 - 400 - True - False - system-users - True - False - False - GDK_WINDOW_TYPE_HINT_NORMAL - GDK_GRAVITY_NORTH_WEST - True - False - - - - 4 - True - False - 6 - - - - True - False - 6 - - - - True - <b>Topic:</b> - False - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - True - - False - True - GTK_JUSTIFY_LEFT - True - True - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_END - -1 - True - 0 - - - 0 - True - True - - - - - 2 - False - False - - - - - - True - True - - - - True - False - 6 - - - - True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_ALWAYS - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - - - - 0 - True - True - - - - - - True - True - GTK_POLICY_NEVER - GTK_POLICY_NEVER - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - - - - 0 - False - True - - - - - True - True - - - - - - 0 - True - True - GTK_POLICY_NEVER - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - - - - False - False - - - - - 0 - True - True - - - - - - + + 6 + Group Chat + 1000 + 800 + system-users + + + True + 4 + 6 + + + True + 6 + + + True + 0 + 0 + <b>Topic:</b> + True + + + False + False + + + + + True + True + 0 + True + True + True + PANGO_ELLIPSIZE_END + True + + + 1 + + + + + False + False + 2 + + + + + True + True + + + 600 + 500 + True + 6 + + + True + True + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + + + + + + + + True + True + GTK_POLICY_NEVER + GTK_POLICY_NEVER + GTK_SHADOW_IN + + + + + + False + 1 + + + + + True + True + + + + + 200 + True + True + GTK_POLICY_NEVER + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + + + + + + True + True + + + + + 1 + + + + + diff --git a/libempathy-gtk/empathy-theme-boxes.c b/libempathy-gtk/empathy-theme-boxes.c index 2905f2be..87eac87d 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 a5428369..b1f0033f 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 afe71e5e..7cd9588b 100644 --- a/libempathy-gtk/empathy-theme-irc.c +++ b/libempathy-gtk/empathy-theme-irc.c @@ -24,7 +24,7 @@ #include #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)); } @@ -128,184 +100,83 @@ theme_irc_finalize (GObject *object) (G_OBJECT_CLASS (empathy_theme_irc_parent_class)->finalize) (object); } -static void -theme_irc_get_property (GObject *object, - guint param_id, - GValue *value, - GParamSpec *pspec) -{ - EmpathyThemeIrcPriv *priv; - - priv = GET_PRIV (object); - - switch (param_id) { - case PROP_MY_PROP: - g_value_set_int (value, priv->my_prop); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec); - break; - } -} -static void -theme_irc_set_property (GObject *object, - guint param_id, - const GValue *value, - GParamSpec *pspec) -{ - EmpathyThemeIrcPriv *priv; - - priv = GET_PRIV (object); - - switch (param_id) { - case PROP_MY_PROP: - priv->my_prop = g_value_get_int (value); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec); - break; - } -} - -static void -theme_irc_fixup_tag_table (EmpathyTheme *theme, EmpathyChatView *view) -{ - GtkTextBuffer *buffer; - - buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)); - - /* IRC style tags. */ - empathy_theme_utils_ensure_tag_by_name (buffer, "irc-nick-self"); - empathy_theme_utils_ensure_tag_by_name (buffer, "irc-body-self"); - empathy_theme_utils_ensure_tag_by_name (buffer, "irc-action-self"); - - empathy_theme_utils_ensure_tag_by_name (buffer, "irc-nick-other"); - empathy_theme_utils_ensure_tag_by_name (buffer, "irc-body-other"); - empathy_theme_utils_ensure_tag_by_name (buffer, "irc-action-other"); - - empathy_theme_utils_ensure_tag_by_name (buffer, "irc-nick-highlight"); - empathy_theme_utils_ensure_tag_by_name (buffer, "irc-spacing"); - empathy_theme_utils_ensure_tag_by_name (buffer, "irc-time"); - empathy_theme_utils_ensure_tag_by_name (buffer, "irc-event"); - empathy_theme_utils_ensure_tag_by_name (buffer, "irc-link"); -} - static void theme_irc_apply_theme_classic (EmpathyTheme *theme, EmpathyChatView *view) { EmpathyThemeIrcPriv *priv; - GtkTextBuffer *buffer; - 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 6feea2fc..6bece750 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); @@ -84,6 +84,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) { @@ -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 56b758e2..00000000 --- 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 - -#include - -#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 af970775..00000000 --- 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 -#include - -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 c465ae69..1895b8cc 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 b05342aa..34875bcb 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; /* */ - 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 6f1b5a85..2989ce2a 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 eb189545..fd1f7c63 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 00000000..e429342b --- /dev/null +++ b/m4/.gitignore @@ -0,0 +1,2 @@ +gtk-doc.m4 +intltool.m4 diff --git a/m4/acinclude.m4 b/m4/acinclude.m4 new file mode 100644 index 00000000..3120d862 --- /dev/null +++ b/m4/acinclude.m4 @@ -0,0 +1,65 @@ +dnl Turn on the additional warnings last, so -Werror doesn't affect other tests. + +AC_DEFUN([IDT_COMPILE_WARNINGS],[ + if test -f $srcdir/autogen.sh; then + default_compile_warnings="error" + else + default_compile_warnings="no" + fi + + AC_ARG_WITH(compile-warnings, + AS_HELP_STRING([--with-compile-warnings=@<:@no/yes/error@:>@], + [Compiler warnings]), + [enable_compile_warnings="$withval"], + [enable_compile_warnings="$default_compile_warnings"]) + + warnCFLAGS= + if test "x$GCC" != xyes; then + enable_compile_warnings=no + fi + + warning_flags= + realsave_CFLAGS="$CFLAGS" + + case "$enable_compile_warnings" in + no) + warning_flags= + ;; + yes) + warning_flags="-Wall -Wunused -Wmissing-prototypes -Wmissing-declarations" + ;; + maximum|error) + warning_flags="-Wall -Wunused -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith" + CFLAGS="$warning_flags $CFLAGS" + for option in -Wno-sign-compare -Wno-pointer-sign; do + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $option" + AC_MSG_CHECKING([whether gcc understands $option]) + AC_TRY_COMPILE([], [], + has_option=yes, + has_option=no,) + CFLAGS="$SAVE_CFLAGS" + AC_MSG_RESULT($has_option) + if test $has_option = yes; then + warning_flags="$warning_flags $option" + fi + unset has_option + unset SAVE_CFLAGS + done + unset option + if test "$enable_compile_warnings" = "error" ; then + warning_flags="$warning_flags -Werror" + fi + ;; + *) + AC_MSG_ERROR(Unknown argument '$enable_compile_warnings' to --enable-compile-warnings) + ;; + esac + CFLAGS="$realsave_CFLAGS" + AC_MSG_CHECKING(what warning flags to pass to the C compiler) + AC_MSG_RESULT($warning_flags) + + WARN_CFLAGS="$warning_flags" + AC_SUBST(WARN_CFLAGS) +]) + diff --git a/m4/empathy-args.m4 b/m4/empathy-args.m4 new file mode 100644 index 00000000..3daacbab --- /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 00000000..7a44e103 --- /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 c7d5b984..90b9b740 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 c77ef0c1..b23897d8 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 00000000..bbb9819f --- /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 75a62869..54397d04 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 3a1b5113..be9de117 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 dc2eb60f..79bbe8a3 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 fec81543..00000000 --- a/svn2cl.xsl +++ /dev/null @@ -1,295 +0,0 @@ - - - - - - - -]> - - - - - - - - - - - - - - - - - - - - - - - - - &newl; - - - - - - - - - - - - - - - - - - - - - - - - - - - &newl; - - - - - &space;&space; - - - - &newl;&newl; - - - - - - - - - [r - - ]&space; - - - - &tab;*&space; - - - - - - - - - - - - - - &space; - - - - - - - - - - - - - - - - ,&space; - - - - - - :&space; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - . - - - - - - - - - - - - - - - - &newl; - - - - - - - - - - - - - - - - - - - &newl;&tab;&space;&space; - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/.gitignore b/tests/.gitignore new file mode 100644 index 00000000..edf30324 --- /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 8c6094c9..f823d4de 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 00000000..faf26105 --- /dev/null +++ b/tests/check-empathy-utils.c @@ -0,0 +1,29 @@ +#include +#include +#include + +#include +#include "check-helpers.h" +#include "check-libempathy.h" + +#include + +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 00000000..1bb14cde --- /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 +#include + +#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 00000000..b71b3b65 --- /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 +#include + +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 00000000..1f330258 --- /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 00000000..6dcfe323 --- /dev/null +++ b/tests/check-main.c @@ -0,0 +1,40 @@ +#include +#include +#include +#include + +#include + +#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 00000000..f6300a3a --- /dev/null +++ b/tests/dlopen.supp @@ -0,0 +1,127 @@ +{ + + 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 +} +{ + + 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 +} +{ + + 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 +} +{ + + 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 +} +{ + + 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 +} +{ + + 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 +} +{ + + 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 +} +{ + + 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 +} +{ + + 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 00000000..29bb0454 --- /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 + +{ + + Memcheck:Param + clone(parent_tidptr) + fun:clone + fun:clone +} + +{ + + Memcheck:Param + clone(child_tidptr) + fun:clone + fun:clone +} + +{ + + Memcheck:Param + clone(tlsinfo) + fun:clone + fun:clone +} + +### glibc suppressions + +{ + + 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 + +{ + + Memcheck:Leak + fun:calloc + fun:_dl_allocate_tls + fun:pthread_create@@* +} + +# I get an extra stack entry on x86/dapper +{ + + Memcheck:Leak + fun:calloc + obj:/lib/ld-2.3.*.so + fun:_dl_allocate_tls + fun:pthread_create@@* +} + + +{ + + 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 +} + +{ + + 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 +{ + + 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 +} + +{ + + 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 +} + +{ + + 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 +} + +{ + + 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 +} +{ + + 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 +} + +{ + + 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 +} + +{ + + 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 +} + +{ + + 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 +} + +{ + + 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 +} + +{ + + 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 +} + +{ + + 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 +} + +{ + + 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 +{ + + 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 +} + +{ + + 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 +} +{ + + 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 +} + +{ + + 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 +} + +{ + + 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 +} +{ + + 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 +} + +{ + + 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 +} + +{ + + 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 +} + +{ + + 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 +} + +{ + + 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 +} + +{ + + 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 +{ + + Memcheck:Cond + fun:g_parse_debug_string + obj:/usr/lib*/libglib-2.0.so.* + fun:g_slice_alloc + fun:g_slice_alloc0 +} + +{ + + 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 +} + +{ + + Memcheck:Leak + fun:calloc + fun:g_malloc0 + obj:* + obj:* + fun:g_type_register_fundamental +} + +{ + + Memcheck:Leak + fun:calloc + fun:g_malloc0 + obj:* + obj:* + fun:g_type_init_with_debug_flags +} + +{ + + 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 +} + +{ + + Memcheck:Addr8 + obj:/lib/ld-2.3.6.so +} + +{ + + 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 +} + +{ + + 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 +{ + + Memcheck:Addr4 + obj:/lib/ld-2.4.so + obj:/lib/ld-2.4.so +} +{ + + Memcheck:Addr8 + obj:/lib/ld-2.4.so + obj:/lib/ld-2.4.so +} + +# More edgy suppressions (Mike) +{ + + 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 +} + +{ + + 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 +} + +{ + + 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! +{ + + 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 +} + +{ + + Memcheck:Leak + fun:calloc + obj:/lib/ld-2.4.so + fun:_dl_allocate_tls + fun:pthread_create@@GLIBC_2.1 +} + +{ + + 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 +{ + + Memcheck:Leak + fun:calloc + fun:allocate_dtv + fun:_dl_allocate_tls + fun:pthread_create@@GLIBC_2.1 +} + +{ + + Memcheck:Addr8 + obj:/lib/ld-2.5.so +} + +{ + + 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 +} +{ + + 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 +}