Index: configure.in
===================================================================
--- configure.in	(révision 4567)
+++ configure.in	(copie de travail)
@@ -64,7 +64,7 @@
 AC_SUBST(TOTEM_PL_PARSER_VERSION_MICRO)
 
 # The full list of plugins
-allowed_plugins="screensaver ontop galago gromit lirc media-player-keys properties sidebar-test skipto sample-python sample-vala bemused"
+allowed_plugins="screensaver ontop galago gromit lirc media-player-keys properties sidebar-test skipto sample-python sample-vala bemused fullscreen-notification"
 
 PLUGINDIR='${libdir}/totem/plugins'
 AC_SUBST(PLUGINDIR)
@@ -361,6 +361,14 @@
 				add_plugin="0"
 			fi
 		;;
+		fullscreen-notification)
+			PKG_CHECK_MODULES(LIBEMPATHY, libempathy,
+				[HAVE_LIBEMPATHY=yes], [HAVE_LIBEMPATHY=no])
+			if test "${HAVE_LIBEMPATHY}" != "yes" ; then
+				plugin_error_or_ignore "you need libempathy installed for the fullscreen notification plugin"
+				add_plugin="0"
+			fi
+		;;
 	esac
 
 	# Add the specified plugin
@@ -1007,6 +1015,7 @@
 src/plugins/skipto/Makefile
 src/plugins/sample-python/Makefile
 src/plugins/sample-vala/Makefile
+src/plugins/fullscreen-notification/Makefile
 src/backend/Makefile
 src/plparse/Makefile
 src/plparse/totem-pl-parser-features.h
Index: src/plugins/fullscreen-notification/Makefile.am
===================================================================
--- src/plugins/fullscreen-notification/Makefile.am	(révision 0)
+++ src/plugins/fullscreen-notification/Makefile.am	(révision 0)
@@ -0,0 +1,44 @@
+modules_flags = -export_dynamic -avoid-version -module
+
+plugindir = $(PLUGINDIR)/fullscreen-notification
+plugin_LTLIBRARIES = libtfs.la
+
+plugin_in_files = fullscreen-notification.totem-plugin.in
+
+%.totem-plugin: %.totem-plugin.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
+
+plugin_DATA = $(plugin_in_files:.totem-plugin.in=.totem-plugin)
+
+common_defines = \
+	-D_REENTRANT					\
+	-DDBUS_API_SUBJECT_TO_CHANGE			\
+	-DGNOMELOCALEDIR=\""$(datadir)/locale"\"	\
+	-DGCONF_PREFIX=\""/apps/totem"\"		\
+	-DDATADIR=\""$(datadir)"\"			\
+	-DLIBEXECDIR=\""$(libexecdir)"\"		\
+	-DBINDIR=\""$(bindir)"\"			\
+	-DTOTEM_PLUGIN_DIR=\""$(libdir)/totem/plugins"\"\
+	$(DISABLE_DEPRECATED)
+
+libtfs_la_SOURCES = totem-fullscreen-notification.c
+libtfs_la_LDFLAGS = $(modules_flags)
+libtfs_la_LIBADD = $(LIBEMPATHY_LIBS)
+libtfs_la_CPPFLAGS = $(common_defines) \
+	-I$(top_srcdir)/src/backend \
+	-I$(top_srcdir)/src/plparse \
+	$(AM_CPPFLAGS)
+
+libtfs_la_CFLAGS = \
+	$(EXTRA_GNOME_CFLAGS)	\
+	$(LIBEMPATHY_CFLAGS)	\
+	$(WARN_CFLAGS)		\
+	$(DBUS_CFLAGS)		\
+	$(AM_CFLAGS)		\
+	-I$(top_srcdir)/lib	\
+	-I$(top_srcdir)/src	\
+	-I$(top_srcdir)/src/plugins
+
+EXTRA_DIST = $(plugin_in_files)
+
+CLEANFILES = $(plugin_DATA) $(BUILT_SOURCES)
+DISTCLEANFILES = $(plugin_DATA)
Index: src/plugins/fullscreen-notification/totem-fullscreen-notification.c
===================================================================
--- src/plugins/fullscreen-notification/totem-fullscreen-notification.c	(révision 0)
+++ src/plugins/fullscreen-notification/totem-fullscreen-notification.c	(révision 0)
@@ -0,0 +1,283 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* 
+ * Copyright (C) 2007 Bastien Nocera <hadess@hadess.net>
+ *
+ * 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.
+ *
+ * The Totem project hereby grant permission for non-gpl compatible GStreamer
+ * plugins to be used and distributed together with GStreamer and Totem. This
+ * permission are above and beyond the permissions granted by the GPL license
+ * Totem is covered by.
+ *
+ * See license_change file for details.
+ *
+ */
+
+#include "config.h"
+
+#include <glib.h>
+#include <glib-object.h>
+#include <glib/gi18n-lib.h>
+#include <gmodule.h>
+#include <string.h>
+
+#include <libmissioncontrol/mission-control.h>
+#include <libempathy/empathy-tp-chat.h>
+#include <libempathy/empathy-filter.h>
+#include <libempathy/empathy-utils.h>
+#include <libempathy/empathy-debug.h>
+
+
+#include "totem-plugin.h"
+#include "totem.h"
+#include "totem-private.h"
+
+#define TOTEM_TYPE_FULLSCREEN_NOTIFICATION_PLUGIN		(totem_fullscreen_notification_plugin_get_type())
+#define TOTEM_FULLSCREEN_NOTIFICATION_PLUGIN(o)			(G_TYPE_CHECK_INSTANCE_CAST((o), TOTEM_TYPE_FULLSCREEN_NOTIFICATION_PLUGIN, TotemFullscreenNotificationPlugin))
+#define TOTEM_FULLSCREEN_NOTIFICATION_PLUGIN_CLASS(k)		(G_TYPE_CHECK_CLASS_CAST((k), TOTEM_TYPE_FULLSCREEN_NOTIFICATION_PLUGIN, TotemFullscreenNotificationPluginClass))
+#define TOTEM_IS_FULLSCREEN_NOTIFICATION_PLUGIN(o)		(G_TYPE_CHECK_INSTANCE_TYPE((o), TOTEM_TYPE_FULLSCREEN_NOTIFICATION_PLUGIN))
+#define TOTEM_IS_FULLSCREEN_NOTIFICATION_PLUGIN_CLASS(k)		(G_TYPE_CHECK_CLASS_TYPE((k), TOTEM_TYPE_FULLSCREEN_NOTIFICATION_PLUGIN))
+#define TOTEM_FULLSCREEN_NOTIFICATION_PLUGIN_GET_CLASS(o)	(G_TYPE_INSTANCE_GET_CLASS((o), TOTEM_TYPE_FULLSCREEN_NOTIFICATION_PLUGIN, TotemFullscreenNotificationPluginClass))
+
+typedef struct
+{
+	TotemPlugin	parent;
+	TotemObject *totem;
+
+	guint		handler_id_fullscreen;
+
+	GtkWidget *notify_popup;
+	GtkWidget *notify_label;
+
+	MissionControl *mc;
+	EmpathyFilter *text_filter;
+
+	guint timeout_id;
+} TotemFullscreenNotificationPlugin;
+
+typedef struct
+{
+	TotemPluginClass parent_class;
+} TotemFullscreenNotificationPluginClass;
+
+
+G_MODULE_EXPORT GType register_totem_plugin	(GTypeModule *module);
+GType totem_fullscreen_notification_plugin_get_type		(void) G_GNUC_CONST;
+
+static void totem_fullscreen_notification_plugin_init		(TotemFullscreenNotificationPlugin *plugin);
+static void totem_fullscreen_notification_plugin_finalize	(GObject *object);
+static gboolean impl_activate			(TotemPlugin *plugin, TotemObject *totem, GError **error);
+static void impl_deactivate			(TotemPlugin *plugin, TotemObject *totem);
+
+static void totem_fullscreen_notification_message_received_cb(EmpathyTpChat *tp_chat,
+		EmpathyMessage *message,
+		TotemFullscreenNotificationPlugin *plugin);
+
+
+TOTEM_PLUGIN_REGISTER(TotemFullscreenNotificationPlugin, totem_fullscreen_notification_plugin)
+
+static void
+totem_fullscreen_notification_plugin_class_init(TotemFullscreenNotificationPluginClass *klass)
+{
+	GObjectClass *object_class = G_OBJECT_CLASS(klass);
+	TotemPluginClass *plugin_class = TOTEM_PLUGIN_CLASS(klass);
+
+	object_class->finalize = totem_fullscreen_notification_plugin_finalize;
+
+	plugin_class->activate = impl_activate;
+	plugin_class->deactivate = impl_deactivate;
+}
+
+static void
+totem_fullscreen_notification_plugin_init(TotemFullscreenNotificationPlugin *plugin)
+{
+}
+
+static void
+totem_fullscreen_notification_plugin_finalize(GObject *object)
+{
+	TotemFullscreenNotificationPlugin *plugin = TOTEM_FULLSCREEN_NOTIFICATION_PLUGIN(object);
+
+	g_object_unref(plugin->mc);
+
+	G_OBJECT_CLASS(totem_fullscreen_notification_plugin_parent_class)->finalize(object);
+}
+
+static void
+totem_fullscreen_notification_filter_new_channel(EmpathyFilter *filter,
+		TpConn *tp_conn,
+		TpChan *tp_chan,
+		TotemFullscreenNotificationPlugin *plugin)
+{
+	McAccount *account;
+	EmpathyTpChat *tp_chat;
+	GList *messages;
+
+	account = mission_control_get_account_for_connection(plugin->mc, tp_conn, NULL);
+
+	tp_chat = empathy_tp_chat_new(account, tp_chan);
+	g_object_set_data(G_OBJECT(tp_chat), "filter", filter);
+	g_object_unref(account);
+
+	messages = empathy_tp_chat_get_pendings(tp_chat);
+	if (!messages) {
+		g_signal_connect(tp_chat, "message-received",
+				G_CALLBACK(totem_fullscreen_notification_message_received_cb),
+				plugin);
+		return;
+	}
+	totem_fullscreen_notification_message_received_cb(tp_chat, messages->data, plugin);
+
+	g_list_foreach(messages, (GFunc) g_object_unref, NULL);
+	g_list_free(messages);
+
+}
+
+static gboolean
+totem_fullscreen_notification_timeout_cb(
+		TotemFullscreenNotificationPlugin *plugin)
+{
+	gtk_widget_hide(plugin->notify_popup);
+
+	plugin->timeout_id = 0;
+	return FALSE;
+}
+
+static void
+totem_fullscreen_notification_message_received_cb(EmpathyTpChat *tp_chat,
+		EmpathyMessage *message,
+		TotemFullscreenNotificationPlugin *plugin)
+{
+	EmpathyContact *sender;
+	gchar *msg;
+
+	g_signal_handlers_disconnect_by_func(tp_chat,
+			totem_fullscreen_notification_message_received_cb,
+			plugin);
+
+	if (! totem_is_fullscreen(plugin->totem)) {
+		return;
+	}
+
+	sender = empathy_message_get_sender(message);
+
+	msg = g_strdup_printf("<span foreground=\"#ffffff\">message from %s</span>", 
+		empathy_contact_get_name(sender));;
+	gtk_label_set_markup(GTK_LABEL(plugin->notify_label), msg);
+	g_free(msg);
+	if (plugin->timeout_id) {
+		g_source_remove(plugin->timeout_id);
+	}
+	gtk_widget_show(plugin->notify_popup);
+	plugin->timeout_id = g_timeout_add_seconds(5,
+			(GSourceFunc)totem_fullscreen_notification_timeout_cb,
+			plugin);
+}
+
+static void
+totem_fullscreen_notification_update_from_state(TotemObject *totem,
+				TotemFullscreenNotificationPlugin *plugin)
+{
+	if (totem_is_fullscreen(totem) == FALSE) {
+		gtk_widget_hide(plugin->notify_popup);
+	}
+}
+
+static void
+property_notify_cb(TotemObject *totem,
+		GParamSpec *spec,
+		TotemFullscreenNotificationPlugin *plugin)
+{
+	totem_fullscreen_notification_update_from_state(totem, plugin);
+}
+
+static gboolean
+impl_activate(TotemPlugin *plugin, TotemObject *totem, GError **error)
+{
+	TotemFullscreenNotificationPlugin *pi = TOTEM_FULLSCREEN_NOTIFICATION_PLUGIN(plugin);
+	GdkScreen *screen;
+	GdkRectangle fullscreen_rect;
+	int notify_width, notify_height;
+	int exit_width, exit_height;
+	GtkWidget *exit_popup;
+	GdkColor black = { 0, 0, 0 };
+
+	pi->totem = totem;
+
+	exit_popup = gtk_widget_get_parent(totem->fs->exit_button);
+
+	pi->notify_popup = gtk_window_new(GTK_WINDOW_POPUP);
+	gtk_window_set_position(GTK_WINDOW(pi->notify_popup), GTK_WIN_POS_NONE);
+
+	gtk_widget_modify_bg(pi->notify_popup, GTK_STATE_NORMAL, &black);
+	pi->notify_label = gtk_label_new("");
+	gtk_container_add(GTK_CONTAINER(pi->notify_popup), pi->notify_label);
+	gtk_widget_show(pi->notify_label);
+
+	screen = gtk_window_get_screen(GTK_WINDOW(exit_popup));
+	gdk_screen_get_monitor_geometry(screen,
+			gdk_screen_get_monitor_at_window(screen, totem->win->window),
+			&fullscreen_rect);
+
+	gtk_window_get_size(GTK_WINDOW(exit_popup), &exit_width, &exit_height);
+	gtk_window_get_size(GTK_WINDOW(pi->notify_popup), &notify_width, &notify_height);
+	gtk_window_resize(GTK_WINDOW(pi->notify_popup),
+			fullscreen_rect.width - exit_width, notify_height);
+	gtk_window_get_size(GTK_WINDOW(pi->notify_popup), &notify_width, &notify_height);
+
+	if (gtk_widget_get_direction(pi->notify_popup) == GTK_TEXT_DIR_RTL) {
+		gtk_window_move(GTK_WINDOW(pi->notify_popup),
+				fullscreen_rect.width + fullscreen_rect.x - notify_width,
+				fullscreen_rect.y);
+	} else {
+		gtk_window_move(GTK_WINDOW(pi->notify_popup),
+				fullscreen_rect.x,
+				fullscreen_rect.y);
+	}
+
+	/* Empathy Stuff */
+
+	empathy_debug_set_log_file_from_env();
+
+	pi->mc = empathy_mission_control_new();
+
+	pi->text_filter = empathy_filter_new("org.gnome.Totem.FullscreenNotify",
+			"/org/freedesktop/Telepathy/Filter",
+			TP_IFACE_CHANNEL_TYPE_TEXT,
+			MC_FILTER_PRIORITY_DIALOG,
+			MC_FILTER_FLAG_INCOMING);
+	g_signal_connect(pi->text_filter, "new-channel",
+			G_CALLBACK(totem_fullscreen_notification_filter_new_channel), pi);
+
+	pi->handler_id_fullscreen = g_signal_connect(G_OBJECT(totem),
+				"notify::fullscreen",
+				G_CALLBACK(property_notify_cb),
+				pi);
+
+	/* Force setting the current status */
+	totem_fullscreen_notification_update_from_state(totem, pi);
+
+	return TRUE;
+}
+
+static void
+impl_deactivate	(TotemPlugin *plugin,
+		 TotemObject *totem)
+{
+	TotemFullscreenNotificationPlugin *pi = TOTEM_FULLSCREEN_NOTIFICATION_PLUGIN(plugin);
+
+	g_signal_handler_disconnect(G_OBJECT(totem), pi->handler_id_fullscreen);
+
+}
Index: src/plugins/fullscreen-notification/fullscreen-notification.totem-plugin.in
===================================================================
--- src/plugins/fullscreen-notification/fullscreen-notification.totem-plugin.in	(révision 0)
+++ src/plugins/fullscreen-notification/fullscreen-notification.totem-plugin.in	(révision 0)
@@ -0,0 +1,7 @@
+[Totem Plugin]
+Module=tfs
+IAge=1
+Builtin=false
+_Name=Fullscreen Notifications
+Authors=Frederic Peters
+Copyright=Copyright © 2007 Frederic Peters
