diff options
35 files changed, 1807 insertions, 1617 deletions
diff --git a/configure.ac b/configure.ac index 9a71efa76..7d53cff4b 100644 --- a/configure.ac +++ b/configure.ac @@ -40,7 +40,7 @@ KEYRING_REQUIRED=2.26.0 LIBCANBERRA_GTK_REQUIRED=0.4 LIBNOTIFY_REQUIRED=0.7.0 TELEPATHY_FARSIGHT_REQUIRED=0.0.14 -TELEPATHY_GLIB_REQUIRED=0.13.11 +TELEPATHY_GLIB_REQUIRED=0.13.12 TELEPATHY_LOGGER=0.1.5 UNIQUE_REQUIRED=1.1.2 @@ -139,7 +139,6 @@ AC_SUBST(ERROR_CFLAGS) PKG_CHECK_MODULES(EMPATHY, [ dbus-glib-1 - farsight2-0.10 folks >= $FOLKS_REQUIRED folks-telepathy >= $FOLKS_REQUIRED gconf-2.0 >= $GCONF_REQUIRED @@ -152,12 +151,17 @@ PKG_CHECK_MODULES(EMPATHY, gstreamer-0.10 gstreamer-interfaces-0.10 libxml-2.0 - telepathy-farsight >= $TELEPATHY_FARSIGHT_REQUIRED telepathy-glib >= $TELEPATHY_GLIB_REQUIRED telepathy-logger-0.1 >= $TELEPATHY_LOGGER x11 ]) +PKG_CHECK_MODULES(EMPATHY_AV, +[ + farsight2-0.10 + telepathy-farsight >= $TELEPATHY_FARSIGHT_REQUIRED +]) + # ----------------------------------------------------------- # evolution-data-server (about-me) # ----------------------------------------------------------- diff --git a/libempathy-gtk/empathy-contact-list-view.c b/libempathy-gtk/empathy-contact-list-view.c index 2df8a1148..7283f602f 100644 --- a/libempathy-gtk/empathy-contact-list-view.c +++ b/libempathy-gtk/empathy-contact-list-view.c @@ -34,7 +34,6 @@ #include <telepathy-glib/account-manager.h> #include <telepathy-glib/util.h> -#include <libempathy/empathy-call-factory.h> #include <libempathy/empathy-tp-contact-factory.h> #include <libempathy/empathy-contact-list.h> #include <libempathy/empathy-contact-groups.h> diff --git a/libempathy-gtk/empathy-contact-menu.c b/libempathy-gtk/empathy-contact-menu.c index 6f83fbe98..9984de42d 100644 --- a/libempathy-gtk/empathy-contact-menu.c +++ b/libempathy-gtk/empathy-contact-menu.c @@ -27,7 +27,6 @@ #include <gtk/gtk.h> #include <telepathy-logger/log-manager.h> -#include <libempathy/empathy-call-factory.h> #include <libempathy/empathy-contact-manager.h> #include <libempathy/empathy-dispatcher.h> #include <libempathy/empathy-utils.h> @@ -339,8 +338,8 @@ empathy_contact_audio_call_menu_item_activated (GtkMenuItem *item, EmpathyContact *contact) { - empathy_call_factory_new_call_with_streams (contact, TRUE, FALSE, - gtk_get_current_event_time (), NULL); + empathy_call_new_with_streams (contact, TRUE, FALSE, + gtk_get_current_event_time ()); } GtkWidget * @@ -370,8 +369,8 @@ static void empathy_contact_video_call_menu_item_activated (GtkMenuItem *item, EmpathyContact *contact) { - empathy_call_factory_new_call_with_streams (contact, TRUE, TRUE, - gtk_get_current_event_time (), NULL); + empathy_call_new_with_streams (contact, TRUE, TRUE, + gtk_get_current_event_time ()); } GtkWidget * diff --git a/libempathy-gtk/empathy-individual-menu.c b/libempathy-gtk/empathy-individual-menu.c index 2a578a09f..757bbe54a 100644 --- a/libempathy-gtk/empathy-individual-menu.c +++ b/libempathy-gtk/empathy-individual-menu.c @@ -31,7 +31,6 @@ #include <folks/folks.h> #include <folks/folks-telepathy.h> -#include <libempathy/empathy-call-factory.h> #include <libempathy/empathy-dispatcher.h> #include <libempathy/empathy-individual-manager.h> #include <libempathy/empathy-chatroom-manager.h> @@ -543,8 +542,8 @@ empathy_individual_audio_call_menu_item_activated (GtkMenuItem *item, { g_return_if_fail (EMPATHY_IS_CONTACT (contact)); - empathy_call_factory_new_call_with_streams (contact, TRUE, FALSE, - gtk_get_current_event_time (), NULL); + empathy_call_new_with_streams (contact, TRUE, FALSE, + gtk_get_current_event_time ()); } GtkWidget * @@ -585,8 +584,8 @@ empathy_individual_video_call_menu_item_activated (GtkMenuItem *item, { g_return_if_fail (EMPATHY_IS_CONTACT (contact)); - empathy_call_factory_new_call_with_streams (contact, TRUE, TRUE, - gtk_get_current_event_time (), NULL); + empathy_call_new_with_streams (contact, TRUE, TRUE, + gtk_get_current_event_time ()); } GtkWidget * diff --git a/libempathy-gtk/empathy-individual-view.c b/libempathy-gtk/empathy-individual-view.c index f719dfa74..55d25f801 100644 --- a/libempathy-gtk/empathy-individual-view.c +++ b/libempathy-gtk/empathy-individual-view.c @@ -38,7 +38,6 @@ #include <folks/folks.h> #include <folks/folks-telepathy.h> -#include <libempathy/empathy-call-factory.h> #include <libempathy/empathy-individual-manager.h> #include <libempathy/empathy-contact-groups.h> #include <libempathy/empathy-dispatcher.h> diff --git a/libempathy-gtk/empathy-new-call-dialog.c b/libempathy-gtk/empathy-new-call-dialog.c index ab9a86a6f..2d35fadec 100644 --- a/libempathy-gtk/empathy-new-call-dialog.c +++ b/libempathy-gtk/empathy-new-call-dialog.c @@ -30,7 +30,6 @@ #include <libempathy/empathy-tp-contact-factory.h> #include <libempathy/empathy-contact-manager.h> -#include <libempathy/empathy-call-factory.h> #include <libempathy/empathy-utils.h> #define DEBUG_FLAG EMPATHY_DEBUG_CONTACT diff --git a/libempathy-gtk/empathy-string-parser.c b/libempathy-gtk/empathy-string-parser.c index 45ae6a720..a6bffa03f 100644 --- a/libempathy-gtk/empathy-string-parser.c +++ b/libempathy-gtk/empathy-string-parser.c @@ -43,7 +43,14 @@ uri_regex_dup_singleton (void) /* We intentionally leak the regex so it's not recomputed */ if (!uri_regex) { - uri_regex = g_regex_new (URI_REGEX, 0, 0, NULL); + GError *error = NULL; + + uri_regex = g_regex_new (URI_REGEX, 0, 0, &error); + if (uri_regex == NULL) { + g_warning ("Failed to create reg exp: %s", error->message); + g_error_free (error); + return NULL; + } } return g_regex_ref (uri_regex); @@ -75,6 +82,11 @@ empathy_string_match_link (const gchar *text, gint last = 0; uri_regex = uri_regex_dup_singleton (); + if (uri_regex == NULL) { + empathy_string_parser_substr (text, len, sub_parsers, user_data); + return; + } + match = g_regex_match_full (uri_regex, text, len, 0, 0, &match_info, NULL); if (match) { gint s = 0, e = 0; diff --git a/libempathy/Makefile.am b/libempathy/Makefile.am index ae9e2b5e9..5336064d1 100644 --- a/libempathy/Makefile.am +++ b/libempathy/Makefile.am @@ -27,8 +27,7 @@ noinst_LTLIBRARIES = libempathy.la libempathy_headers = \ empathy-account-settings.h \ empathy-auth-factory.h \ - empathy-call-factory.h \ - empathy-call-handler.h \ + empathy-channel-factory.h \ empathy-chatroom-manager.h \ empathy-chatroom.h \ empathy-connection-managers.h \ @@ -56,12 +55,12 @@ libempathy_headers = \ empathy-time.h \ empathy-tls-certificate.h \ empathy-tls-verifier.h \ - empathy-tp-call.h \ empathy-tp-chat.h \ empathy-tp-contact-factory.h \ empathy-tp-contact-list.h \ empathy-tp-file.h \ empathy-tp-roomlist.h \ + empathy-tp-streamed-media.h \ empathy-types.h \ empathy-utils.h @@ -69,8 +68,7 @@ libempathy_la_SOURCES = \ $(libempathy_headers) \ empathy-account-settings.c \ empathy-auth-factory.c \ - empathy-call-factory.c \ - empathy-call-handler.c \ + empathy-channel-factory.c \ empathy-chatroom-manager.c \ empathy-chatroom.c \ empathy-connection-managers.c \ @@ -96,12 +94,12 @@ libempathy_la_SOURCES = \ empathy-time.c \ empathy-tls-certificate.c \ empathy-tls-verifier.c \ - empathy-tp-call.c \ empathy-tp-chat.c \ empathy-tp-contact-factory.c \ empathy-tp-contact-list.c \ empathy-tp-file.c \ empathy-tp-roomlist.c \ + empathy-tp-streamed-media.c \ empathy-utils.c # do not distribute generated files diff --git a/libempathy/empathy-call-factory.h b/libempathy/empathy-call-factory.h deleted file mode 100644 index 7b160dda4..000000000 --- a/libempathy/empathy-call-factory.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * empathy-call-factory.h - Header for EmpathyCallFactory - * Copyright (C) 2008 Collabora Ltd. - * @author Sjoerd Simons <sjoerd.simons@collabora.co.uk> - * - * 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 __EMPATHY_CALL_FACTORY_H__ -#define __EMPATHY_CALL_FACTORY_H__ - -#include <glib-object.h> - -#include <libempathy/empathy-call-handler.h> -#include <libempathy/empathy-dispatcher.h> - -G_BEGIN_DECLS - -typedef struct _EmpathyCallFactory EmpathyCallFactory; -typedef struct _EmpathyCallFactoryClass EmpathyCallFactoryClass; - -struct _EmpathyCallFactoryClass { - GObjectClass parent_class; -}; - -struct _EmpathyCallFactory { - GObject parent; - gpointer priv; -}; - -GType empathy_call_factory_get_type (void); - -/* TYPE MACROS */ -#define EMPATHY_TYPE_CALL_FACTORY \ - (empathy_call_factory_get_type ()) -#define EMPATHY_CALL_FACTORY(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), EMPATHY_TYPE_CALL_FACTORY, \ - EmpathyCallFactory)) -#define EMPATHY_CALL_FACTORY_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass), EMPATHY_TYPE_CALL_FACTORY, \ - EmpathyCallFactoryClass)) -#define EMPATHY_IS_CALL_FACTORY(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj), EMPATHY_TYPE_CALL_FACTORY)) -#define EMPATHY_IS_CALL_FACTORY_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass), EMPATHY_TYPE_CALL_FACTORY)) -#define EMPATHY_CALL_FACTORY_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS ((obj), EMPATHY_TYPE_CALL_FACTORY, \ - EmpathyCallFactoryClass)) - - -EmpathyCallFactory *empathy_call_factory_initialise (void); - -EmpathyCallFactory *empathy_call_factory_get (void); - -void empathy_call_factory_new_call_with_streams (EmpathyContact *contact, - gboolean initial_audio, - gboolean initial_video, - gint64 timestamp, - gpointer user_data); - -gboolean empathy_call_factory_register (EmpathyCallFactory *self, - GError **error); - -GHashTable * empathy_call_factory_create_request (EmpathyContact *contact, - gboolean initial_audio, - gboolean initial_video); - -G_END_DECLS - -#endif /* #ifndef __EMPATHY_CALL_FACTORY_H__*/ diff --git a/libempathy/empathy-call-handler.h b/libempathy/empathy-call-handler.h deleted file mode 100644 index 9f6fd9e3b..000000000 --- a/libempathy/empathy-call-handler.h +++ /dev/null @@ -1,106 +0,0 @@ -/* - * empathy-call-handler.h - Header for EmpathyCallHandler - * Copyright (C) 2008-2009 Collabora Ltd. - * @author Sjoerd Simons <sjoerd.simons@collabora.co.uk> - * - * 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 __EMPATHY_CALL_HANDLER_H__ -#define __EMPATHY_CALL_HANDLER_H__ - -#include <glib-object.h> - -#include <gst/gst.h> -#include <gst/farsight/fs-conference-iface.h> - -#include <libempathy/empathy-tp-call.h> -#include <libempathy/empathy-contact.h> - -G_BEGIN_DECLS - -typedef struct _EmpathyCallHandler EmpathyCallHandler; -typedef struct _EmpathyCallHandlerClass EmpathyCallHandlerClass; - -struct _EmpathyCallHandlerClass { - GObjectClass parent_class; -}; - -struct _EmpathyCallHandler { - GObject parent; - gpointer priv; -}; - -GType empathy_call_handler_get_type (void); - -/* TYPE MACROS */ -#define EMPATHY_TYPE_CALL_HANDLER \ - (empathy_call_handler_get_type ()) -#define EMPATHY_CALL_HANDLER(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), EMPATHY_TYPE_CALL_HANDLER, \ - EmpathyCallHandler)) -#define EMPATHY_CALL_HANDLER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass), EMPATHY_TYPE_CALL_HANDLER, \ - EmpathyCallHandlerClass)) -#define EMPATHY_IS_CALL_HANDLER(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj), EMPATHY_TYPE_CALL_HANDLER)) -#define EMPATHY_IS_CALL_HANDLER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass), EMPATHY_TYPE_CALL_HANDLER)) -#define EMPATHY_CALL_HANDLER_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS ((obj), EMPATHY_TYPE_CALL_HANDLER, \ - EmpathyCallHandlerClass)) - -EmpathyCallHandler * empathy_call_handler_new_for_contact ( - EmpathyContact *contact); - -EmpathyCallHandler * empathy_call_handler_new_for_channel ( - EmpathyTpCall *call); - -void empathy_call_handler_start_call (EmpathyCallHandler *handler, - gint64 timestamp); -void empathy_call_handler_stop_call (EmpathyCallHandler *handler); - -gboolean empathy_call_handler_has_initial_video (EmpathyCallHandler *handler); - -void empathy_call_handler_bus_message (EmpathyCallHandler *handler, - GstBus *bus, GstMessage *message); - -FsCodec * empathy_call_handler_get_send_audio_codec ( - EmpathyCallHandler *self); - -FsCodec * empathy_call_handler_get_send_video_codec ( - EmpathyCallHandler *self); - -GList * empathy_call_handler_get_recv_audio_codecs ( - EmpathyCallHandler *self); - -GList * empathy_call_handler_get_recv_video_codecs ( - EmpathyCallHandler *self); - -FsCandidate * empathy_call_handler_get_audio_remote_candidate ( - EmpathyCallHandler *self); - -FsCandidate * empathy_call_handler_get_audio_local_candidate ( - EmpathyCallHandler *self); - -FsCandidate * empathy_call_handler_get_video_remote_candidate ( - EmpathyCallHandler *self); - -FsCandidate * empathy_call_handler_get_video_local_candidate ( - EmpathyCallHandler *self); - -G_END_DECLS - -#endif /* #ifndef __EMPATHY_CALL_HANDLER_H__*/ diff --git a/libempathy/empathy-channel-factory.c b/libempathy/empathy-channel-factory.c new file mode 100644 index 000000000..bbe0cb0ba --- /dev/null +++ b/libempathy/empathy-channel-factory.c @@ -0,0 +1,126 @@ +/* + * Copyright (C) 2010 Collabora Ltd. + * + * 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., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301 USA + * + * Authors: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> + */ + +#include "empathy-channel-factory.h" + +#include <telepathy-glib/telepathy-glib.h> + +static void factory_iface_init (gpointer, gpointer); + +G_DEFINE_TYPE_WITH_CODE (EmpathyChannelFactory, empathy_channel_factory, + G_TYPE_OBJECT, + G_IMPLEMENT_INTERFACE (TP_TYPE_CLIENT_CHANNEL_FACTORY, factory_iface_init)) + +struct _EmpathyChannelFactoryPrivate +{ + TpClientChannelFactory *automatic_factory; +}; + +static void +empathy_channel_factory_dispose (GObject *object) +{ + EmpathyChannelFactory *self = EMPATHY_CHANNEL_FACTORY (object); + void (*dispose) (GObject *) = + G_OBJECT_CLASS (empathy_channel_factory_parent_class)->dispose; + + tp_clear_object (&self->priv->automatic_factory); + + if (dispose != NULL) + dispose (object); +} + +static void +empathy_channel_factory_class_init (EmpathyChannelFactoryClass *cls) +{ + GObjectClass *object_class = G_OBJECT_CLASS (cls); + + g_type_class_add_private (cls, sizeof (EmpathyChannelFactoryPrivate)); + + object_class->dispose = empathy_channel_factory_dispose; +} + +static void +empathy_channel_factory_init (EmpathyChannelFactory *self) +{ + self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, + EMPATHY_TYPE_CHANNEL_FACTORY, EmpathyChannelFactoryPrivate); + + self->priv->automatic_factory = TP_CLIENT_CHANNEL_FACTORY ( + tp_automatic_proxy_factory_dup ()); +} + +EmpathyChannelFactory * +empathy_channel_factory_new (void) +{ + return g_object_new (EMPATHY_TYPE_CHANNEL_FACTORY, + NULL); +} + +EmpathyChannelFactory * +empathy_channel_factory_dup (void) +{ + static EmpathyChannelFactory *singleton = NULL; + + if (singleton != NULL) + return g_object_ref (singleton); + + singleton = empathy_channel_factory_new (); + + g_object_add_weak_pointer (G_OBJECT (singleton), (gpointer) &singleton); + + return singleton; +} + +static TpChannel * +empathy_channel_factory_create_channel ( + TpClientChannelFactory *factory, + TpConnection *conn, + const gchar *path, + GHashTable *properties, + GError **error) +{ + EmpathyChannelFactory *self = (EmpathyChannelFactory *) factory; + + return tp_client_channel_factory_create_channel ( + self->priv->automatic_factory, conn, path, properties, error); +} + +static GArray * +empathy_channel_factory_dup_channel_features ( + TpClientChannelFactory *factory, + TpChannel *channel) +{ + EmpathyChannelFactory *self = (EmpathyChannelFactory *) factory; + + return tp_client_channel_factory_dup_channel_features ( + self->priv->automatic_factory, channel); +} + +static void +factory_iface_init (gpointer g_iface, + gpointer unused G_GNUC_UNUSED) +{ + TpClientChannelFactoryInterface *iface = g_iface; + + iface->obj_create_channel = empathy_channel_factory_create_channel; + iface->obj_dup_channel_features = + empathy_channel_factory_dup_channel_features; +} diff --git a/libempathy/empathy-channel-factory.h b/libempathy/empathy-channel-factory.h new file mode 100644 index 000000000..7cfcf31f8 --- /dev/null +++ b/libempathy/empathy-channel-factory.h @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2010 Collabora Ltd. + * + * 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., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301 USA + * + * Authors: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> + */ + +#ifndef __EMPATHY_CHANNEL_FACTORY_H__ +#define __EMPATHY_CHANNEL_FACTORY_H__ + +#include <glib-object.h> + +G_BEGIN_DECLS + +#define EMPATHY_TYPE_CHANNEL_FACTORY (empathy_channel_factory_get_type ()) +#define EMPATHY_CHANNEL_FACTORY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EMPATHY_TYPE_CHANNEL_FACTORY, EmpathyChannelFactory)) +#define EMPATHY_CHANNEL_FACTORY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EMPATHY_TYPE_CHANNEL_FACTORY, EmpathyChannelFactoryClass)) +#define EMPATHY_IS_CHANNEL_FACTORY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EMPATHY_TYPE_CHANNEL_FACTORY)) +#define EMPATHY_IS_CHANNEL_FACTORY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EMPATHY_TYPE_CHANNEL_FACTORY)) +#define EMPATHY_CHANNEL_FACTORY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EMPATHY_TYPE_CHANNEL_FACTORY, EmpathyChannelFactoryClass)) + +typedef struct _EmpathyChannelFactory EmpathyChannelFactory; +typedef struct _EmpathyChannelFactoryClass EmpathyChannelFactoryClass; +typedef struct _EmpathyChannelFactoryPrivate EmpathyChannelFactoryPrivate; + +struct _EmpathyChannelFactory +{ + GObject parent; + EmpathyChannelFactoryPrivate *priv; +}; + +struct _EmpathyChannelFactoryClass +{ + GObjectClass parent_class; +}; + +GType empathy_channel_factory_get_type (void) G_GNUC_CONST; + +EmpathyChannelFactory * empathy_channel_factory_new (void); + +EmpathyChannelFactory * empathy_channel_factory_dup (void); + +G_END_DECLS +#endif /* __EMPATHY_CHANNEL_FACTORY_H__ */ diff --git a/libempathy/empathy-connectivity.c b/libempathy/empathy-connectivity.c index f02b7588b..42d5fcc1f 100644 --- a/libempathy/empathy-connectivity.c +++ b/libempathy/empathy-connectivity.c @@ -207,8 +207,8 @@ empathy_connectivity_init (EmpathyConnectivity *connectivity) if (connection != NULL) { priv->proxy = dbus_g_proxy_new_for_name (connection, - "org.moblin.connman", "/", - "org.moblin.connman.Manager"); + "net.connman", "/", + "net.connman.Manager"); dbus_g_object_register_marshaller ( _empathy_marshal_VOID__STRING, diff --git a/libempathy/empathy-ft-handler.c b/libempathy/empathy-ft-handler.c index f18278a71..94b9cf3d4 100644 --- a/libempathy/empathy-ft-handler.c +++ b/libempathy/empathy-ft-handler.c @@ -773,46 +773,31 @@ static void ft_handler_populate_outgoing_request (EmpathyFTHandler *handler) { guint contact_handle; - GHashTable *request; - GValue *value; EmpathyFTHandlerPriv *priv = GET_PRIV (handler); - - request = priv->request = g_hash_table_new_full (g_str_hash, g_str_equal, - NULL, (GDestroyNotify) tp_g_value_slice_free); + gchar *uri; contact_handle = empathy_contact_get_handle (priv->contact); - - /* org.freedesktop.Telepathy.Channel.ChannelType */ - value = tp_g_value_slice_new_string (TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER); - g_hash_table_insert (request, TP_IFACE_CHANNEL ".ChannelType", value); - - /* org.freedesktop.Telepathy.Channel.TargetHandleType */ - value = tp_g_value_slice_new_uint (TP_HANDLE_TYPE_CONTACT); - g_hash_table_insert (request, TP_IFACE_CHANNEL ".TargetHandleType", value); - - /* org.freedesktop.Telepathy.Channel.TargetHandle */ - value = tp_g_value_slice_new_uint (contact_handle); - g_hash_table_insert (request, TP_IFACE_CHANNEL ".TargetHandle", value); - - /* org.freedesktop.Telepathy.Channel.Type.FileTransfer.ContentType */ - value = tp_g_value_slice_new_string (priv->content_type); - g_hash_table_insert (request, - TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER ".ContentType", value); - - /* org.freedesktop.Telepathy.Channel.Type.FileTransfer.Filename */ - value = tp_g_value_slice_new_string (priv->filename); - g_hash_table_insert (request, - TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER ".Filename", value); - - /* org.freedesktop.Telepathy.Channel.Type.FileTransfer.Size */ - value = tp_g_value_slice_new_uint64 (priv->total_bytes); - g_hash_table_insert (request, - TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER ".Size", value); - - /* org.freedesktop.Telepathy.Channel.Type.FileTransfer.Date */ - value = tp_g_value_slice_new_uint64 ((guint64) priv->mtime); - g_hash_table_insert (request, - TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER ".Date", value); + uri = g_file_get_uri (priv->gfile); + + priv->request = tp_asv_new ( + TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING, + TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER, + TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT, + TP_HANDLE_TYPE_CONTACT, + TP_PROP_CHANNEL_TARGET_HANDLE, G_TYPE_UINT, + contact_handle, + TP_PROP_CHANNEL_TYPE_FILE_TRANSFER_CONTENT_TYPE, G_TYPE_STRING, + priv->content_type, + TP_PROP_CHANNEL_TYPE_FILE_TRANSFER_FILENAME, G_TYPE_STRING, + priv->filename, + TP_PROP_CHANNEL_TYPE_FILE_TRANSFER_SIZE, G_TYPE_UINT64, + priv->total_bytes, + TP_PROP_CHANNEL_TYPE_FILE_TRANSFER_DATE, G_TYPE_UINT64, + priv->mtime, + TP_PROP_CHANNEL_TYPE_FILE_TRANSFER_URI, G_TYPE_STRING, uri, + NULL); + + g_free (uri); } static gboolean diff --git a/libempathy/empathy-tp-call.h b/libempathy/empathy-tp-call.h deleted file mode 100644 index c633da3ad..000000000 --- a/libempathy/empathy-tp-call.h +++ /dev/null @@ -1,101 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Copyright (C) 2007 Elliot Fairweather - * Copyright (C) 2007-2008 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 - * - * Authors: Elliot Fairweather <elliot.fairweather@collabora.co.uk> - * Xavier Claessens <xclaesse@gmail.com> - */ - -#ifndef __EMPATHY_TP_CALL_H__ -#define __EMPATHY_TP_CALL_H__ - -#include <glib.h> -#include <telepathy-glib/channel.h> - -#include "empathy-contact.h" - -G_BEGIN_DECLS - -#define EMPATHY_TYPE_TP_CALL (empathy_tp_call_get_type ()) -#define EMPATHY_TP_CALL(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), \ - EMPATHY_TYPE_TP_CALL, EmpathyTpCall)) -#define EMPATHY_TP_CALL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), \ - EMPATHY_TYPE_TP_CALL, EmpathyTpCallClass)) -#define EMPATHY_IS_TP_CALL(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), \ - EMPATHY_TYPE_TP_CALL)) -#define EMPATHY_IS_TP_CALL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \ - EMPATHY_TYPE_TP_CALL)) -#define EMPATHY_TP_CALL_GET_CLASS(object) \ - (G_TYPE_INSTANCE_GET_CLASS ((object), \ - EMPATHY_TYPE_TP_CALL, EmpathyTpCallClass)) - -typedef struct _EmpathyTpCall EmpathyTpCall; -typedef struct _EmpathyTpCallClass EmpathyTpCallClass; - -struct _EmpathyTpCall { - GObject parent; - gpointer priv; -}; - -struct _EmpathyTpCallClass { - GObjectClass parent_class; -}; - -typedef enum -{ - EMPATHY_TP_CALL_STATUS_READYING, - EMPATHY_TP_CALL_STATUS_PENDING, - EMPATHY_TP_CALL_STATUS_ACCEPTED, - EMPATHY_TP_CALL_STATUS_CLOSED -} EmpathyTpCallStatus; - -typedef struct -{ - gboolean exists; - guint id; - guint state; - guint direction; -} EmpathyTpCallStream; - -GType empathy_tp_call_get_type (void) G_GNUC_CONST; -EmpathyTpCall *empathy_tp_call_new (TpAccount *account, - TpChannel *channel); -void empathy_tp_call_close (EmpathyTpCall *call); - -void empathy_tp_call_accept_incoming_call (EmpathyTpCall *call); -void empathy_tp_call_request_video_stream_direction (EmpathyTpCall *call, - gboolean is_sending); -void empathy_tp_call_start_tone (EmpathyTpCall *call, TpDTMFEvent event); -void empathy_tp_call_stop_tone (EmpathyTpCall *call); -gboolean empathy_tp_call_has_dtmf (EmpathyTpCall *call); -gboolean empathy_tp_call_is_receiving_video (EmpathyTpCall *call); -gboolean empathy_tp_call_is_sending_video (EmpathyTpCall *call); - -const gchar * empathy_tp_call_get_connection_manager (EmpathyTpCall *self); - -gboolean empathy_tp_call_has_initial_video (EmpathyTpCall *self); - -void empathy_tp_call_leave (EmpathyTpCall *self); - -EmpathyTpCallStatus empathy_tp_call_get_status (EmpathyTpCall *self); - -TpAccount * empathy_tp_call_get_account (EmpathyTpCall *self); - -G_END_DECLS - -#endif /* __EMPATHY_TP_CALL_H__ */ diff --git a/libempathy/empathy-tp-file.c b/libempathy/empathy-tp-file.c index 25a8c40bc..d69b2153a 100644 --- a/libempathy/empathy-tp-file.c +++ b/libempathy/empathy-tp-file.c @@ -65,7 +65,7 @@ /* EmpathyTpFile object */ -typedef struct { +struct _EmpathyTpFilePrivate { TpChannel *channel; GInputStream *in_stream; @@ -95,9 +95,7 @@ typedef struct { gboolean is_closing; gboolean is_closed; - - gboolean dispose_run; -} EmpathyTpFilePriv; +}; enum { PROP_0, @@ -105,8 +103,6 @@ enum { PROP_INCOMING }; -#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyTpFile) - G_DEFINE_TYPE (EmpathyTpFile, empathy_tp_file, G_TYPE_OBJECT); /* private functions */ @@ -118,16 +114,16 @@ tp_file_get_state_cb (TpProxy *proxy, gpointer user_data, GObject *weak_object) { - EmpathyTpFilePriv *priv = GET_PRIV (weak_object); + EmpathyTpFile *self = (EmpathyTpFile *) weak_object; if (error != NULL) { /* set a default value for the state */ - priv->state = TP_FILE_TRANSFER_STATE_NONE; + self->priv->state = TP_FILE_TRANSFER_STATE_NONE; return; } - priv->state = g_value_get_uint (value); + self->priv->state = g_value_get_uint (value); } static void @@ -137,7 +133,7 @@ tp_file_get_available_socket_types_cb (TpProxy *proxy, gpointer user_data, GObject *weak_object) { - EmpathyTpFilePriv *priv = GET_PRIV (weak_object); + EmpathyTpFile *self = (EmpathyTpFile *) weak_object; GHashTable *socket_types; GArray *access_controls; @@ -145,8 +141,8 @@ tp_file_get_available_socket_types_cb (TpProxy *proxy, !G_VALUE_HOLDS (value, TP_HASH_TYPE_SUPPORTED_SOCKET_MAP)) { /* set a default value */ - priv->socket_address_type = TP_SOCKET_ADDRESS_TYPE_UNIX; - priv->socket_access_control = TP_SOCKET_ACCESS_CONTROL_LOCALHOST; + self->priv->socket_address_type = TP_SOCKET_ADDRESS_TYPE_UNIX; + self->priv->socket_access_control = TP_SOCKET_ACCESS_CONTROL_LOCALHOST; goto out; } @@ -156,26 +152,26 @@ tp_file_get_available_socket_types_cb (TpProxy *proxy, if ((access_controls = g_hash_table_lookup (socket_types, GUINT_TO_POINTER (TP_SOCKET_ADDRESS_TYPE_UNIX))) != NULL) { - priv->socket_address_type = TP_SOCKET_ADDRESS_TYPE_UNIX; - priv->socket_access_control = TP_SOCKET_ACCESS_CONTROL_LOCALHOST; + self->priv->socket_address_type = TP_SOCKET_ADDRESS_TYPE_UNIX; + self->priv->socket_access_control = TP_SOCKET_ACCESS_CONTROL_LOCALHOST; goto out; } if ((access_controls = g_hash_table_lookup (socket_types, GUINT_TO_POINTER (TP_SOCKET_ADDRESS_TYPE_IPV4))) != NULL) { - priv->socket_address_type = TP_SOCKET_ADDRESS_TYPE_IPV4; + self->priv->socket_address_type = TP_SOCKET_ADDRESS_TYPE_IPV4; /* TODO: we should prefer PORT over LOCALHOST when the CM will * support it. */ - priv->socket_access_control = TP_SOCKET_ACCESS_CONTROL_LOCALHOST; + self->priv->socket_access_control = TP_SOCKET_ACCESS_CONTROL_LOCALHOST; } out: DEBUG ("Socket address type: %u, access control %u", - priv->socket_address_type, priv->socket_access_control); + self->priv->socket_address_type, self->priv->socket_access_control); } static void @@ -183,57 +179,51 @@ tp_file_invalidated_cb (TpProxy *proxy, guint domain, gint code, gchar *message, - EmpathyTpFile *tp_file) + EmpathyTpFile *self) { - EmpathyTpFilePriv *priv = GET_PRIV (tp_file); - DEBUG ("Channel invalidated: %s", message); - if (priv->state != TP_FILE_TRANSFER_STATE_COMPLETED && - priv->state != TP_FILE_TRANSFER_STATE_CANCELLED) + if (self->priv->state != TP_FILE_TRANSFER_STATE_COMPLETED && + self->priv->state != TP_FILE_TRANSFER_STATE_CANCELLED) { /* The channel is not in a finished state, an error occured */ - priv->state = TP_FILE_TRANSFER_STATE_CANCELLED; - priv->state_change_reason = + self->priv->state = TP_FILE_TRANSFER_STATE_CANCELLED; + self->priv->state_change_reason = TP_FILE_TRANSFER_STATE_CHANGE_REASON_LOCAL_ERROR; } } static void -ft_operation_close_clean (EmpathyTpFile *tp_file) +ft_operation_close_clean (EmpathyTpFile *self) { - EmpathyTpFilePriv *priv = GET_PRIV (tp_file); - - if (priv->is_closed) + if (self->priv->is_closed) return; DEBUG ("FT operation close clean"); - priv->is_closed = TRUE; + self->priv->is_closed = TRUE; - if (priv->op_callback != NULL) - priv->op_callback (tp_file, NULL, priv->op_user_data); + if (self->priv->op_callback != NULL) + self->priv->op_callback (self, NULL, self->priv->op_user_data); } static void -ft_operation_close_with_error (EmpathyTpFile *tp_file, +ft_operation_close_with_error (EmpathyTpFile *self, GError *error) { - EmpathyTpFilePriv *priv = GET_PRIV (tp_file); - - if (priv->is_closed) + if (self->priv->is_closed) return; DEBUG ("FT operation close with error %s", error->message); - priv->is_closed = TRUE; + self->priv->is_closed = TRUE; /* close the channel if it's not cancelled already */ - if (priv->state != TP_FILE_TRANSFER_STATE_CANCELLED) - empathy_tp_file_cancel (tp_file); + if (self->priv->state != TP_FILE_TRANSFER_STATE_CANCELLED) + empathy_tp_file_cancel (self); - if (priv->op_callback != NULL) - priv->op_callback (tp_file, error, priv->op_user_data); + if (self->priv->op_callback != NULL) + self->priv->op_callback (self, error, self->priv->op_user_data); } static void @@ -241,39 +231,34 @@ splice_stream_ready_cb (GObject *source, GAsyncResult *res, gpointer user_data) { - EmpathyTpFile *tp_file; - EmpathyTpFilePriv *priv; + EmpathyTpFile *self = user_data; GError *error = NULL; - tp_file = user_data; - priv = GET_PRIV (tp_file); - g_output_stream_splice_finish (G_OUTPUT_STREAM (source), res, &error); DEBUG ("Splice stream ready cb, error %p", error); - if (error != NULL && !priv->is_closing) + if (error != NULL && !self->priv->is_closing) { - ft_operation_close_with_error (tp_file, error); + ft_operation_close_with_error (self, error); g_clear_error (&error); return; } } static void -tp_file_start_transfer (EmpathyTpFile *tp_file) +tp_file_start_transfer (EmpathyTpFile *self) { gint fd, domain, res = 0; GError *error = NULL; struct sockaddr *my_addr = NULL; size_t my_size = 0; - EmpathyTpFilePriv *priv = GET_PRIV (tp_file); - if (priv->socket_address_type == TP_SOCKET_ADDRESS_TYPE_UNIX) + if (self->priv->socket_address_type == TP_SOCKET_ADDRESS_TYPE_UNIX) { domain = AF_UNIX; } - else if (priv->socket_address_type == TP_SOCKET_ADDRESS_TYPE_IPV4) + else if (self->priv->socket_address_type == TP_SOCKET_ADDRESS_TYPE_IPV4) { domain = AF_INET; } @@ -284,7 +269,7 @@ tp_file_start_transfer (EmpathyTpFile *tp_file) DEBUG ("Socket not supported, closing channel"); - ft_operation_close_with_error (tp_file, error); + ft_operation_close_with_error (self, error); g_clear_error (&error); return; @@ -301,32 +286,32 @@ tp_file_start_transfer (EmpathyTpFile *tp_file) DEBUG ("Failed to create socket, closing channel"); - ft_operation_close_with_error (tp_file, error); + ft_operation_close_with_error (self, error); g_clear_error (&error); return; } - if (priv->socket_address_type == TP_SOCKET_ADDRESS_TYPE_UNIX) + if (self->priv->socket_address_type == TP_SOCKET_ADDRESS_TYPE_UNIX) { struct sockaddr_un addr; memset (&addr, 0, sizeof (addr)); addr.sun_family = domain; - strncpy (addr.sun_path, priv->socket_address->data, - priv->socket_address->len); + strncpy (addr.sun_path, self->priv->socket_address->data, + self->priv->socket_address->len); my_addr = (struct sockaddr *) &addr; my_size = sizeof (addr); } - else if (priv->socket_address_type == TP_SOCKET_ADDRESS_TYPE_IPV4) + else if (self->priv->socket_address_type == TP_SOCKET_ADDRESS_TYPE_IPV4) { struct sockaddr_in addr; memset (&addr, 0, sizeof (addr)); addr.sin_family = domain; - inet_pton (AF_INET, priv->socket_address->data, &addr.sin_addr); - addr.sin_port = htons (priv->port); + inet_pton (AF_INET, self->priv->socket_address->data, &addr.sin_addr); + addr.sin_port = htons (self->priv->port); my_addr = (struct sockaddr *) &addr; my_size = sizeof (addr); @@ -343,7 +328,7 @@ tp_file_start_transfer (EmpathyTpFile *tp_file) DEBUG ("Failed to connect socket, closing channel"); - ft_operation_close_with_error (tp_file, error); + ft_operation_close_with_error (self, error); close (fd); g_clear_error (&error); @@ -352,23 +337,23 @@ tp_file_start_transfer (EmpathyTpFile *tp_file) DEBUG ("Start the transfer"); - priv->start_time = empathy_time_get_current (); + self->priv->start_time = empathy_time_get_current (); /* notify we're starting a transfer */ - if (priv->progress_callback != NULL) - priv->progress_callback (tp_file, 0, priv->progress_user_data); + if (self->priv->progress_callback != NULL) + self->priv->progress_callback (self, 0, self->priv->progress_user_data); - if (priv->incoming) + if (self->priv->incoming) { GInputStream *socket_stream; socket_stream = g_unix_input_stream_new (fd, TRUE); - g_output_stream_splice_async (priv->out_stream, socket_stream, + g_output_stream_splice_async (self->priv->out_stream, socket_stream, G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE | G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET, - G_PRIORITY_DEFAULT, priv->cancellable, - splice_stream_ready_cb, tp_file); + G_PRIORITY_DEFAULT, self->priv->cancellable, + splice_stream_ready_cb, self); g_object_unref (socket_stream); } @@ -378,11 +363,11 @@ tp_file_start_transfer (EmpathyTpFile *tp_file) socket_stream = g_unix_output_stream_new (fd, TRUE); - g_output_stream_splice_async (socket_stream, priv->in_stream, + g_output_stream_splice_async (socket_stream, self->priv->in_stream, G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE | G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET, - G_PRIORITY_DEFAULT, priv->cancellable, - splice_stream_ready_cb, tp_file); + G_PRIORITY_DEFAULT, self->priv->cancellable, + splice_stream_ready_cb, self); g_object_unref (socket_stream); } @@ -434,29 +419,29 @@ tp_file_state_changed_cb (TpChannel *proxy, gpointer user_data, GObject *weak_object) { - EmpathyTpFilePriv *priv = GET_PRIV (weak_object); + EmpathyTpFile *self = (EmpathyTpFile *) weak_object; GError *error = NULL; - if (state == priv->state) + if (state == self->priv->state) return; DEBUG ("File transfer state changed:\n" "old state = %u, state = %u, reason = %u\n" "\tincoming = %s, in_stream = %s, out_stream = %s", - priv->state, state, reason, - priv->incoming ? "yes" : "no", - priv->in_stream ? "present" : "not present", - priv->out_stream ? "present" : "not present"); + self->priv->state, state, reason, + self->priv->incoming ? "yes" : "no", + self->priv->in_stream ? "present" : "not present", + self->priv->out_stream ? "present" : "not present"); - priv->state = state; - priv->state_change_reason = reason; + self->priv->state = state; + self->priv->state_change_reason = reason; /* If the channel is open AND we have the socket path, we can start the * transfer. The socket path could be NULL if we are not doing the actual * data transfer but are just an observer for the channel. */ if (state == TP_FILE_TRANSFER_STATE_OPEN && - priv->socket_address != NULL) + self->priv->socket_address != NULL) tp_file_start_transfer (EMPATHY_TP_FILE (weak_object)); if (state == TP_FILE_TRANSFER_STATE_COMPLETED) @@ -464,7 +449,7 @@ tp_file_state_changed_cb (TpChannel *proxy, if (state == TP_FILE_TRANSFER_STATE_CANCELLED) { - error = error_from_state_change_reason (priv->state_change_reason); + error = error_from_state_change_reason (self->priv->state_change_reason); ft_operation_close_with_error (EMPATHY_TP_FILE (weak_object), error); g_clear_error (&error); } @@ -476,16 +461,16 @@ tp_file_transferred_bytes_changed_cb (TpChannel *proxy, gpointer user_data, GObject *weak_object) { - EmpathyTpFilePriv *priv = GET_PRIV (weak_object); + EmpathyTpFile *self = (EmpathyTpFile *) weak_object; /* don't notify for 0 bytes count */ if (count == 0) return; /* notify clients */ - if (priv->progress_callback != NULL) - priv->progress_callback (EMPATHY_TP_FILE (weak_object), - count, priv->progress_user_data); + if (self->priv->progress_callback != NULL) + self->priv->progress_callback (EMPATHY_TP_FILE (weak_object), + count, self->priv->progress_user_data); } static void @@ -495,11 +480,10 @@ ft_operation_provide_or_accept_file_cb (TpChannel *proxy, gpointer user_data, GObject *weak_object) { - EmpathyTpFile *tp_file = EMPATHY_TP_FILE (weak_object); + EmpathyTpFile *self = EMPATHY_TP_FILE (weak_object); GError *myerr = NULL; - EmpathyTpFilePriv *priv = GET_PRIV (tp_file); - g_cancellable_set_error_if_cancelled (priv->cancellable, &myerr); + g_cancellable_set_error_if_cancelled (self->priv->cancellable, &myerr); if (error != NULL) { @@ -517,14 +501,14 @@ ft_operation_provide_or_accept_file_cb (TpChannel *proxy, if (myerr != NULL) { DEBUG ("Error: %s", myerr->message); - ft_operation_close_with_error (tp_file, myerr); + ft_operation_close_with_error (self, myerr); g_clear_error (&myerr); return; } if (G_VALUE_TYPE (address) == DBUS_TYPE_G_UCHAR_ARRAY) { - priv->socket_address = g_value_dup_boxed (address); + self->priv->socket_address = g_value_dup_boxed (address); } else if (G_VALUE_TYPE (address) == G_TYPE_STRING) { @@ -533,9 +517,9 @@ ft_operation_provide_or_accept_file_cb (TpChannel *proxy, const gchar *path; path = g_value_get_string (address); - priv->socket_address = g_array_sized_new (TRUE, FALSE, sizeof (gchar), - strlen (path)); - g_array_insert_vals (priv->socket_address, 0, path, strlen (path)); + self->priv->socket_address = g_array_sized_new (TRUE, FALSE, + sizeof (gchar), strlen (path)); + g_array_insert_vals (self->priv->socket_address, 0, path, strlen (path)); } else if (G_VALUE_TYPE (address) == TP_STRUCT_TYPE_SOCKET_ADDRESS_IPV4) { @@ -548,23 +532,23 @@ ft_operation_provide_or_accept_file_cb (TpChannel *proxy, /* IPV4 address */ v = g_value_array_get_nth (val_array, 0); addr = g_value_get_string (v); - priv->socket_address = g_array_sized_new (TRUE, FALSE, sizeof (gchar), - strlen (addr)); - g_array_insert_vals (priv->socket_address, 0, addr, strlen (addr)); + self->priv->socket_address = g_array_sized_new (TRUE, FALSE, + sizeof (gchar), strlen (addr)); + g_array_insert_vals (self->priv->socket_address, 0, addr, strlen (addr)); /* port number */ v = g_value_array_get_nth (val_array, 1); - priv->port = g_value_get_uint (v); + self->priv->port = g_value_get_uint (v); } DEBUG ("Got socket address: %s, port (not zero if IPV4): %d", - priv->socket_address->data, priv->port); + self->priv->socket_address->data, self->priv->port); /* if the channel is already open, start the transfer now, otherwise, * wait for the state change signal. */ - if (priv->state == TP_FILE_TRANSFER_STATE_OPEN) - tp_file_start_transfer (tp_file); + if (self->priv->state == TP_FILE_TRANSFER_STATE_OPEN) + tp_file_start_transfer (self); } static void @@ -585,34 +569,57 @@ file_read_async_cb (GObject *source, gpointer user_data) { GValue nothing = { 0 }; - EmpathyTpFile *tp_file = user_data; - EmpathyTpFilePriv *priv; + EmpathyTpFile *self = user_data; GFileInputStream *in_stream; GError *error = NULL; - priv = GET_PRIV (tp_file); - in_stream = g_file_read_finish (G_FILE (source), res, &error); - if (error != NULL && !priv->is_closing) + if (error != NULL && !self->priv->is_closing) { - ft_operation_close_with_error (tp_file, error); + ft_operation_close_with_error (self, error); g_clear_error (&error); return; } - priv->in_stream = G_INPUT_STREAM (in_stream); + self->priv->in_stream = G_INPUT_STREAM (in_stream); /* we don't impose specific interface/port requirements even * if we're not using UNIX sockets. */ - initialize_empty_ac_variant (priv->socket_access_control, ¬hing); + initialize_empty_ac_variant (self->priv->socket_access_control, ¬hing); tp_cli_channel_type_file_transfer_call_provide_file ( - priv->channel, -1, - priv->socket_address_type, priv->socket_access_control, + self->priv->channel, -1, + self->priv->socket_address_type, self->priv->socket_access_control, ¬hing, ft_operation_provide_or_accept_file_cb, - NULL, NULL, G_OBJECT (tp_file)); + NULL, NULL, G_OBJECT (self)); +} + +static void +file_transfer_set_uri_cb (TpProxy *proxy, + const GError *error, + gpointer user_data, + GObject *weak_object) +{ + GValue nothing = { 0 }; + EmpathyTpFile *self = (EmpathyTpFile *) weak_object; + + if (error != NULL) + { + DEBUG ("Failed to set FileTransfer.URI: %s", error->message); + /* We don't return as that's not a big issue */ + } + + /* we don't impose specific interface/port requirements even + * if we're not using UNIX sockets. + */ + initialize_empty_ac_variant (self->priv->socket_access_control, ¬hing); + + tp_cli_channel_type_file_transfer_call_accept_file (self->priv->channel, + -1, self->priv->socket_address_type, self->priv->socket_access_control, + ¬hing, self->priv->offset, + ft_operation_provide_or_accept_file_cb, NULL, NULL, weak_object); } static void @@ -620,35 +627,34 @@ file_replace_async_cb (GObject *source, GAsyncResult *res, gpointer user_data) { - GValue nothing = { 0 }; - EmpathyTpFile *tp_file = user_data; - EmpathyTpFilePriv *priv; + EmpathyTpFile *self = user_data; GError *error = NULL; GFileOutputStream *out_stream; + GFile *file = G_FILE (source); + gchar *uri; + GValue *value; - priv = GET_PRIV (tp_file); - - out_stream = g_file_replace_finish (G_FILE (source), res, &error); + out_stream = g_file_replace_finish (file, res, &error); if (error != NULL) { - ft_operation_close_with_error (tp_file, error); + ft_operation_close_with_error (self, error); g_clear_error (&error); return; } - priv->out_stream = G_OUTPUT_STREAM (out_stream); + self->priv->out_stream = G_OUTPUT_STREAM (out_stream); - /* we don't impose specific interface/port requirements even - * if we're not using UNIX sockets. - */ - initialize_empty_ac_variant (priv->socket_access_control, ¬hing); + /* Try setting FileTranfer.URI before accepting the file */ + uri = g_file_get_uri (file); + value = tp_g_value_slice_new_take_string (uri); + + tp_cli_dbus_properties_call_set (self->priv->channel, -1, + TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER, "URI", value, + file_transfer_set_uri_cb, NULL, NULL, G_OBJECT (self)); - tp_cli_channel_type_file_transfer_call_accept_file (priv->channel, - -1, priv->socket_address_type, priv->socket_access_control, - ¬hing, priv->offset, - ft_operation_provide_or_accept_file_cb, NULL, NULL, G_OBJECT (tp_file)); + tp_g_value_slice_free (value); } static void @@ -657,71 +663,53 @@ channel_closed_cb (TpChannel *proxy, gpointer user_data, GObject *weak_object) { - EmpathyTpFile *tp_file = EMPATHY_TP_FILE (weak_object); - EmpathyTpFilePriv *priv = GET_PRIV (tp_file); + EmpathyTpFile *self = EMPATHY_TP_FILE (weak_object); gboolean cancel = GPOINTER_TO_INT (user_data); DEBUG ("Channel is closed, should cancel %s", cancel ? "True" : "False"); - if (priv->cancellable != NULL && - !g_cancellable_is_cancelled (priv->cancellable) && cancel) - g_cancellable_cancel (priv->cancellable); + if (self->priv->cancellable != NULL && + !g_cancellable_is_cancelled (self->priv->cancellable) && cancel) + g_cancellable_cancel (self->priv->cancellable); } static void -close_channel_internal (EmpathyTpFile *tp_file, +close_channel_internal (EmpathyTpFile *self, gboolean cancel) { - EmpathyTpFilePriv *priv = GET_PRIV (tp_file); - DEBUG ("Closing channel, should cancel %s", cancel ? "True" : "False"); - priv->is_closing = TRUE; + self->priv->is_closing = TRUE; - tp_cli_channel_call_close (priv->channel, -1, - channel_closed_cb, GINT_TO_POINTER (cancel), NULL, G_OBJECT (tp_file)); + tp_cli_channel_call_close (self->priv->channel, -1, + channel_closed_cb, GINT_TO_POINTER (cancel), NULL, G_OBJECT (self)); } /* GObject methods */ static void -empathy_tp_file_init (EmpathyTpFile *tp_file) +empathy_tp_file_init (EmpathyTpFile *self) { - EmpathyTpFilePriv *priv; - - priv = G_TYPE_INSTANCE_GET_PRIVATE ((tp_file), - EMPATHY_TYPE_TP_FILE, EmpathyTpFilePriv); - - tp_file->priv = priv; + self->priv = G_TYPE_INSTANCE_GET_PRIVATE ((self), + EMPATHY_TYPE_TP_FILE, EmpathyTpFilePrivate); } static void do_dispose (GObject *object) { - EmpathyTpFilePriv *priv = GET_PRIV (object); + EmpathyTpFile *self = (EmpathyTpFile *) object; - if (priv->dispose_run) - return; - - priv->dispose_run = TRUE; - - if (priv->channel != NULL) + if (self->priv->channel != NULL) { - g_signal_handlers_disconnect_by_func (priv->channel, + g_signal_handlers_disconnect_by_func (self->priv->channel, tp_file_invalidated_cb, object); - g_object_unref (priv->channel); - priv->channel = NULL; + tp_clear_object (&self->priv->channel); } - if (priv->in_stream != NULL) - g_object_unref (priv->in_stream); - - if (priv->out_stream != NULL) - g_object_unref (priv->out_stream); - - if (priv->cancellable != NULL) - g_object_unref (priv->cancellable); + tp_clear_object (&self->priv->in_stream); + tp_clear_object (&self->priv->out_stream); + tp_clear_object (&self->priv->cancellable); G_OBJECT_CLASS (empathy_tp_file_parent_class)->dispose (object); } @@ -729,14 +717,14 @@ do_dispose (GObject *object) static void do_finalize (GObject *object) { - EmpathyTpFilePriv *priv = GET_PRIV (object); + EmpathyTpFile *self = (EmpathyTpFile *) object; DEBUG ("%p", object); - if (priv->socket_address != NULL) + if (self->priv->socket_address != NULL) { - g_array_free (priv->socket_address, TRUE); - priv->socket_address = NULL; + g_array_free (self->priv->socket_address, TRUE); + self->priv->socket_address = NULL; } G_OBJECT_CLASS (empathy_tp_file_parent_class)->finalize (object); @@ -748,15 +736,15 @@ do_get_property (GObject *object, GValue *value, GParamSpec *pspec) { - EmpathyTpFilePriv *priv = GET_PRIV (object); + EmpathyTpFile *self = (EmpathyTpFile *) object; switch (param_id) { case PROP_CHANNEL: - g_value_set_object (value, priv->channel); + g_value_set_object (value, self->priv->channel); break; case PROP_INCOMING: - g_value_set_boolean (value, priv->incoming); + g_value_set_boolean (value, self->priv->incoming); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec); @@ -770,11 +758,12 @@ do_set_property (GObject *object, const GValue *value, GParamSpec *pspec) { - EmpathyTpFilePriv *priv = GET_PRIV (object); + EmpathyTpFile *self = (EmpathyTpFile *) object; + switch (param_id) { case PROP_CHANNEL: - priv->channel = g_object_ref (g_value_get_object (value)); + self->priv->channel = g_object_ref (g_value_get_object (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec); @@ -785,33 +774,29 @@ do_set_property (GObject *object, static void do_constructed (GObject *object) { - EmpathyTpFile *tp_file; - EmpathyTpFilePriv *priv; + EmpathyTpFile *self = (EmpathyTpFile *) object; - tp_file = EMPATHY_TP_FILE (object); - priv = GET_PRIV (tp_file); + g_signal_connect (self->priv->channel, "invalidated", + G_CALLBACK (tp_file_invalidated_cb), self); - g_signal_connect (priv->channel, "invalidated", - G_CALLBACK (tp_file_invalidated_cb), tp_file); - - priv->incoming = !tp_channel_get_requested (priv->channel); + self->priv->incoming = !tp_channel_get_requested (self->priv->channel); tp_cli_channel_type_file_transfer_connect_to_file_transfer_state_changed ( - priv->channel, tp_file_state_changed_cb, NULL, NULL, object, NULL); + self->priv->channel, tp_file_state_changed_cb, NULL, NULL, object, NULL); tp_cli_channel_type_file_transfer_connect_to_transferred_bytes_changed ( - priv->channel, tp_file_transferred_bytes_changed_cb, + self->priv->channel, tp_file_transferred_bytes_changed_cb, NULL, NULL, object, NULL); - tp_cli_dbus_properties_call_get (priv->channel, + tp_cli_dbus_properties_call_get (self->priv->channel, -1, TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER, "State", tp_file_get_state_cb, NULL, NULL, object); - tp_cli_dbus_properties_call_get (priv->channel, + tp_cli_dbus_properties_call_get (self->priv->channel, -1, TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER, "AvailableSocketTypes", tp_file_get_available_socket_types_cb, NULL, NULL, object); - priv->state_change_reason = + self->priv->state_change_reason = TP_FILE_TRANSFER_STATE_CHANGE_REASON_NONE; } @@ -855,7 +840,7 @@ empathy_tp_file_class_init (EmpathyTpFileClass *klass) FALSE, G_PARAM_READABLE)); - g_type_class_add_private (object_class, sizeof (EmpathyTpFilePriv)); + g_type_class_add_private (object_class, sizeof (EmpathyTpFilePrivate)); } /* public methods */ @@ -874,20 +859,20 @@ empathy_tp_file_class_init (EmpathyTpFileClass *klass) EmpathyTpFile * empathy_tp_file_new (TpChannel *channel) { - EmpathyTpFile *tp_file; + EmpathyTpFile *self; g_return_val_if_fail (TP_IS_CHANNEL (channel), NULL); - tp_file = g_object_new (EMPATHY_TYPE_TP_FILE, + self = g_object_new (EMPATHY_TYPE_TP_FILE, "channel", channel, NULL); - return tp_file; + return self; } /** * empathy_tp_file_accept: - * @tp_file: an incoming #EmpathyTpFile + * @self: an incoming #EmpathyTpFile * @offset: the offset of @gfile where we should start writing * @gfile: the destination #GFile for the transfer * @cancellable: a #GCancellable @@ -905,7 +890,7 @@ empathy_tp_file_new (TpChannel *channel) * actually cancel an ongoing #EmpathyTpFile. */ void -empathy_tp_file_accept (EmpathyTpFile *tp_file, +empathy_tp_file_accept (EmpathyTpFile *self, guint64 offset, GFile *gfile, GCancellable *cancellable, @@ -914,27 +899,25 @@ empathy_tp_file_accept (EmpathyTpFile *tp_file, EmpathyTpFileOperationCallback op_callback, gpointer op_user_data) { - EmpathyTpFilePriv *priv = GET_PRIV (tp_file); - - g_return_if_fail (EMPATHY_IS_TP_FILE (tp_file)); + g_return_if_fail (EMPATHY_IS_TP_FILE (self)); g_return_if_fail (G_IS_FILE (gfile)); g_return_if_fail (G_IS_CANCELLABLE (cancellable)); - priv->cancellable = g_object_ref (cancellable); - priv->progress_callback = progress_callback; - priv->progress_user_data = progress_user_data; - priv->op_callback = op_callback; - priv->op_user_data = op_user_data; - priv->offset = offset; + self->priv->cancellable = g_object_ref (cancellable); + self->priv->progress_callback = progress_callback; + self->priv->progress_user_data = progress_user_data; + self->priv->op_callback = op_callback; + self->priv->op_user_data = op_user_data; + self->priv->offset = offset; g_file_replace_async (gfile, NULL, FALSE, G_FILE_CREATE_NONE, - G_PRIORITY_DEFAULT, cancellable, file_replace_async_cb, tp_file); + G_PRIORITY_DEFAULT, cancellable, file_replace_async_cb, self); } /** * empathy_tp_file_offer: - * @tp_file: an outgoing #EmpathyTpFile + * @self: an outgoing #EmpathyTpFile * @gfile: the source #GFile for the transfer * @cancellable: a #GCancellable * @progress_callback: function to callback with progress information @@ -951,7 +934,7 @@ empathy_tp_file_accept (EmpathyTpFile *tp_file, * actually cancel an ongoing #EmpathyTpFile. */ void -empathy_tp_file_offer (EmpathyTpFile *tp_file, +empathy_tp_file_offer (EmpathyTpFile *self, GFile *gfile, GCancellable *cancellable, EmpathyTpFileProgressCallback progress_callback, @@ -959,68 +942,62 @@ empathy_tp_file_offer (EmpathyTpFile *tp_file, EmpathyTpFileOperationCallback op_callback, gpointer op_user_data) { - EmpathyTpFilePriv *priv = GET_PRIV (tp_file); - - g_return_if_fail (EMPATHY_IS_TP_FILE (tp_file)); + g_return_if_fail (EMPATHY_IS_TP_FILE (self)); g_return_if_fail (G_IS_FILE (gfile)); g_return_if_fail (G_IS_CANCELLABLE (cancellable)); - priv->cancellable = g_object_ref (cancellable); - priv->progress_callback = progress_callback; - priv->progress_user_data = progress_user_data; - priv->op_callback = op_callback; - priv->op_user_data = op_user_data; + self->priv->cancellable = g_object_ref (cancellable); + self->priv->progress_callback = progress_callback; + self->priv->progress_user_data = progress_user_data; + self->priv->op_callback = op_callback; + self->priv->op_user_data = op_user_data; g_file_read_async (gfile, G_PRIORITY_DEFAULT, cancellable, - file_read_async_cb, tp_file); + file_read_async_cb, self); } /** * empathy_tp_file_is_incoming: - * @tp_file: an #EmpathyTpFile + * @self: an #EmpathyTpFile * - * Returns whether @tp_file is incoming. + * Returns whether @self is incoming. * - * Return value: %TRUE if the @tp_file is incoming, otherwise %FALSE + * Return value: %TRUE if the @self is incoming, otherwise %FALSE */ gboolean -empathy_tp_file_is_incoming (EmpathyTpFile *tp_file) +empathy_tp_file_is_incoming (EmpathyTpFile *self) { - EmpathyTpFilePriv *priv; - - g_return_val_if_fail (EMPATHY_IS_TP_FILE (tp_file), FALSE); - - priv = GET_PRIV (tp_file); + g_return_val_if_fail (EMPATHY_IS_TP_FILE (self), FALSE); - return priv->incoming; + return self->priv->incoming; } /** * empathy_tp_file_cancel: - * @tp_file: an #EmpathyTpFile + * @self: an #EmpathyTpFile * * Cancels an ongoing #EmpathyTpFile, first closing the channel and then * cancelling any I/O operation and closing the socket. */ void -empathy_tp_file_cancel (EmpathyTpFile *tp_file) +empathy_tp_file_cancel (EmpathyTpFile *self) { - g_return_if_fail (EMPATHY_IS_TP_FILE (tp_file)); + g_return_if_fail (EMPATHY_IS_TP_FILE (self)); - close_channel_internal (tp_file, TRUE); + close_channel_internal (self, TRUE); } /** * empathy_tp_file_close: - * @tp_file: an #EmpathyTpFile + * @self: an #EmpathyTpFile * * Closes the channel for an ongoing #EmpathyTpFile. It's safe to call this * method after the transfer has ended. */ void -empathy_tp_file_close (EmpathyTpFile *tp_file) +empathy_tp_file_close (EmpathyTpFile *self) { - g_return_if_fail (EMPATHY_IS_TP_FILE (tp_file)); + g_return_if_fail (EMPATHY_IS_TP_FILE (self)); - close_channel_internal (tp_file, FALSE); + close_channel_internal (self, FALSE); } diff --git a/libempathy/empathy-tp-file.h b/libempathy/empathy-tp-file.h index ad3af72ee..aca8a0f89 100644 --- a/libempathy/empathy-tp-file.h +++ b/libempathy/empathy-tp-file.h @@ -56,11 +56,12 @@ typedef enum { } EmpathyFTErrorEnum; typedef struct _EmpathyTpFile EmpathyTpFile; +typedef struct _EmpathyTpFilePrivate EmpathyTpFilePrivate; typedef struct _EmpathyTpFileClass EmpathyTpFileClass; struct _EmpathyTpFile { GObject parent; - gpointer priv; + EmpathyTpFilePrivate *priv; }; struct _EmpathyTpFileClass { diff --git a/libempathy/empathy-tp-call.c b/libempathy/empathy-tp-streamed-media.c index 1a53de65d..b79e4b6b5 100644 --- a/libempathy/empathy-tp-call.c +++ b/libempathy/empathy-tp-streamed-media.c @@ -27,7 +27,7 @@ #include <telepathy-glib/interfaces.h> #include <telepathy-glib/util.h> -#include "empathy-tp-call.h" +#include "empathy-tp-streamed-media.h" #include "empathy-tp-contact-factory.h" #include "empathy-utils.h" #include "empathy-marshal.h" @@ -35,7 +35,7 @@ #define DEBUG_FLAG EMPATHY_DEBUG_VOIP #include "empathy-debug.h" -#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyTpCall) +#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyTpStreamedMedia) typedef struct { gboolean dispose_has_run; @@ -45,9 +45,9 @@ typedef struct gboolean is_incoming; guint status; - EmpathyTpCallStream *audio; - EmpathyTpCallStream *video; -} EmpathyTpCallPriv; + EmpathyTpStreamedMediaStream *audio; + EmpathyTpStreamedMediaStream *video; +} EmpathyTpStreamedMediaPriv; /* signal enum */ enum { @@ -69,17 +69,17 @@ enum PROP_VIDEO_STREAM }; -G_DEFINE_TYPE (EmpathyTpCall, empathy_tp_call, G_TYPE_OBJECT) +G_DEFINE_TYPE (EmpathyTpStreamedMedia, empathy_tp_streamed_media, G_TYPE_OBJECT) static void -tp_call_add_stream (EmpathyTpCall *call, +tp_streamed_media_add_stream (EmpathyTpStreamedMedia *call, guint stream_id, guint contact_handle, guint stream_type, guint stream_state, guint stream_direction) { - EmpathyTpCallPriv *priv = GET_PRIV (call); + EmpathyTpStreamedMediaPriv *priv = GET_PRIV (call); switch (stream_type) { @@ -107,7 +107,7 @@ tp_call_add_stream (EmpathyTpCall *call, } static void -tp_call_stream_added_cb (TpChannel *channel, +tp_streamed_media_stream_added_cb (TpChannel *channel, guint stream_id, guint contact_handle, guint stream_type, @@ -117,18 +117,18 @@ tp_call_stream_added_cb (TpChannel *channel, DEBUG ("Stream added - stream id: %d, contact handle: %d, stream type: %d", stream_id, contact_handle, stream_type); - tp_call_add_stream (EMPATHY_TP_CALL (call), stream_id, contact_handle, + tp_streamed_media_add_stream (EMPATHY_TP_STREAMED_MEDIA (call), stream_id, contact_handle, stream_type, TP_MEDIA_STREAM_STATE_DISCONNECTED, TP_MEDIA_STREAM_DIRECTION_NONE); } static void -tp_call_stream_removed_cb (TpChannel *channel, +tp_streamed_media_stream_removed_cb (TpChannel *channel, guint stream_id, gpointer user_data, GObject *call) { - EmpathyTpCallPriv *priv = GET_PRIV (call); + EmpathyTpStreamedMediaPriv *priv = GET_PRIV (call); DEBUG ("Stream removed - stream id: %d", stream_id); @@ -145,13 +145,13 @@ tp_call_stream_removed_cb (TpChannel *channel, } static void -tp_call_stream_state_changed_cb (TpChannel *proxy, +tp_streamed_media_stream_state_changed_cb (TpChannel *proxy, guint stream_id, guint stream_state, gpointer user_data, GObject *call) { - EmpathyTpCallPriv *priv = GET_PRIV (call); + EmpathyTpStreamedMediaPriv *priv = GET_PRIV (call); DEBUG ("Stream state changed - stream id: %d, state state: %d", stream_id, stream_state); @@ -169,14 +169,14 @@ tp_call_stream_state_changed_cb (TpChannel *proxy, } static void -tp_call_stream_direction_changed_cb (TpChannel *channel, +tp_streamed_media_stream_direction_changed_cb (TpChannel *channel, guint stream_id, guint stream_direction, guint pending_flags, gpointer user_data, GObject *call) { - EmpathyTpCallPriv *priv = GET_PRIV (call); + EmpathyTpStreamedMediaPriv *priv = GET_PRIV (call); DEBUG ("Stream direction changed - stream: %d, direction: %d", stream_id, stream_direction); @@ -194,7 +194,7 @@ tp_call_stream_direction_changed_cb (TpChannel *channel, } static void -tp_call_request_streams_cb (TpChannel *channel, +tp_streamed_media_request_streams_cb (TpChannel *channel, const GPtrArray *streams, const GError *error, gpointer user_data, @@ -224,16 +224,16 @@ tp_call_request_streams_cb (TpChannel *channel, stream_state = g_value_get_uint (g_value_array_get_nth (values, 3)); stream_direction = g_value_get_uint (g_value_array_get_nth (values, 4)); - tp_call_add_stream (EMPATHY_TP_CALL (call), stream_id, contact_handle, + tp_streamed_media_add_stream (EMPATHY_TP_STREAMED_MEDIA (call), stream_id, contact_handle, stream_type, stream_state, stream_direction); } } static void -tp_call_request_streams_for_capabilities (EmpathyTpCall *call, +tp_streamed_media_request_streams_for_capabilities (EmpathyTpStreamedMedia *call, EmpathyCapabilities capabilities) { - EmpathyTpCallPriv *priv = GET_PRIV (call); + EmpathyTpStreamedMediaPriv *priv = GET_PRIV (call); GArray *stream_types; guint handle; guint stream_type; @@ -259,20 +259,20 @@ tp_call_request_streams_for_capabilities (EmpathyTpCall *call, } tp_cli_channel_type_streamed_media_call_request_streams (priv->channel, -1, - handle, stream_types, tp_call_request_streams_cb, NULL, NULL, + handle, stream_types, tp_streamed_media_request_streams_cb, NULL, NULL, G_OBJECT (call)); g_array_free (stream_types, TRUE); } static void -tp_call_got_contact_cb (TpConnection *connection, +tp_streamed_media_got_contact_cb (TpConnection *connection, EmpathyContact *contact, const GError *error, gpointer user_data, GObject *call) { - EmpathyTpCallPriv *priv = GET_PRIV (call); + EmpathyTpStreamedMediaPriv *priv = GET_PRIV (call); if (error) { @@ -282,9 +282,9 @@ tp_call_got_contact_cb (TpConnection *connection, priv->contact = g_object_ref (contact); - if (priv->status < EMPATHY_TP_CALL_STATUS_PENDING) + if (priv->status < EMPATHY_TP_STREAMED_MEDIA_STATUS_PENDING) { - priv->status = EMPATHY_TP_CALL_STATUS_PENDING; + priv->status = EMPATHY_TP_STREAMED_MEDIA_STATUS_PENDING; g_object_notify (G_OBJECT (call), "status"); } @@ -292,9 +292,9 @@ tp_call_got_contact_cb (TpConnection *connection, } static void -tp_call_update_status (EmpathyTpCall *call) +tp_streamed_media_update_status (EmpathyTpStreamedMedia *call) { - EmpathyTpCallPriv *priv = GET_PRIV (call); + EmpathyTpStreamedMediaPriv *priv = GET_PRIV (call); TpHandle self_handle; const TpIntSet *set; TpIntSetIter iter; @@ -306,11 +306,11 @@ tp_call_update_status (EmpathyTpCall *call) tp_intset_iter_init (&iter, set); while (tp_intset_iter_next (&iter)) { - if (priv->status == EMPATHY_TP_CALL_STATUS_PENDING && + if (priv->status == EMPATHY_TP_STREAMED_MEDIA_STATUS_PENDING && ((priv->is_incoming && iter.element == self_handle) || (!priv->is_incoming && iter.element != self_handle))) { - priv->status = EMPATHY_TP_CALL_STATUS_ACCEPTED; + priv->status = EMPATHY_TP_STREAMED_MEDIA_STATUS_ACCEPTED; g_object_notify (G_OBJECT (call), "status"); } } @@ -319,21 +319,21 @@ tp_call_update_status (EmpathyTpCall *call) } static void -tp_call_channel_invalidated_cb (TpChannel *channel, +tp_streamed_media_channel_invalidated_cb (TpChannel *channel, GQuark domain, gint code, gchar *message, - EmpathyTpCall *call) + EmpathyTpStreamedMedia *call) { - EmpathyTpCallPriv *priv = GET_PRIV (call); + EmpathyTpStreamedMediaPriv *priv = GET_PRIV (call); DEBUG ("Channel invalidated: %s", message); - priv->status = EMPATHY_TP_CALL_STATUS_CLOSED; + priv->status = EMPATHY_TP_STREAMED_MEDIA_STATUS_CLOSED; g_object_notify (G_OBJECT (call), "status"); } static void -tp_call_async_cb (TpProxy *proxy, +tp_streamed_media_async_cb (TpProxy *proxy, const GError *error, gpointer user_data, GObject *call) @@ -343,15 +343,15 @@ tp_call_async_cb (TpProxy *proxy, } static void -tp_call_stream_error_cb (TpChannel *channel, +tp_streamed_media_stream_error_cb (TpChannel *channel, guint stream_id, guint error_code, const gchar *msg, gpointer user_data, GObject *call) { - EmpathyTpCall *self = EMPATHY_TP_CALL (call); - EmpathyTpCallPriv *priv = GET_PRIV (self); + EmpathyTpStreamedMedia *self = EMPATHY_TP_STREAMED_MEDIA (call); + EmpathyTpStreamedMediaPriv *priv = GET_PRIV (self); DEBUG ("Stream error on stream %u: %s (code: %u)", stream_id, msg, error_code); @@ -371,35 +371,35 @@ tp_call_stream_error_cb (TpChannel *channel, } static GObject * -tp_call_constructor (GType type, +tp_streamed_media_constructor (GType type, guint n_construct_params, GObjectConstructParam *construct_params) { GObject *object; - EmpathyTpCall *call; - EmpathyTpCallPriv *priv; + EmpathyTpStreamedMedia *call; + EmpathyTpStreamedMediaPriv *priv; - object = G_OBJECT_CLASS (empathy_tp_call_parent_class)->constructor (type, + object = G_OBJECT_CLASS (empathy_tp_streamed_media_parent_class)->constructor (type, n_construct_params, construct_params); - call = EMPATHY_TP_CALL (object); + call = EMPATHY_TP_STREAMED_MEDIA (object); priv = GET_PRIV (call); /* Setup streamed media channel */ g_signal_connect (priv->channel, "invalidated", - G_CALLBACK (tp_call_channel_invalidated_cb), call); + G_CALLBACK (tp_streamed_media_channel_invalidated_cb), call); tp_cli_channel_type_streamed_media_connect_to_stream_added (priv->channel, - tp_call_stream_added_cb, NULL, NULL, G_OBJECT (call), NULL); + tp_streamed_media_stream_added_cb, NULL, NULL, G_OBJECT (call), NULL); tp_cli_channel_type_streamed_media_connect_to_stream_removed (priv->channel, - tp_call_stream_removed_cb, NULL, NULL, G_OBJECT (call), NULL); + tp_streamed_media_stream_removed_cb, NULL, NULL, G_OBJECT (call), NULL); tp_cli_channel_type_streamed_media_connect_to_stream_state_changed (priv->channel, - tp_call_stream_state_changed_cb, NULL, NULL, G_OBJECT (call), NULL); + tp_streamed_media_stream_state_changed_cb, NULL, NULL, G_OBJECT (call), NULL); tp_cli_channel_type_streamed_media_connect_to_stream_direction_changed (priv->channel, - tp_call_stream_direction_changed_cb, NULL, NULL, G_OBJECT (call), NULL); + tp_streamed_media_stream_direction_changed_cb, NULL, NULL, G_OBJECT (call), NULL); tp_cli_channel_type_streamed_media_connect_to_stream_error (priv->channel, - tp_call_stream_error_cb, NULL, NULL, G_OBJECT (call), NULL); + tp_streamed_media_stream_error_cb, NULL, NULL, G_OBJECT (call), NULL); tp_cli_channel_type_streamed_media_call_list_streams (priv->channel, -1, - tp_call_request_streams_cb, NULL, NULL, G_OBJECT (call)); + tp_streamed_media_request_streams_cb, NULL, NULL, G_OBJECT (call)); /* Is the call incoming? */ priv->is_incoming = !tp_channel_get_requested (priv->channel); @@ -407,20 +407,20 @@ tp_call_constructor (GType type, /* Get the remote contact */ empathy_tp_contact_factory_get_from_handle ( tp_channel_borrow_connection (priv->channel), - tp_channel_get_handle (priv->channel, NULL), tp_call_got_contact_cb, + tp_channel_get_handle (priv->channel, NULL), tp_streamed_media_got_contact_cb, NULL, NULL, object); /* Update status when members changes */ - tp_call_update_status (call); + tp_streamed_media_update_status (call); tp_g_signal_connect_object (priv->channel, "group-members-changed", - G_CALLBACK (tp_call_update_status), call, G_CONNECT_SWAPPED); + G_CALLBACK (tp_streamed_media_update_status), call, G_CONNECT_SWAPPED); return object; } static void -tp_call_dispose (GObject *object) +tp_streamed_media_dispose (GObject *object) { - EmpathyTpCallPriv *priv = GET_PRIV (object); + EmpathyTpStreamedMediaPriv *priv = GET_PRIV (object); DEBUG ("Disposing: %p, %d", object, priv->dispose_has_run); @@ -432,7 +432,7 @@ tp_call_dispose (GObject *object) if (priv->channel != NULL) { g_signal_handlers_disconnect_by_func (priv->channel, - tp_call_channel_invalidated_cb, object); + tp_streamed_media_channel_invalidated_cb, object); g_object_unref (priv->channel); priv->channel = NULL; @@ -443,30 +443,30 @@ tp_call_dispose (GObject *object) tp_clear_object (&priv->account); - if (G_OBJECT_CLASS (empathy_tp_call_parent_class)->dispose) - G_OBJECT_CLASS (empathy_tp_call_parent_class)->dispose (object); + if (G_OBJECT_CLASS (empathy_tp_streamed_media_parent_class)->dispose) + G_OBJECT_CLASS (empathy_tp_streamed_media_parent_class)->dispose (object); } static void -tp_call_finalize (GObject *object) +tp_streamed_media_finalize (GObject *object) { - EmpathyTpCallPriv *priv = GET_PRIV (object); + EmpathyTpStreamedMediaPriv *priv = GET_PRIV (object); DEBUG ("Finalizing: %p", object); - g_slice_free (EmpathyTpCallStream, priv->audio); - g_slice_free (EmpathyTpCallStream, priv->video); + g_slice_free (EmpathyTpStreamedMediaStream, priv->audio); + g_slice_free (EmpathyTpStreamedMediaStream, priv->video); - (G_OBJECT_CLASS (empathy_tp_call_parent_class)->finalize) (object); + (G_OBJECT_CLASS (empathy_tp_streamed_media_parent_class)->finalize) (object); } static void -tp_call_set_property (GObject *object, +tp_streamed_media_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { - EmpathyTpCallPriv *priv = GET_PRIV (object); + EmpathyTpStreamedMediaPriv *priv = GET_PRIV (object); switch (prop_id) { @@ -483,12 +483,12 @@ tp_call_set_property (GObject *object, } static void -tp_call_get_property (GObject *object, +tp_streamed_media_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { - EmpathyTpCallPriv *priv = GET_PRIV (object); + EmpathyTpStreamedMediaPriv *priv = GET_PRIV (object); switch (prop_id) { @@ -517,17 +517,17 @@ tp_call_get_property (GObject *object, } static void -empathy_tp_call_class_init (EmpathyTpCallClass *klass) +empathy_tp_streamed_media_class_init (EmpathyTpStreamedMediaClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - object_class->constructor = tp_call_constructor; - object_class->dispose = tp_call_dispose; - object_class->finalize = tp_call_finalize; - object_class->set_property = tp_call_set_property; - object_class->get_property = tp_call_get_property; + object_class->constructor = tp_streamed_media_constructor; + object_class->dispose = tp_streamed_media_dispose; + object_class->finalize = tp_streamed_media_finalize; + object_class->set_property = tp_streamed_media_set_property; + object_class->get_property = tp_streamed_media_get_property; - g_type_class_add_private (klass, sizeof (EmpathyTpCallPriv)); + g_type_class_add_private (klass, sizeof (EmpathyTpStreamedMediaPriv)); g_object_class_install_property (object_class, PROP_ACCOUNT, g_param_spec_object ("account", "TpAccount", "TpAccount", @@ -581,42 +581,42 @@ empathy_tp_call_class_init (EmpathyTpCallClass *klass) } static void -empathy_tp_call_init (EmpathyTpCall *call) +empathy_tp_streamed_media_init (EmpathyTpStreamedMedia *call) { - EmpathyTpCallPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (call, - EMPATHY_TYPE_TP_CALL, EmpathyTpCallPriv); + EmpathyTpStreamedMediaPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (call, + EMPATHY_TYPE_TP_STREAMED_MEDIA, EmpathyTpStreamedMediaPriv); call->priv = priv; - priv->status = EMPATHY_TP_CALL_STATUS_READYING; + priv->status = EMPATHY_TP_STREAMED_MEDIA_STATUS_READYING; priv->contact = NULL; - priv->audio = g_slice_new0 (EmpathyTpCallStream); - priv->video = g_slice_new0 (EmpathyTpCallStream); + priv->audio = g_slice_new0 (EmpathyTpStreamedMediaStream); + priv->video = g_slice_new0 (EmpathyTpStreamedMediaStream); priv->audio->exists = FALSE; priv->video->exists = FALSE; } -EmpathyTpCall * -empathy_tp_call_new (TpAccount *account, +EmpathyTpStreamedMedia * +empathy_tp_streamed_media_new (TpAccount *account, TpChannel *channel) { g_return_val_if_fail (TP_IS_ACCOUNT (account), NULL); g_return_val_if_fail (TP_IS_CHANNEL (channel), NULL); - return g_object_new (EMPATHY_TYPE_TP_CALL, + return g_object_new (EMPATHY_TYPE_TP_STREAMED_MEDIA, "account", account, "channel", channel, NULL); } void -empathy_tp_call_accept_incoming_call (EmpathyTpCall *call) +empathy_tp_streamed_media_accept_incoming_call (EmpathyTpStreamedMedia *call) { - EmpathyTpCallPriv *priv = GET_PRIV (call); + EmpathyTpStreamedMediaPriv *priv = GET_PRIV (call); TpHandle self_handle; GArray handles = {(gchar *) &self_handle, 1}; - g_return_if_fail (EMPATHY_IS_TP_CALL (call)); - g_return_if_fail (priv->status == EMPATHY_TP_CALL_STATUS_PENDING); + g_return_if_fail (EMPATHY_IS_TP_STREAMED_MEDIA (call)); + g_return_if_fail (priv->status == EMPATHY_TP_STREAMED_MEDIA_STATUS_PENDING); if (!priv->is_incoming) return; @@ -629,13 +629,13 @@ empathy_tp_call_accept_incoming_call (EmpathyTpCall *call) } void -empathy_tp_call_close (EmpathyTpCall *call) +empathy_tp_streamed_media_close (EmpathyTpStreamedMedia *call) { - EmpathyTpCallPriv *priv = GET_PRIV (call); + EmpathyTpStreamedMediaPriv *priv = GET_PRIV (call); - g_return_if_fail (EMPATHY_IS_TP_CALL (call)); + g_return_if_fail (EMPATHY_IS_TP_STREAMED_MEDIA (call)); - if (priv->status == EMPATHY_TP_CALL_STATUS_CLOSED) + if (priv->status == EMPATHY_TP_STREAMED_MEDIA_STATUS_CLOSED) return; DEBUG ("Closing channel"); @@ -643,26 +643,26 @@ empathy_tp_call_close (EmpathyTpCall *call) tp_cli_channel_call_close (priv->channel, -1, NULL, NULL, NULL, NULL); - priv->status = EMPATHY_TP_CALL_STATUS_CLOSED; + priv->status = EMPATHY_TP_STREAMED_MEDIA_STATUS_CLOSED; g_object_notify (G_OBJECT (call), "status"); } void -empathy_tp_call_request_video_stream_direction (EmpathyTpCall *call, +empathy_tp_streamed_media_request_video_stream_direction (EmpathyTpStreamedMedia *call, gboolean is_sending) { - EmpathyTpCallPriv *priv = GET_PRIV (call); + EmpathyTpStreamedMediaPriv *priv = GET_PRIV (call); guint new_direction; - g_return_if_fail (EMPATHY_IS_TP_CALL (call)); - g_return_if_fail (priv->status == EMPATHY_TP_CALL_STATUS_ACCEPTED); + g_return_if_fail (EMPATHY_IS_TP_STREAMED_MEDIA (call)); + g_return_if_fail (priv->status == EMPATHY_TP_STREAMED_MEDIA_STATUS_ACCEPTED); DEBUG ("Requesting video stream direction - is_sending: %d", is_sending); if (!priv->video->exists) { if (is_sending) - tp_call_request_streams_for_capabilities (call, + tp_streamed_media_request_streams_for_capabilities (call, EMPATHY_CAPABILITIES_VIDEO); return; } @@ -675,56 +675,56 @@ empathy_tp_call_request_video_stream_direction (EmpathyTpCall *call, tp_cli_channel_type_streamed_media_call_request_stream_direction (priv->channel, -1, priv->video->id, new_direction, (tp_cli_channel_type_streamed_media_callback_for_request_stream_direction) - tp_call_async_cb, NULL, NULL, G_OBJECT (call)); + tp_streamed_media_async_cb, NULL, NULL, G_OBJECT (call)); } void -empathy_tp_call_start_tone (EmpathyTpCall *call, TpDTMFEvent event) +empathy_tp_streamed_media_start_tone (EmpathyTpStreamedMedia *call, TpDTMFEvent event) { - EmpathyTpCallPriv *priv = GET_PRIV (call); + EmpathyTpStreamedMediaPriv *priv = GET_PRIV (call); - g_return_if_fail (EMPATHY_IS_TP_CALL (call)); - g_return_if_fail (priv->status == EMPATHY_TP_CALL_STATUS_ACCEPTED); + g_return_if_fail (EMPATHY_IS_TP_STREAMED_MEDIA (call)); + g_return_if_fail (priv->status == EMPATHY_TP_STREAMED_MEDIA_STATUS_ACCEPTED); if (!priv->audio->exists) return; tp_cli_channel_interface_dtmf_call_start_tone (priv->channel, -1, priv->audio->id, event, - (tp_cli_channel_interface_dtmf_callback_for_start_tone) tp_call_async_cb, + (tp_cli_channel_interface_dtmf_callback_for_start_tone) tp_streamed_media_async_cb, "starting tone", NULL, G_OBJECT (call)); } void -empathy_tp_call_stop_tone (EmpathyTpCall *call) +empathy_tp_streamed_media_stop_tone (EmpathyTpStreamedMedia *call) { - EmpathyTpCallPriv *priv = GET_PRIV (call); + EmpathyTpStreamedMediaPriv *priv = GET_PRIV (call); - g_return_if_fail (EMPATHY_IS_TP_CALL (call)); - g_return_if_fail (priv->status == EMPATHY_TP_CALL_STATUS_ACCEPTED); + g_return_if_fail (EMPATHY_IS_TP_STREAMED_MEDIA (call)); + g_return_if_fail (priv->status == EMPATHY_TP_STREAMED_MEDIA_STATUS_ACCEPTED); if (!priv->audio->exists) return; tp_cli_channel_interface_dtmf_call_stop_tone (priv->channel, -1, priv->audio->id, - (tp_cli_channel_interface_dtmf_callback_for_stop_tone) tp_call_async_cb, + (tp_cli_channel_interface_dtmf_callback_for_stop_tone) tp_streamed_media_async_cb, "stoping tone", NULL, G_OBJECT (call)); } gboolean -empathy_tp_call_has_dtmf (EmpathyTpCall *call) +empathy_tp_streamed_media_has_dtmf (EmpathyTpStreamedMedia *call) { - EmpathyTpCallPriv *priv = GET_PRIV (call); + EmpathyTpStreamedMediaPriv *priv = GET_PRIV (call); - g_return_val_if_fail (EMPATHY_IS_TP_CALL (call), FALSE); + g_return_val_if_fail (EMPATHY_IS_TP_STREAMED_MEDIA (call), FALSE); return tp_proxy_has_interface_by_id (priv->channel, TP_IFACE_QUARK_CHANNEL_INTERFACE_DTMF); } /** - * empathy_tp_call_is_receiving_video: + * empathy_tp_streamed_media_is_receiving_video: * @call: the call * * Indicates if the call is receiving video or not. @@ -732,11 +732,11 @@ empathy_tp_call_has_dtmf (EmpathyTpCall *call) * Returns: %TRUE if the call is currently receiving video, %FALSE otherwise. */ gboolean -empathy_tp_call_is_receiving_video (EmpathyTpCall *call) +empathy_tp_streamed_media_is_receiving_video (EmpathyTpStreamedMedia *call) { - EmpathyTpCallPriv *priv = GET_PRIV (call); + EmpathyTpStreamedMediaPriv *priv = GET_PRIV (call); - g_return_val_if_fail (EMPATHY_IS_TP_CALL (call), FALSE); + g_return_val_if_fail (EMPATHY_IS_TP_STREAMED_MEDIA (call), FALSE); if (!priv->video->exists) return FALSE; @@ -746,7 +746,7 @@ empathy_tp_call_is_receiving_video (EmpathyTpCall *call) } /** - * empathy_tp_call_is_sending_video: + * empathy_tp_streamed_media_is_sending_video: * @call: the call * * Indicates if the call is sending video or not. @@ -754,11 +754,11 @@ empathy_tp_call_is_receiving_video (EmpathyTpCall *call) * Returns: %TRUE if the call is currently sending video, %FALSE otherwise. */ gboolean -empathy_tp_call_is_sending_video (EmpathyTpCall *call) +empathy_tp_streamed_media_is_sending_video (EmpathyTpStreamedMedia *call) { - EmpathyTpCallPriv *priv = GET_PRIV (call); + EmpathyTpStreamedMediaPriv *priv = GET_PRIV (call); - g_return_val_if_fail (EMPATHY_IS_TP_CALL (call), FALSE); + g_return_val_if_fail (EMPATHY_IS_TP_STREAMED_MEDIA (call), FALSE); if (!priv->video->exists) return FALSE; @@ -768,17 +768,17 @@ empathy_tp_call_is_sending_video (EmpathyTpCall *call) } const gchar * -empathy_tp_call_get_connection_manager (EmpathyTpCall *self) +empathy_tp_streamed_media_get_connection_manager (EmpathyTpStreamedMedia *self) { - EmpathyTpCallPriv *priv = GET_PRIV (self); + EmpathyTpStreamedMediaPriv *priv = GET_PRIV (self); return tp_account_get_connection_manager (priv->account); } gboolean -empathy_tp_call_has_initial_video (EmpathyTpCall *self) +empathy_tp_streamed_media_has_initial_video (EmpathyTpStreamedMedia *self) { - EmpathyTpCallPriv *priv = GET_PRIV (self); + EmpathyTpStreamedMediaPriv *priv = GET_PRIV (self); GHashTable *props; gboolean initial_video; gboolean valid; @@ -803,26 +803,26 @@ leave_remove_members_cb (TpChannel *proxy, gpointer user_data, GObject *weak_object) { - EmpathyTpCall *self = user_data; + EmpathyTpStreamedMedia *self = user_data; if (error == NULL) return; DEBUG ("RemoveMembers failed (%s); closing the channel", error->message); - empathy_tp_call_close (self); + empathy_tp_streamed_media_close (self); } void -empathy_tp_call_leave (EmpathyTpCall *self) +empathy_tp_streamed_media_leave (EmpathyTpStreamedMedia *self) { - EmpathyTpCallPriv *priv = GET_PRIV (self); + EmpathyTpStreamedMediaPriv *priv = GET_PRIV (self); TpHandle self_handle; GArray array = { (gchar *) &self_handle, 1 }; if (!tp_proxy_has_interface_by_id (priv->channel, TP_IFACE_QUARK_CHANNEL_INTERFACE_GROUP)) { - empathy_tp_call_close (self); + empathy_tp_streamed_media_close (self); return; } @@ -830,7 +830,7 @@ empathy_tp_call_leave (EmpathyTpCall *self) if (self_handle == 0) { /* we are not member of the channel */ - empathy_tp_call_close (self); + empathy_tp_streamed_media_close (self); return; } @@ -838,18 +838,18 @@ empathy_tp_call_leave (EmpathyTpCall *self) "", leave_remove_members_cb, self, NULL, G_OBJECT (self)); } -EmpathyTpCallStatus -empathy_tp_call_get_status (EmpathyTpCall *self) +EmpathyTpStreamedMediaStatus +empathy_tp_streamed_media_get_status (EmpathyTpStreamedMedia *self) { - EmpathyTpCallPriv *priv = GET_PRIV (self); + EmpathyTpStreamedMediaPriv *priv = GET_PRIV (self); return priv->status; } TpAccount * -empathy_tp_call_get_account (EmpathyTpCall *self) +empathy_tp_streamed_media_get_account (EmpathyTpStreamedMedia *self) { - EmpathyTpCallPriv *priv = GET_PRIV (self); + EmpathyTpStreamedMediaPriv *priv = GET_PRIV (self); return priv->account; } diff --git a/libempathy/empathy-tp-streamed-media.h b/libempathy/empathy-tp-streamed-media.h new file mode 100644 index 000000000..35612b292 --- /dev/null +++ b/libempathy/empathy-tp-streamed-media.h @@ -0,0 +1,113 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * Copyright (C) 2007 Elliot Fairweather + * Copyright (C) 2007-2008 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 + * + * Authors: Elliot Fairweather <elliot.fairweather@collabora.co.uk> + * Xavier Claessens <xclaesse@gmail.com> + */ + +#ifndef __EMPATHY_TP_STREAMED_MEDIA_H__ +#define __EMPATHY_TP_STREAMED_MEDIA_H__ + +#include <glib.h> +#include <telepathy-glib/channel.h> + +#include "empathy-contact.h" + +G_BEGIN_DECLS + +#define EMPATHY_TYPE_TP_STREAMED_MEDIA (empathy_tp_streamed_media_get_type ()) +#define EMPATHY_TP_STREAMED_MEDIA(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), \ + EMPATHY_TYPE_TP_STREAMED_MEDIA, EmpathyTpStreamedMedia)) +#define EMPATHY_TP_STREAMED_MEDIA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), \ + EMPATHY_TYPE_TP_STREAMED_MEDIA, EmpathyTpStreamedMediaClass)) +#define EMPATHY_IS_TP_STREAMED_MEDIA(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), \ + EMPATHY_TYPE_TP_STREAMED_MEDIA)) +#define EMPATHY_IS_TP_STREAMED_MEDIA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \ + EMPATHY_TYPE_TP_STREAMED_MEDIA)) +#define EMPATHY_TP_STREAMED_MEDIA_GET_CLASS(object) \ + (G_TYPE_INSTANCE_GET_CLASS ((object), \ + EMPATHY_TYPE_TP_STREAMED_MEDIA, EmpathyTpStreamedMediaClass)) + +typedef struct _EmpathyTpStreamedMedia EmpathyTpStreamedMedia; +typedef struct _EmpathyTpStreamedMediaClass EmpathyTpStreamedMediaClass; + +struct _EmpathyTpStreamedMedia { + GObject parent; + gpointer priv; +}; + +struct _EmpathyTpStreamedMediaClass { + GObjectClass parent_class; +}; + +typedef enum +{ + EMPATHY_TP_STREAMED_MEDIA_STATUS_READYING, + EMPATHY_TP_STREAMED_MEDIA_STATUS_PENDING, + EMPATHY_TP_STREAMED_MEDIA_STATUS_ACCEPTED, + EMPATHY_TP_STREAMED_MEDIA_STATUS_CLOSED +} EmpathyTpStreamedMediaStatus; + +typedef struct +{ + gboolean exists; + guint id; + guint state; + guint direction; +} EmpathyTpStreamedMediaStream; + +GType empathy_tp_streamed_media_get_type (void) G_GNUC_CONST; +EmpathyTpStreamedMedia *empathy_tp_streamed_media_new (TpAccount *account, + TpChannel *channel); +void empathy_tp_streamed_media_close (EmpathyTpStreamedMedia *streamed_media); + +void empathy_tp_streamed_media_accept_incoming_call ( + EmpathyTpStreamedMedia *streamed_media); +void empathy_tp_streamed_media_request_video_stream_direction ( + EmpathyTpStreamedMedia *streamed_media, + gboolean is_sending); +void empathy_tp_streamed_media_start_tone ( + EmpathyTpStreamedMedia *streamed_media, + TpDTMFEvent event); +void empathy_tp_streamed_media_stop_tone ( + EmpathyTpStreamedMedia *streamed_media); +gboolean empathy_tp_streamed_media_has_dtmf ( + EmpathyTpStreamedMedia *streamed_media); +gboolean empathy_tp_streamed_media_is_receiving_video ( + EmpathyTpStreamedMedia *streamed_media); +gboolean empathy_tp_streamed_media_is_sending_video ( + EmpathyTpStreamedMedia *streamed_media); + +const gchar * empathy_tp_streamed_media_get_connection_manager ( + EmpathyTpStreamedMedia *self); + +gboolean empathy_tp_streamed_media_has_initial_video ( + EmpathyTpStreamedMedia *self); + +void empathy_tp_streamed_media_leave (EmpathyTpStreamedMedia *self); + +EmpathyTpStreamedMediaStatus empathy_tp_streamed_media_get_status ( + EmpathyTpStreamedMedia *self); + +TpAccount * empathy_tp_streamed_media_get_account ( + EmpathyTpStreamedMedia *self); + +G_END_DECLS + +#endif /* __EMPATHY_TP_STREAMED_MEDIA_H__ */ diff --git a/libempathy/empathy-utils.c b/libempathy/empathy-utils.c index 6f9e2564a..038334e27 100644 --- a/libempathy/empathy-utils.c +++ b/libempathy/empathy-utils.c @@ -1,6 +1,6 @@ /* * Copyright (C) 2003-2007 Imendio AB - * Copyright (C) 2007-2008 Collabora Ltd. + * Copyright (C) 2007-2011 Collabora Ltd. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -50,7 +50,6 @@ #include "empathy-individual-manager.h" #include "empathy-dispatcher.h" #include "empathy-idle.h" -#include "empathy-tp-call.h" #include "empathy-tp-contact-factory.h" #include <extensions/extensions.h> @@ -238,6 +237,66 @@ empathy_xml_node_find_child_prop_value (xmlNodePtr node, return found; } +GHashTable * +empathy_call_create_streamed_media_request (EmpathyContact *contact, + gboolean initial_audio, + gboolean initial_video) +{ + return tp_asv_new ( + TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING, + TP_IFACE_CHANNEL_TYPE_STREAMED_MEDIA, + TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT, + TP_HANDLE_TYPE_CONTACT, + TP_PROP_CHANNEL_TARGET_HANDLE, G_TYPE_UINT, + empathy_contact_get_handle (contact), + TP_PROP_CHANNEL_TYPE_STREAMED_MEDIA_INITIAL_AUDIO, G_TYPE_BOOLEAN, + initial_audio, + TP_PROP_CHANNEL_TYPE_STREAMED_MEDIA_INITIAL_VIDEO, G_TYPE_BOOLEAN, + initial_video, + NULL); +} + +static void +create_media_channel_cb (GObject *source, + GAsyncResult *result, + gpointer user_data) +{ + GError *error = NULL; + + if (!tp_account_channel_request_create_channel_finish (TP_ACCOUNT_CHANNEL_REQUEST (source), + result, + &error)) { + DEBUG ("Failed to create StreamedMedia channel: %s", error->message); + g_error_free (error); + } +} + +void +empathy_call_new_with_streams (EmpathyContact *contact, + gboolean initial_audio, + gboolean initial_video, + gint64 timestamp) +{ + GHashTable *request; + TpAccount *account; + TpAccountChannelRequest *req; + + request = empathy_call_create_streamed_media_request (contact, + initial_audio, + initial_video); + + account = empathy_contact_get_account (contact); + + req = tp_account_channel_request_new (account, request, timestamp); + + tp_account_channel_request_create_channel_async (req, NULL, NULL, + create_media_channel_cb, + NULL); + + g_hash_table_unref (request); + g_object_unref (req); +} + const gchar * empathy_presence_get_default_message (TpConnectionPresenceType presence) { diff --git a/libempathy/empathy-utils.h b/libempathy/empathy-utils.h index 70e8fb461..efa5d11d1 100644 --- a/libempathy/empathy-utils.h +++ b/libempathy/empathy-utils.h @@ -1,7 +1,7 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* * Copyright (C) 2003-2007 Imendio AB - * Copyright (C) 2007-2008 Collabora Ltd. + * Copyright (C) 2007-2011 Collabora Ltd. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -65,6 +65,15 @@ xmlNodePtr empathy_xml_node_find_child_prop_value (xmlNodePtr node, const gchar *prop_name, const gchar *prop_value); +/* Calls */ +void empathy_call_new_with_streams (EmpathyContact *contact, + gboolean initial_audio, + gboolean initial_video, + gint64 timestamp); +GHashTable * empathy_call_create_streamed_media_request (EmpathyContact *contact, + gboolean initial_audio, + gboolean initial_video); + /* Others */ const gchar * empathy_presence_get_default_message (TpConnectionPresenceType presence); const gchar * empathy_presence_to_str (TpConnectionPresenceType presence); diff --git a/po/POTFILES.in b/po/POTFILES.in index e8a99fe1f..37296e52f 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -80,7 +80,7 @@ src/empathy-accounts-dialog.c src/empathy-auth-client.c src/empathy-auto-salut-account-helper.c src/empathy-av.c -src/empathy-call-window.c +src/empathy-streamed-media-window.c [type: gettext/glade]src/empathy-call-window.ui src/empathy-chat-window.c [type: gettext/glade]src/empathy-chat-window.ui diff --git a/src/Makefile.am b/src/Makefile.am index c77b63a91..1b0d4e078 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -87,10 +87,13 @@ bin_PROGRAMS = \ $(NULL) libexec_PROGRAMS = \ - empathy-av \ - empathy-auth-client + empathy-auth-client \ + empathy-av -BUILT_SOURCES= +BUILT_SOURCES = \ + src-marshal.h \ + src-marshal.c \ + src-marshal.list empathy_accounts_SOURCES = \ empathy-accounts.c empathy-accounts.h \ @@ -106,13 +109,25 @@ empathy_debugger_SOURCES = \ empathy-debugger.c \ $(NULL) -empathy_av_SOURCES = \ +empathy_av_SOURCES = \ empathy-av.c \ - empathy-call-window-fullscreen.c empathy-call-window-fullscreen.h \ - empathy-call-window.c empathy-call-window.h \ - empathy-sidebar.c empathy-sidebar.h \ + empathy-streamed-media-factory.c \ + empathy-streamed-media-factory.h \ + empathy-streamed-media-handler.c \ + empathy-streamed-media-handler.h \ + empathy-streamed-media-window-fullscreen.c \ + empathy-streamed-media-window-fullscreen.h \ + empathy-streamed-media-window.c \ + empathy-streamed-media-window.h \ + empathy-sidebar.c \ + empathy-sidebar.h \ $(NULL) +nodist_empathy_av_SOURCES = $(BUILT_SOURCES) + +empathy_av_CFLAGS = $(EMPATHY_AV_CFLAGS) +empathy_av_LDFLAGS = $(EMPATHY_AV_LIBS) + empathy_auth_client_SOURCES = \ empathy-auth-client.c @@ -199,6 +214,24 @@ dist_man_MANS = \ empathy.1 \ empathy-accounts.1 +src-marshal.list: $(empathy_SOURCES) Makefile.am + $(AM_V_GEN)( cd $(srcdir) && \ + sed -n -e 's/.*src_marshal_\([[:upper:][:digit:]]*__[[:upper:][:digit:]_]*\).*/\1/p' \ + $(wildcard *.c) ) \ + | sed -e 's/__/:/' -e 'y/_/,/' | sort -u > $@.tmp + @if cmp -s $@.tmp $@; then \ + rm $@.tmp; \ + else \ + mv $@.tmp $@; \ + fi + +%-marshal.h: %-marshal.list Makefile + $(AM_V_GEN)$(GLIB_GENMARSHAL) --header --prefix=_$(subst -,_,$*)_marshal $< > $*-marshal.h + +%-marshal.c: %-marshal.list Makefile + $(AM_V_GEN)echo "#include \"src-marshal.h\"" > $@ && \ + $(GLIB_GENMARSHAL) --body --prefix=_$(subst -,_,$*)_marshal $< >> $*-marshal.c + # rules for making the glib enum objects %-enumtypes.h: %.h Makefile.in $(AM_V_GEN)glib-mkenums \ diff --git a/src/empathy-av.c b/src/empathy-av.c index 9ef0fbf29..f87bef2cd 100644 --- a/src/empathy-av.c +++ b/src/empathy-av.c @@ -28,10 +28,10 @@ #include <telepathy-glib/debug-sender.h> -#include <libempathy/empathy-call-factory.h> #include <libempathy-gtk/empathy-ui-utils.h> -#include "empathy-call-window.h" +#include "empathy-streamed-media-window.h" +#include "empathy-streamed-media-factory.h" #define DEBUG_FLAG EMPATHY_DEBUG_VOIP #include <libempathy/empathy-debug.h> @@ -81,7 +81,7 @@ stop_timer (void) } static void -call_window_destroy_cb (EmpathyCallWindow *window, +call_window_destroy_cb (EmpathyStreamedMediaWindow *window, gpointer user_data) { nb_windows--; @@ -93,16 +93,16 @@ call_window_destroy_cb (EmpathyCallWindow *window, } static void -new_call_handler_cb (EmpathyCallFactory *factory, - EmpathyCallHandler *handler, +new_call_handler_cb (EmpathyStreamedMediaFactory *factory, + EmpathyStreamedMediaHandler *handler, gboolean outgoing, gpointer user_data) { - EmpathyCallWindow *window; + EmpathyStreamedMediaWindow *window; DEBUG ("Create a new call window"); - window = empathy_call_window_new (handler); + window = empathy_streamed_media_window_new (handler); nb_windows++; stop_timer (); @@ -124,7 +124,7 @@ main (int argc, #ifdef ENABLE_DEBUG TpDebugSender *debug_sender; #endif - EmpathyCallFactory *call_factory; + EmpathyStreamedMediaFactory *call_factory; GError *error = NULL; /* Init */ @@ -158,12 +158,12 @@ main (int argc, g_log_set_default_handler (tp_debug_sender_log_handler, G_LOG_DOMAIN); #endif - call_factory = empathy_call_factory_initialise (); + call_factory = empathy_streamed_media_factory_initialise (); - g_signal_connect (G_OBJECT (call_factory), "new-call-handler", + g_signal_connect (G_OBJECT (call_factory), "new-streamed-media-handler", G_CALLBACK (new_call_handler_cb), NULL); - if (!empathy_call_factory_register (call_factory, &error)) + if (!empathy_streamed_media_factory_register (call_factory, &error)) { g_critical ("Failed to register Handler: %s", error->message); g_error_free (error); diff --git a/src/empathy-call-window-fullscreen.h b/src/empathy-call-window-fullscreen.h deleted file mode 100644 index 8bde16ced..000000000 --- a/src/empathy-call-window-fullscreen.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * empathy-call-window-fullscreen.h - Header for EmpathyCallWindowFullscreen - * Copyright (C) 2009 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 __EMPATHY_CALL_WINDOW_FULLSCREEN_H__ -#define __EMPATHY_CALL_WINDOW_FULLSCREEN_H__ - -#include <glib-object.h> -#include <gtk/gtk.h> - -#include "empathy-call-window.h" - -G_BEGIN_DECLS - -typedef struct _EmpathyCallWindowFullscreen EmpathyCallWindowFullscreen; -typedef struct _EmpathyCallWindowFullscreenClass - EmpathyCallWindowFullscreenClass; - -struct _EmpathyCallWindowFullscreenClass { - GObjectClass parent_class; -}; - -struct _EmpathyCallWindowFullscreen { - GObject parent; - gboolean is_fullscreen; - GtkWidget *leave_fullscreen_button; -}; - -GType empathy_call_window_fullscreen_get_type (void); - -/* TYPE MACROS */ -#define EMPATHY_TYPE_CALL_WINDOW_FULLSCREEN \ - (empathy_call_window_fullscreen_get_type ()) -#define EMPATHY_CALL_WINDOW_FULLSCREEN(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), EMPATHY_TYPE_CALL_WINDOW_FULLSCREEN, \ - EmpathyCallWindowFullscreen)) -#define EMPATHY_CALL_WINDOW_FULLSCREEN_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass), EMPATHY_TYPE_CALL_WINDOW_FULLSCREEN, \ - EmpathyCallWindowClassFullscreen)) -#define EMPATHY_IS_CALL_WINDOW_FULLSCREEN(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj), EMPATHY_TYPE_CALL_WINDOW_FULLSCREEN)) -#define EMPATHY_IS_CALL_WINDOW_FULLSCREEN_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass), EMPATHY_TYPE_CALL_WINDOW_FULLSCREEN)) -#define EMPATHY_CALL_WINDOW_FULLSCREEN_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS ((obj), EMPATHY_TYPE_CALL_WINDOW_FULLSCREEN, \ - EmpathyCallWindowFullscreenClass)) - -EmpathyCallWindowFullscreen *empathy_call_window_fullscreen_new ( - EmpathyCallWindow *parent); - -void empathy_call_window_fullscreen_set_fullscreen ( - EmpathyCallWindowFullscreen *fs, - gboolean set_fullscreen); -void empathy_call_window_fullscreen_set_video_widget ( - EmpathyCallWindowFullscreen *fs, - GtkWidget *video_widget); -void empathy_call_window_fullscreen_show_popup ( - EmpathyCallWindowFullscreen *fs); - -G_END_DECLS - -#endif /* #ifndef __EMPATHY_CALL_WINDOW_FULLSCREEN_H__*/ diff --git a/src/empathy-call-window.h b/src/empathy-call-window.h deleted file mode 100644 index 01ea5def7..000000000 --- a/src/empathy-call-window.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * empathy-call-window.h - Header for EmpathyCallWindow - * Copyright (C) 2008 Collabora Ltd. - * @author Sjoerd Simons <sjoerd.simons@collabora.co.uk> - * - * 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 __EMPATHY_CALL_WINDOW_H__ -#define __EMPATHY_CALL_WINDOW_H__ - -#include <glib-object.h> -#include <gtk/gtk.h> -#include <libempathy/empathy-call-handler.h> - -G_BEGIN_DECLS - -typedef struct _EmpathyCallWindow EmpathyCallWindow; -typedef struct _EmpathyCallWindowClass EmpathyCallWindowClass; - -struct _EmpathyCallWindowClass { - GtkWindowClass parent_class; -}; - -struct _EmpathyCallWindow { - GtkWindow parent; -}; - -GType empathy_call_window_get_type (void); - -/* TYPE MACROS */ -#define EMPATHY_TYPE_CALL_WINDOW \ - (empathy_call_window_get_type ()) -#define EMPATHY_CALL_WINDOW(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), EMPATHY_TYPE_CALL_WINDOW, \ - EmpathyCallWindow)) -#define EMPATHY_CALL_WINDOW_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass), EMPATHY_TYPE_CALL_WINDOW, \ - EmpathyCallWindowClass)) -#define EMPATHY_IS_CALL_WINDOW(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj), EMPATHY_TYPE_CALL_WINDOW)) -#define EMPATHY_IS_CALL_WINDOW_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass), EMPATHY_TYPE_CALL_WINDOW)) -#define EMPATHY_CALL_WINDOW_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS ((obj), EMPATHY_TYPE_CALL_WINDOW, \ - EmpathyCallWindowClass)) - -EmpathyCallWindow *empathy_call_window_new (EmpathyCallHandler *handler); - -G_END_DECLS - -#endif /* #ifndef __EMPATHY_CALL_WINDOW_H__*/ diff --git a/src/empathy-event-manager.c b/src/empathy-event-manager.c index b7883ad57..2e6526fdb 100644 --- a/src/empathy-event-manager.c +++ b/src/empathy-event-manager.c @@ -33,10 +33,9 @@ #include <libempathy/empathy-tp-contact-factory.h> #include <libempathy/empathy-contact-manager.h> #include <libempathy/empathy-tp-chat.h> -#include <libempathy/empathy-tp-call.h> +#include <libempathy/empathy-tp-streamed-media.h> #include <libempathy/empathy-tp-file.h> #include <libempathy/empathy-utils.h> -#include <libempathy/empathy-call-factory.h> #include <libempathy/empathy-gsettings.h> #include <extensions/extensions.h> @@ -400,9 +399,9 @@ reject_channel_claim_cb (GObject *source, goto out; } - if (EMPATHY_IS_TP_CALL (user_data)) + if (EMPATHY_IS_TP_STREAMED_MEDIA (user_data)) { - empathy_tp_call_close (user_data); + empathy_tp_streamed_media_close (user_data); } else if (EMPATHY_IS_TP_CHAT (user_data)) { @@ -485,7 +484,7 @@ event_channel_process_voip_func (EventPriv *event) GtkWidget *dialog; GtkWidget *button; GtkWidget *image; - EmpathyTpCall *call; + EmpathyTpStreamedMedia *call; gboolean video; gchar *title; @@ -495,9 +494,9 @@ event_channel_process_voip_func (EventPriv *event) return; } - call = EMPATHY_TP_CALL (event->approval->handler_instance); + call = EMPATHY_TP_STREAMED_MEDIA (event->approval->handler_instance); - video = empathy_tp_call_has_initial_video (call); + video = empathy_tp_streamed_media_has_initial_video (call); dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, @@ -643,12 +642,12 @@ event_manager_media_channel_got_contact (EventManagerApproval *approval) EmpathyEventManagerPriv *priv = GET_PRIV (approval->manager); GtkWidget *window = empathy_main_window_dup (); gchar *header; - EmpathyTpCall *call; + EmpathyTpStreamedMedia *call; gboolean video; - call = EMPATHY_TP_CALL (approval->handler_instance); + call = EMPATHY_TP_STREAMED_MEDIA (approval->handler_instance); - video = empathy_tp_call_has_initial_video (call); + video = empathy_tp_streamed_media_has_initial_video (call); header = g_strdup_printf ( video ? _("Incoming video call from %s") :_("Incoming call from %s"), @@ -671,7 +670,7 @@ event_manager_media_channel_got_contact (EventManagerApproval *approval) } static void -event_manager_media_channel_contact_changed_cb (EmpathyTpCall *call, +event_manager_media_channel_contact_changed_cb (EmpathyTpStreamedMedia *call, GParamSpec *param, EventManagerApproval *approval) { EmpathyContact *contact; @@ -964,7 +963,7 @@ approve_channels (TpSimpleApprover *approver, else if (channel_type == TP_IFACE_QUARK_CHANNEL_TYPE_STREAMED_MEDIA) { EmpathyContact *contact; - EmpathyTpCall *call = empathy_tp_call_new (account, channel); + EmpathyTpStreamedMedia *call = empathy_tp_streamed_media_new (account, channel); approval->handler_instance = G_OBJECT (call); @@ -1054,8 +1053,9 @@ event_manager_pendings_changed_cb (EmpathyContactList *list, return; } - header = g_strdup_printf (_("Subscription requested by %s"), - empathy_contact_get_alias (contact)); + header = g_strdup_printf ( + _("%s would like permission to see when you are online"), + empathy_contact_get_alias (contact)); if (!EMP_STR_EMPTY (message)) event_msg = g_strdup_printf (_("\nMessage: %s"), message); diff --git a/libempathy/empathy-call-factory.c b/src/empathy-streamed-media-factory.c index 49bc60de9..70b237941 100644 --- a/libempathy/empathy-call-factory.c +++ b/src/empathy-streamed-media-factory.c @@ -1,6 +1,6 @@ /* - * empathy-call-factory.c - Source for EmpathyCallFactory - * Copyright (C) 2008 Collabora Ltd. + * empathy-streamed-media-factory.c - Source for EmpathyStreamedMediaFactory + * Copyright (C) 2008-2011 Collabora Ltd. * @author Sjoerd Simons <sjoerd.simons@collabora.co.uk> * * This library is free software; you can redistribute it and/or @@ -27,15 +27,16 @@ #include <telepathy-glib/interfaces.h> #include <telepathy-glib/util.h> -#include "empathy-dispatcher.h" -#include "empathy-marshal.h" -#include "empathy-call-factory.h" -#include "empathy-utils.h" +#include <libempathy/empathy-utils.h> + +#include "empathy-streamed-media-factory.h" +#include "empathy-streamed-media-handler.h" +#include "src-marshal.h" #define DEBUG_FLAG EMPATHY_DEBUG_VOIP #include <libempathy/empathy-debug.h> -G_DEFINE_TYPE(EmpathyCallFactory, empathy_call_factory, G_TYPE_OBJECT) +G_DEFINE_TYPE(EmpathyStreamedMediaFactory, empathy_streamed_media_factory, G_TYPE_OBJECT) static void handle_channels_cb (TpSimpleHandler *handler, TpAccount *account, @@ -49,7 +50,7 @@ static void handle_channels_cb (TpSimpleHandler *handler, /* signal enum */ enum { - NEW_CALL_HANDLER, + NEW_STREAMED_MEDIA_HANDLER, LAST_SIGNAL }; @@ -59,17 +60,17 @@ static guint signals[LAST_SIGNAL] = {0}; typedef struct { TpBaseClient *handler; gboolean dispose_has_run; -} EmpathyCallFactoryPriv; +} EmpathyStreamedMediaFactoryPriv; -#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyCallFactory) +#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyStreamedMediaFactory) static GObject *call_factory = NULL; static void -empathy_call_factory_init (EmpathyCallFactory *obj) +empathy_streamed_media_factory_init (EmpathyStreamedMediaFactory *obj) { - EmpathyCallFactoryPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (obj, - EMPATHY_TYPE_CALL_FACTORY, EmpathyCallFactoryPriv); + EmpathyStreamedMediaFactoryPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (obj, + EMPATHY_TYPE_STREAMED_MEDIA_FACTORY, EmpathyStreamedMediaFactoryPriv); TpDBusDaemon *dbus; GError *error = NULL; @@ -116,12 +117,12 @@ empathy_call_factory_init (EmpathyCallFactory *obj) } static GObject * -empathy_call_factory_constructor (GType type, guint n_construct_params, +empathy_streamed_media_factory_constructor (GType type, guint n_construct_params, GObjectConstructParam *construct_params) { g_return_val_if_fail (call_factory == NULL, NULL); - call_factory = G_OBJECT_CLASS (empathy_call_factory_parent_class)->constructor + call_factory = G_OBJECT_CLASS (empathy_streamed_media_factory_parent_class)->constructor (type, n_construct_params, construct_params); g_object_add_weak_pointer (call_factory, (gpointer)&call_factory); @@ -129,18 +130,18 @@ empathy_call_factory_constructor (GType type, guint n_construct_params, } static void -empathy_call_factory_finalize (GObject *object) +empathy_streamed_media_factory_finalize (GObject *object) { /* free any data held directly by the object here */ - if (G_OBJECT_CLASS (empathy_call_factory_parent_class)->finalize) - G_OBJECT_CLASS (empathy_call_factory_parent_class)->finalize (object); + if (G_OBJECT_CLASS (empathy_streamed_media_factory_parent_class)->finalize) + G_OBJECT_CLASS (empathy_streamed_media_factory_parent_class)->finalize (object); } static void -empathy_call_factory_dispose (GObject *object) +empathy_streamed_media_factory_dispose (GObject *object) { - EmpathyCallFactoryPriv *priv = GET_PRIV (object); + EmpathyStreamedMediaFactoryPriv *priv = GET_PRIV (object); if (priv->dispose_has_run) return; @@ -149,141 +150,74 @@ empathy_call_factory_dispose (GObject *object) tp_clear_object (&priv->handler); - if (G_OBJECT_CLASS (empathy_call_factory_parent_class)->dispose) - G_OBJECT_CLASS (empathy_call_factory_parent_class)->dispose (object); + if (G_OBJECT_CLASS (empathy_streamed_media_factory_parent_class)->dispose) + G_OBJECT_CLASS (empathy_streamed_media_factory_parent_class)->dispose (object); } static void -empathy_call_factory_class_init ( - EmpathyCallFactoryClass *empathy_call_factory_class) +empathy_streamed_media_factory_class_init ( + EmpathyStreamedMediaFactoryClass *empathy_streamed_media_factory_class) { - GObjectClass *object_class = G_OBJECT_CLASS (empathy_call_factory_class); + GObjectClass *object_class = G_OBJECT_CLASS (empathy_streamed_media_factory_class); - g_type_class_add_private (empathy_call_factory_class, - sizeof (EmpathyCallFactoryPriv)); + g_type_class_add_private (empathy_streamed_media_factory_class, + sizeof (EmpathyStreamedMediaFactoryPriv)); - object_class->constructor = empathy_call_factory_constructor; - object_class->dispose = empathy_call_factory_dispose; - object_class->finalize = empathy_call_factory_finalize; + object_class->constructor = empathy_streamed_media_factory_constructor; + object_class->dispose = empathy_streamed_media_factory_dispose; + object_class->finalize = empathy_streamed_media_factory_finalize; - signals[NEW_CALL_HANDLER] = - g_signal_new ("new-call-handler", - G_TYPE_FROM_CLASS (empathy_call_factory_class), + signals[NEW_STREAMED_MEDIA_HANDLER] = + g_signal_new ("new-streamed-media-handler", + G_TYPE_FROM_CLASS (empathy_streamed_media_factory_class), G_SIGNAL_RUN_LAST, 0, NULL, NULL, - _empathy_marshal_VOID__OBJECT_BOOLEAN, + _src_marshal_VOID__OBJECT_BOOLEAN, G_TYPE_NONE, - 2, EMPATHY_TYPE_CALL_HANDLER, G_TYPE_BOOLEAN); + 2, EMPATHY_TYPE_STREAMED_MEDIA_HANDLER, G_TYPE_BOOLEAN); } -EmpathyCallFactory * -empathy_call_factory_initialise (void) +EmpathyStreamedMediaFactory * +empathy_streamed_media_factory_initialise (void) { g_return_val_if_fail (call_factory == NULL, NULL); - return EMPATHY_CALL_FACTORY (g_object_new (EMPATHY_TYPE_CALL_FACTORY, NULL)); + return EMPATHY_STREAMED_MEDIA_FACTORY (g_object_new (EMPATHY_TYPE_STREAMED_MEDIA_FACTORY, NULL)); } -EmpathyCallFactory * -empathy_call_factory_get (void) +EmpathyStreamedMediaFactory * +empathy_streamed_media_factory_get (void) { g_return_val_if_fail (call_factory != NULL, NULL); - return EMPATHY_CALL_FACTORY (call_factory); -} - -GHashTable * -empathy_call_factory_create_request (EmpathyContact *contact, - gboolean initial_audio, - gboolean initial_video) -{ - return tp_asv_new ( - TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING, - TP_IFACE_CHANNEL_TYPE_STREAMED_MEDIA, - TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT, TP_HANDLE_TYPE_CONTACT, - TP_PROP_CHANNEL_TARGET_HANDLE, G_TYPE_UINT, - empathy_contact_get_handle (contact), - TP_PROP_CHANNEL_TYPE_STREAMED_MEDIA_INITIAL_AUDIO, G_TYPE_BOOLEAN, - initial_audio, - TP_PROP_CHANNEL_TYPE_STREAMED_MEDIA_INITIAL_VIDEO, G_TYPE_BOOLEAN, - initial_video, - NULL); -} - -static void -create_media_channel_cb (GObject *source, - GAsyncResult *result, - gpointer user_data) -{ - GError *error = NULL; - - if (!tp_account_channel_request_create_channel_finish ( - TP_ACCOUNT_CHANNEL_REQUEST (source), result, &error)) - { - DEBUG ("Failed to create media channel: %s", error->message); - g_error_free (error); - } -} - -/** - * empathy_call_factory_new_call_with_streams: - * @factory: an #EmpathyCallFactory - * @contact: an #EmpathyContact - * @initial_audio: if %TRUE the call will be started with audio - * @initial_video: if %TRUE the call will be started with video - * - * Initiate a new call with @contact. - */ -void -empathy_call_factory_new_call_with_streams (EmpathyContact *contact, - gboolean initial_audio, - gboolean initial_video, - gint64 timestamp, - gpointer user_data) -{ - GHashTable *request; - TpAccount *account; - TpAccountChannelRequest *req; - - request = empathy_call_factory_create_request (contact, initial_audio, - initial_video); - - account = empathy_contact_get_account (contact); - - req = tp_account_channel_request_new (account, request, timestamp); - - tp_account_channel_request_create_channel_async (req, NULL, NULL, - create_media_channel_cb, NULL); - - g_hash_table_unref (request); - g_object_unref (req); + return EMPATHY_STREAMED_MEDIA_FACTORY (call_factory); } static void -create_call_handler (EmpathyCallFactory *factory, - EmpathyTpCall *call) +create_streamed_media_handler (EmpathyStreamedMediaFactory *factory, + EmpathyTpStreamedMedia *call) { - EmpathyCallHandler *handler; + EmpathyStreamedMediaHandler *handler; g_return_if_fail (factory != NULL); - handler = empathy_call_handler_new_for_channel (call); + handler = empathy_streamed_media_handler_new_for_channel (call); - g_signal_emit (factory, signals[NEW_CALL_HANDLER], 0, + g_signal_emit (factory, signals[NEW_STREAMED_MEDIA_HANDLER], 0, handler, FALSE); g_object_unref (handler); } static void -call_status_changed_cb (EmpathyTpCall *call, +call_status_changed_cb (EmpathyTpStreamedMedia *call, GParamSpec *spec, - EmpathyCallFactory *self) + EmpathyStreamedMediaFactory *self) { - if (empathy_tp_call_get_status (call) <= EMPATHY_TP_CALL_STATUS_READYING) + if (empathy_tp_streamed_media_get_status (call) <= EMPATHY_TP_STREAMED_MEDIA_STATUS_READYING) return; - create_call_handler (self, call); + create_streamed_media_handler (self, call); g_signal_handlers_disconnect_by_func (call, call_status_changed_cb, self); g_object_unref (call); @@ -299,13 +233,13 @@ handle_channels_cb (TpSimpleHandler *handler, TpHandleChannelsContext *context, gpointer user_data) { - EmpathyCallFactory *self = user_data; + EmpathyStreamedMediaFactory *self = user_data; GList *l; for (l = channels; l != NULL; l = g_list_next (l)) { TpChannel *channel = l->data; - EmpathyTpCall *call; + EmpathyTpStreamedMedia *call; if (tp_proxy_get_invalidated (channel) != NULL) continue; @@ -314,18 +248,18 @@ handle_channels_cb (TpSimpleHandler *handler, TP_IFACE_QUARK_CHANNEL_TYPE_STREAMED_MEDIA) continue; - call = empathy_tp_call_new (account, channel); + call = empathy_tp_streamed_media_new (account, channel); - if (empathy_tp_call_get_status (call) <= EMPATHY_TP_CALL_STATUS_READYING) + if (empathy_tp_streamed_media_get_status (call) <= EMPATHY_TP_STREAMED_MEDIA_STATUS_READYING) { - /* We have to wait that the TpCall is ready as the + /* We have to wait that the TpStreamedMedia is ready as the * call-handler rely on it. */ tp_g_signal_connect_object (call, "notify::status", G_CALLBACK (call_status_changed_cb), self, 0); continue; } - create_call_handler (self, call); + create_streamed_media_handler (self, call); g_object_unref (call); } @@ -333,10 +267,10 @@ handle_channels_cb (TpSimpleHandler *handler, } gboolean -empathy_call_factory_register (EmpathyCallFactory *self, +empathy_streamed_media_factory_register (EmpathyStreamedMediaFactory *self, GError **error) { - EmpathyCallFactoryPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaFactoryPriv *priv = GET_PRIV (self); return tp_base_client_register (priv->handler, error); } diff --git a/src/empathy-streamed-media-factory.h b/src/empathy-streamed-media-factory.h new file mode 100644 index 000000000..c69073ec4 --- /dev/null +++ b/src/empathy-streamed-media-factory.h @@ -0,0 +1,69 @@ +/* + * empathy-streamed-media-factory.h - Header for EmpathyStreamedMediaFactory + * Copyright (C) 2008-2011 Collabora Ltd. + * @author Sjoerd Simons <sjoerd.simons@collabora.co.uk> + * + * 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 __EMPATHY_STREAMED_MEDIA_FACTORY_H__ +#define __EMPATHY_STREAMED_MEDIA_FACTORY_H__ + +#include <glib-object.h> + +G_BEGIN_DECLS + +typedef struct _EmpathyStreamedMediaFactory EmpathyStreamedMediaFactory; +typedef struct _EmpathyStreamedMediaFactoryClass EmpathyStreamedMediaFactoryClass; + +struct _EmpathyStreamedMediaFactoryClass { + GObjectClass parent_class; +}; + +struct _EmpathyStreamedMediaFactory { + GObject parent; + gpointer priv; +}; + +GType empathy_streamed_media_factory_get_type (void); + +/* TYPE MACROS */ +#define EMPATHY_TYPE_STREAMED_MEDIA_FACTORY \ + (empathy_streamed_media_factory_get_type ()) +#define EMPATHY_STREAMED_MEDIA_FACTORY(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), EMPATHY_TYPE_STREAMED_MEDIA_FACTORY, \ + EmpathyStreamedMediaFactory)) +#define EMPATHY_STREAMED_MEDIA_FACTORY_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), EMPATHY_TYPE_STREAMED_MEDIA_FACTORY, \ + EmpathyStreamedMediaFactoryClass)) +#define EMPATHY_IS_STREAMED_MEDIA_FACTORY(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), EMPATHY_TYPE_STREAMED_MEDIA_FACTORY)) +#define EMPATHY_IS_STREAMED_MEDIA_FACTORY_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass), EMPATHY_TYPE_STREAMED_MEDIA_FACTORY)) +#define EMPATHY_STREAMED_MEDIA_FACTORY_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), EMPATHY_TYPE_STREAMED_MEDIA_FACTORY, \ + EmpathyStreamedMediaFactoryClass)) + + +EmpathyStreamedMediaFactory *empathy_streamed_media_factory_initialise (void); + +EmpathyStreamedMediaFactory *empathy_streamed_media_factory_get (void); + +gboolean empathy_streamed_media_factory_register (EmpathyStreamedMediaFactory *self, + GError **error); + +G_END_DECLS + +#endif /* #ifndef __EMPATHY_STREAMED_MEDIA_FACTORY_H__*/ diff --git a/libempathy/empathy-call-handler.c b/src/empathy-streamed-media-handler.c index dc734b2e5..75007f1ab 100644 --- a/libempathy/empathy-call-handler.c +++ b/src/empathy-streamed-media-handler.c @@ -1,6 +1,6 @@ /* - * empathy-call-handler.c - Source for EmpathyCallHandler - * Copyright (C) 2008-2009 Collabora Ltd. + * empathy-streamed-media-handler.c - Source for EmpathyStreamedMediaHandler + * Copyright (C) 2008-2011 Collabora Ltd. * @author Sjoerd Simons <sjoerd.simons@collabora.co.uk> * * This library is free software; you can redistribute it and/or @@ -29,15 +29,15 @@ #include <telepathy-farsight/channel.h> #include <telepathy-farsight/stream.h> -#include "empathy-call-handler.h" -#include "empathy-call-factory.h" -#include "empathy-marshal.h" -#include "empathy-utils.h" +#include <libempathy/empathy-utils.h> + +#include "empathy-streamed-media-handler.h" +#include "src-marshal.h" #define DEBUG_FLAG EMPATHY_DEBUG_VOIP #include <libempathy/empathy-debug.h> -G_DEFINE_TYPE(EmpathyCallHandler, empathy_call_handler, G_TYPE_OBJECT) +G_DEFINE_TYPE(EmpathyStreamedMediaHandler, empathy_streamed_media_handler, G_TYPE_OBJECT) /* signal enum */ enum { @@ -54,7 +54,7 @@ enum { static guint signals[LAST_SIGNAL] = {0}; enum { - PROP_TP_CALL = 1, + PROP_TP_STREAMED_MEDIA = 1, PROP_GST_BUS, PROP_CONTACT, PROP_INITIAL_AUDIO, @@ -73,7 +73,7 @@ enum { typedef struct { gboolean dispose_has_run; - EmpathyTpCall *call; + EmpathyTpStreamedMedia *call; EmpathyContact *contact; TfChannel *tfchannel; gboolean initial_audio; @@ -87,14 +87,14 @@ typedef struct { FsCandidate *video_remote_candidate; FsCandidate *audio_local_candidate; FsCandidate *video_local_candidate; -} EmpathyCallHandlerPriv; +} EmpathyStreamedMediaHandlerPriv; -#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyCallHandler) +#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyStreamedMediaHandler) static void -empathy_call_handler_dispose (GObject *object) +empathy_streamed_media_handler_dispose (GObject *object) { - EmpathyCallHandlerPriv *priv = GET_PRIV (object); + EmpathyStreamedMediaHandlerPriv *priv = GET_PRIV (object); if (priv->dispose_has_run) return; @@ -113,21 +113,21 @@ empathy_call_handler_dispose (GObject *object) if (priv->call != NULL) { - empathy_tp_call_close (priv->call); + empathy_tp_streamed_media_close (priv->call); g_object_unref (priv->call); } priv->call = NULL; /* release any references held by the object here */ - if (G_OBJECT_CLASS (empathy_call_handler_parent_class)->dispose) - G_OBJECT_CLASS (empathy_call_handler_parent_class)->dispose (object); + if (G_OBJECT_CLASS (empathy_streamed_media_handler_parent_class)->dispose) + G_OBJECT_CLASS (empathy_streamed_media_handler_parent_class)->dispose (object); } static void -empathy_call_handler_finalize (GObject *object) +empathy_streamed_media_handler_finalize (GObject *object) { - EmpathyCallHandlerPriv *priv = GET_PRIV (object); + EmpathyStreamedMediaHandlerPriv *priv = GET_PRIV (object); fs_codec_destroy (priv->send_audio_codec); fs_codec_destroy (priv->send_video_codec); @@ -138,23 +138,23 @@ empathy_call_handler_finalize (GObject *object) fs_candidate_destroy (priv->audio_local_candidate); fs_candidate_destroy (priv->video_local_candidate); - if (G_OBJECT_CLASS (empathy_call_handler_parent_class)->finalize) - G_OBJECT_CLASS (empathy_call_handler_parent_class)->finalize (object); + if (G_OBJECT_CLASS (empathy_streamed_media_handler_parent_class)->finalize) + G_OBJECT_CLASS (empathy_streamed_media_handler_parent_class)->finalize (object); } static void -empathy_call_handler_init (EmpathyCallHandler *obj) +empathy_streamed_media_handler_init (EmpathyStreamedMediaHandler *obj) { - EmpathyCallHandlerPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (obj, - EMPATHY_TYPE_CALL_HANDLER, EmpathyCallHandlerPriv); + EmpathyStreamedMediaHandlerPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (obj, + EMPATHY_TYPE_STREAMED_MEDIA_HANDLER, EmpathyStreamedMediaHandlerPriv); obj->priv = priv; } static void -empathy_call_handler_constructed (GObject *object) +empathy_streamed_media_handler_constructed (GObject *object) { - EmpathyCallHandlerPriv *priv = GET_PRIV (object); + EmpathyStreamedMediaHandlerPriv *priv = GET_PRIV (object); if (priv->contact == NULL) { @@ -163,17 +163,17 @@ empathy_call_handler_constructed (GObject *object) } static void -empathy_call_handler_set_property (GObject *object, +empathy_streamed_media_handler_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { - EmpathyCallHandlerPriv *priv = GET_PRIV (object); + EmpathyStreamedMediaHandlerPriv *priv = GET_PRIV (object); switch (property_id) { case PROP_CONTACT: priv->contact = g_value_dup_object (value); break; - case PROP_TP_CALL: + case PROP_TP_STREAMED_MEDIA: priv->call = g_value_dup_object (value); break; case PROP_INITIAL_AUDIO: @@ -188,17 +188,17 @@ empathy_call_handler_set_property (GObject *object, } static void -empathy_call_handler_get_property (GObject *object, +empathy_streamed_media_handler_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { - EmpathyCallHandlerPriv *priv = GET_PRIV (object); + EmpathyStreamedMediaHandlerPriv *priv = GET_PRIV (object); switch (property_id) { case PROP_CONTACT: g_value_set_object (value, priv->contact); break; - case PROP_TP_CALL: + case PROP_TP_STREAMED_MEDIA: g_value_set_object (value, priv->call); break; case PROP_INITIAL_AUDIO: @@ -238,18 +238,18 @@ empathy_call_handler_get_property (GObject *object, static void -empathy_call_handler_class_init (EmpathyCallHandlerClass *klass) +empathy_streamed_media_handler_class_init (EmpathyStreamedMediaHandlerClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); GParamSpec *param_spec; - g_type_class_add_private (klass, sizeof (EmpathyCallHandlerPriv)); + g_type_class_add_private (klass, sizeof (EmpathyStreamedMediaHandlerPriv)); - object_class->constructed = empathy_call_handler_constructed; - object_class->set_property = empathy_call_handler_set_property; - object_class->get_property = empathy_call_handler_get_property; - object_class->dispose = empathy_call_handler_dispose; - object_class->finalize = empathy_call_handler_finalize; + object_class->constructed = empathy_streamed_media_handler_constructed; + object_class->set_property = empathy_streamed_media_handler_set_property; + object_class->get_property = empathy_streamed_media_handler_get_property; + object_class->dispose = empathy_streamed_media_handler_dispose; + object_class->finalize = empathy_streamed_media_handler_finalize; param_spec = g_param_spec_object ("contact", "contact", "The remote contact", @@ -259,9 +259,9 @@ empathy_call_handler_class_init (EmpathyCallHandlerClass *klass) param_spec = g_param_spec_object ("tp-call", "tp-call", "The calls channel wrapper", - EMPATHY_TYPE_TP_CALL, + EMPATHY_TYPE_TP_STREAMED_MEDIA, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); - g_object_class_install_property (object_class, PROP_TP_CALL, param_spec); + g_object_class_install_property (object_class, PROP_TP_STREAMED_MEDIA, param_spec); param_spec = g_param_spec_boolean ("initial-audio", "initial-audio", "Whether the call should start with audio", @@ -347,14 +347,14 @@ empathy_call_handler_class_init (EmpathyCallHandlerClass *klass) signals[SRC_PAD_ADDED] = g_signal_new ("src-pad-added", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, 0, NULL, NULL, - _empathy_marshal_BOOLEAN__OBJECT_UINT, + _src_marshal_BOOLEAN__OBJECT_UINT, G_TYPE_BOOLEAN, 2, GST_TYPE_PAD, G_TYPE_UINT); signals[SINK_PAD_ADDED] = g_signal_new ("sink-pad-added", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, 0, NULL, NULL, - _empathy_marshal_BOOLEAN__OBJECT_UINT, + _src_marshal_BOOLEAN__OBJECT_UINT, G_TYPE_BOOLEAN, 2, GST_TYPE_PAD, G_TYPE_UINT); @@ -362,7 +362,7 @@ empathy_call_handler_class_init (EmpathyCallHandlerClass *klass) g_signal_new ("request-resource", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, 0, g_signal_accumulator_true_handled, NULL, - _empathy_marshal_BOOLEAN__UINT_UINT, + _src_marshal_BOOLEAN__UINT_UINT, G_TYPE_BOOLEAN, 2, G_TYPE_UINT, G_TYPE_UINT); signals[CLOSED] = @@ -386,35 +386,35 @@ empathy_call_handler_class_init (EmpathyCallHandlerClass *klass) } /** - * empathy_call_handler_new_for_contact: + * empathy_streamed_media_handler_new_for_contact: * @contact: an #EmpathyContact * - * Creates a new #EmpathyCallHandler with contact @contact. + * Creates a new #EmpathyStreamedMediaHandler with contact @contact. * - * Return value: a new #EmpathyCallHandler + * Return value: a new #EmpathyStreamedMediaHandler */ -EmpathyCallHandler * -empathy_call_handler_new_for_contact (EmpathyContact *contact) +EmpathyStreamedMediaHandler * +empathy_streamed_media_handler_new_for_contact (EmpathyContact *contact) { - return EMPATHY_CALL_HANDLER (g_object_new (EMPATHY_TYPE_CALL_HANDLER, + return EMPATHY_STREAMED_MEDIA_HANDLER (g_object_new (EMPATHY_TYPE_STREAMED_MEDIA_HANDLER, "contact", contact, NULL)); } -EmpathyCallHandler * -empathy_call_handler_new_for_channel (EmpathyTpCall *call) +EmpathyStreamedMediaHandler * +empathy_streamed_media_handler_new_for_channel (EmpathyTpStreamedMedia *call) { - return EMPATHY_CALL_HANDLER (g_object_new (EMPATHY_TYPE_CALL_HANDLER, + return EMPATHY_STREAMED_MEDIA_HANDLER (g_object_new (EMPATHY_TYPE_STREAMED_MEDIA_HANDLER, "tp-call", call, - "initial-video", empathy_tp_call_is_receiving_video (call), + "initial-video", empathy_tp_streamed_media_is_receiving_video (call), NULL)); } static void -update_sending_codec (EmpathyCallHandler *self, +update_sending_codec (EmpathyStreamedMediaHandler *self, FsCodec *codec, FsSession *session) { - EmpathyCallHandlerPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaHandlerPriv *priv = GET_PRIV (self); FsMediaType type; if (codec == NULL || session == NULL) @@ -435,11 +435,11 @@ update_sending_codec (EmpathyCallHandler *self, } static void -update_receiving_codec (EmpathyCallHandler *self, +update_receiving_codec (EmpathyStreamedMediaHandler *self, GList *codecs, FsStream *stream) { - EmpathyCallHandlerPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaHandlerPriv *priv = GET_PRIV (self); FsSession *session; FsMediaType type; @@ -467,12 +467,12 @@ update_receiving_codec (EmpathyCallHandler *self, } static void -update_candidates (EmpathyCallHandler *self, +update_candidates (EmpathyStreamedMediaHandler *self, FsCandidate *remote_candidate, FsCandidate *local_candidate, FsStream *stream) { - EmpathyCallHandlerPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaHandlerPriv *priv = GET_PRIV (self); FsSession *session; FsMediaType type; @@ -528,10 +528,10 @@ update_candidates (EmpathyCallHandler *self, } void -empathy_call_handler_bus_message (EmpathyCallHandler *handler, +empathy_streamed_media_handler_bus_message (EmpathyStreamedMediaHandler *handler, GstBus *bus, GstMessage *message) { - EmpathyCallHandlerPriv *priv = GET_PRIV (handler); + EmpathyStreamedMediaHandlerPriv *priv = GET_PRIV (handler); const GstStructure *s = gst_message_get_structure (message); if (priv->tfchannel == NULL) @@ -590,9 +590,9 @@ empathy_call_handler_bus_message (EmpathyCallHandler *handler, } static void -empathy_call_handler_tf_channel_session_created_cb (TfChannel *tfchannel, +empathy_streamed_media_handler_tf_channel_session_created_cb (TfChannel *tfchannel, FsConference *conference, FsParticipant *participant, - EmpathyCallHandler *self) + EmpathyStreamedMediaHandler *self) { g_signal_emit (G_OBJECT (self), signals[CONFERENCE_ADDED], 0, GST_ELEMENT (conference)); @@ -611,8 +611,8 @@ src_pad_added_error_idle (gpointer data) } static void -empathy_call_handler_tf_stream_src_pad_added_cb (TfStream *stream, - GstPad *pad, FsCodec *codec, EmpathyCallHandler *handler) +empathy_streamed_media_handler_tf_stream_src_pad_added_cb (TfStream *stream, + GstPad *pad, FsCodec *codec, EmpathyStreamedMediaHandler *handler) { guint media_type; gboolean retval; @@ -628,8 +628,8 @@ empathy_call_handler_tf_stream_src_pad_added_cb (TfStream *stream, static gboolean -empathy_call_handler_tf_stream_request_resource_cb (TfStream *stream, - guint direction, EmpathyTpCall *call) +empathy_streamed_media_handler_tf_stream_request_resource_cb (TfStream *stream, + guint direction, EmpathyTpStreamedMedia *call) { gboolean ret; guint media_type; @@ -643,15 +643,15 @@ empathy_call_handler_tf_stream_request_resource_cb (TfStream *stream, } static void -empathy_call_handler_tf_stream_closed_cb (TfStream *stream, - EmpathyCallHandler *handler) +empathy_streamed_media_handler_tf_stream_closed_cb (TfStream *stream, + EmpathyStreamedMediaHandler *handler) { g_signal_emit (handler, signals[STREAM_CLOSED], 0, stream); } static void -empathy_call_handler_tf_channel_stream_created_cb (TfChannel *tfchannel, - TfStream *stream, EmpathyCallHandler *handler) +empathy_streamed_media_handler_tf_channel_stream_created_cb (TfChannel *tfchannel, + TfStream *stream, EmpathyStreamedMediaHandler *handler) { guint media_type; GstPad *spad; @@ -662,12 +662,12 @@ empathy_call_handler_tf_channel_stream_created_cb (TfChannel *tfchannel, FsCodec *codec; g_signal_connect (stream, "src-pad-added", - G_CALLBACK (empathy_call_handler_tf_stream_src_pad_added_cb), handler); + G_CALLBACK (empathy_streamed_media_handler_tf_stream_src_pad_added_cb), handler); g_signal_connect (stream, "request-resource", - G_CALLBACK (empathy_call_handler_tf_stream_request_resource_cb), + G_CALLBACK (empathy_streamed_media_handler_tf_stream_request_resource_cb), handler); g_signal_connect (stream, "closed", - G_CALLBACK (empathy_call_handler_tf_stream_closed_cb), handler); + G_CALLBACK (empathy_streamed_media_handler_tf_stream_closed_cb), handler); g_object_get (stream, "media-type", &media_type, "sink-pad", &spad, NULL); @@ -701,14 +701,14 @@ empathy_call_handler_tf_channel_stream_created_cb (TfChannel *tfchannel, } static void -empathy_call_handler_tf_channel_closed_cb (TfChannel *tfchannel, - EmpathyCallHandler *handler) +empathy_streamed_media_handler_tf_channel_closed_cb (TfChannel *tfchannel, + EmpathyStreamedMediaHandler *handler) { g_signal_emit (G_OBJECT (handler), signals[CLOSED], 0); } static GList * -empathy_call_handler_tf_channel_codec_config_cb (TfChannel *channel, +empathy_streamed_media_handler_tf_channel_codec_config_cb (TfChannel *channel, guint stream_id, FsMediaType media_type, guint direction, gpointer user_data) { gchar *filename = empathy_file_lookup ("codec-preferences", "data"); @@ -729,9 +729,9 @@ empathy_call_handler_tf_channel_codec_config_cb (TfChannel *channel, } static void -empathy_call_handler_start_tpfs (EmpathyCallHandler *self) +empathy_streamed_media_handler_start_tpfs (EmpathyStreamedMediaHandler *self) { - EmpathyCallHandlerPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaHandlerPriv *priv = GET_PRIV (self); TpChannel *channel; g_object_get (priv->call, "channel", &channel, NULL); @@ -742,24 +742,24 @@ empathy_call_handler_start_tpfs (EmpathyCallHandler *self) /* Set up the telepathy farsight channel */ g_signal_connect (priv->tfchannel, "session-created", - G_CALLBACK (empathy_call_handler_tf_channel_session_created_cb), self); + G_CALLBACK (empathy_streamed_media_handler_tf_channel_session_created_cb), self); g_signal_connect (priv->tfchannel, "stream-created", - G_CALLBACK (empathy_call_handler_tf_channel_stream_created_cb), self); + G_CALLBACK (empathy_streamed_media_handler_tf_channel_stream_created_cb), self); g_signal_connect (priv->tfchannel, "closed", - G_CALLBACK (empathy_call_handler_tf_channel_closed_cb), self); + G_CALLBACK (empathy_streamed_media_handler_tf_channel_closed_cb), self); g_signal_connect (priv->tfchannel, "stream-get-codec-config", - G_CALLBACK (empathy_call_handler_tf_channel_codec_config_cb), self); + G_CALLBACK (empathy_streamed_media_handler_tf_channel_codec_config_cb), self); g_object_unref (channel); } static void -empathy_call_handler_request_cb (GObject *source, +empathy_streamed_media_handler_request_cb (GObject *source, GAsyncResult *result, gpointer user_data) { - EmpathyCallHandler *self = EMPATHY_CALL_HANDLER (user_data); - EmpathyCallHandlerPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaHandler *self = EMPATHY_STREAMED_MEDIA_HANDLER (user_data); + EmpathyStreamedMediaHandlerPriv *priv = GET_PRIV (self); TpChannel *channel; GError *error = NULL; TpAccountChannelRequest *req = TP_ACCOUNT_CHANNEL_REQUEST (source); @@ -776,62 +776,62 @@ empathy_call_handler_request_cb (GObject *source, account = tp_account_channel_request_get_account (req); - priv->call = empathy_tp_call_new (account, channel); + priv->call = empathy_tp_streamed_media_new (account, channel); g_object_notify (G_OBJECT (self), "tp-call"); - empathy_call_handler_start_tpfs (self); + empathy_streamed_media_handler_start_tpfs (self); g_object_unref (channel); } void -empathy_call_handler_start_call (EmpathyCallHandler *handler, +empathy_streamed_media_handler_start_call (EmpathyStreamedMediaHandler *handler, gint64 timestamp) { - EmpathyCallHandlerPriv *priv = GET_PRIV (handler); + EmpathyStreamedMediaHandlerPriv *priv = GET_PRIV (handler); TpAccountChannelRequest *req; TpAccount *account; GHashTable *request; if (priv->call != NULL) { - empathy_call_handler_start_tpfs (handler); - empathy_tp_call_accept_incoming_call (priv->call); + empathy_streamed_media_handler_start_tpfs (handler); + empathy_tp_streamed_media_accept_incoming_call (priv->call); return; } - /* No TpCall object (we are redialing). Request a new media channel that - * will be used to create a new EmpathyTpCall. */ + /* No TpStreamedMedia object (we are redialing). Request a new media channel that + * will be used to create a new EmpathyTpStreamedMedia. */ g_assert (priv->contact != NULL); account = empathy_contact_get_account (priv->contact); - request = empathy_call_factory_create_request (priv->contact, + request = empathy_call_create_streamed_media_request (priv->contact, priv->initial_audio, priv->initial_video); req = tp_account_channel_request_new (account, request, timestamp); tp_account_channel_request_create_and_handle_channel_async (req, NULL, - empathy_call_handler_request_cb, handler); + empathy_streamed_media_handler_request_cb, handler); g_object_unref (req); g_hash_table_unref (request); } /** - * empathy_call_handler_stop_call: - * @handler: an #EmpathyCallHandler + * empathy_streamed_media_handler_stop_call: + * @handler: an #EmpathyStreamedMediaHandler * - * Closes the #EmpathyCallHandler's call and frees its resources. + * Closes the #EmpathyStreamedMediaHandler's call and frees its resources. */ void -empathy_call_handler_stop_call (EmpathyCallHandler *handler) +empathy_streamed_media_handler_stop_call (EmpathyStreamedMediaHandler *handler) { - EmpathyCallHandlerPriv *priv = GET_PRIV (handler); + EmpathyStreamedMediaHandlerPriv *priv = GET_PRIV (handler); if (priv->call != NULL) { - empathy_tp_call_leave (priv->call); + empathy_tp_streamed_media_leave (priv->call); g_object_unref (priv->call); } @@ -839,86 +839,86 @@ empathy_call_handler_stop_call (EmpathyCallHandler *handler) } /** - * empathy_call_handler_has_initial_video: - * @handler: an #EmpathyCallHandler + * empathy_streamed_media_handler_has_initial_video: + * @handler: an #EmpathyStreamedMediaHandler * - * Return %TRUE if the call managed by this #EmpathyCallHandler was + * Return %TRUE if the call managed by this #EmpathyStreamedMediaHandler was * created with video enabled * * Return value: %TRUE if the call was created as a video conversation. */ gboolean -empathy_call_handler_has_initial_video (EmpathyCallHandler *handler) +empathy_streamed_media_handler_has_initial_video (EmpathyStreamedMediaHandler *handler) { - EmpathyCallHandlerPriv *priv = GET_PRIV (handler); + EmpathyStreamedMediaHandlerPriv *priv = GET_PRIV (handler); return priv->initial_video; } FsCodec * -empathy_call_handler_get_send_audio_codec (EmpathyCallHandler *self) +empathy_streamed_media_handler_get_send_audio_codec (EmpathyStreamedMediaHandler *self) { - EmpathyCallHandlerPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaHandlerPriv *priv = GET_PRIV (self); return priv->send_audio_codec; } FsCodec * -empathy_call_handler_get_send_video_codec (EmpathyCallHandler *self) +empathy_streamed_media_handler_get_send_video_codec (EmpathyStreamedMediaHandler *self) { - EmpathyCallHandlerPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaHandlerPriv *priv = GET_PRIV (self); return priv->send_video_codec; } GList * -empathy_call_handler_get_recv_audio_codecs (EmpathyCallHandler *self) +empathy_streamed_media_handler_get_recv_audio_codecs (EmpathyStreamedMediaHandler *self) { - EmpathyCallHandlerPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaHandlerPriv *priv = GET_PRIV (self); return priv->recv_audio_codecs; } GList * -empathy_call_handler_get_recv_video_codecs (EmpathyCallHandler *self) +empathy_streamed_media_handler_get_recv_video_codecs (EmpathyStreamedMediaHandler *self) { - EmpathyCallHandlerPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaHandlerPriv *priv = GET_PRIV (self); return priv->recv_video_codecs; } FsCandidate * -empathy_call_handler_get_audio_remote_candidate ( - EmpathyCallHandler *self) +empathy_streamed_media_handler_get_audio_remote_candidate ( + EmpathyStreamedMediaHandler *self) { - EmpathyCallHandlerPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaHandlerPriv *priv = GET_PRIV (self); return priv->audio_remote_candidate; } FsCandidate * -empathy_call_handler_get_audio_local_candidate ( - EmpathyCallHandler *self) +empathy_streamed_media_handler_get_audio_local_candidate ( + EmpathyStreamedMediaHandler *self) { - EmpathyCallHandlerPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaHandlerPriv *priv = GET_PRIV (self); return priv->audio_local_candidate; } FsCandidate * -empathy_call_handler_get_video_remote_candidate ( - EmpathyCallHandler *self) +empathy_streamed_media_handler_get_video_remote_candidate ( + EmpathyStreamedMediaHandler *self) { - EmpathyCallHandlerPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaHandlerPriv *priv = GET_PRIV (self); return priv->video_remote_candidate; } FsCandidate * -empathy_call_handler_get_video_local_candidate ( - EmpathyCallHandler *self) +empathy_streamed_media_handler_get_video_local_candidate ( + EmpathyStreamedMediaHandler *self) { - EmpathyCallHandlerPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaHandlerPriv *priv = GET_PRIV (self); return priv->video_local_candidate; } diff --git a/src/empathy-streamed-media-handler.h b/src/empathy-streamed-media-handler.h new file mode 100644 index 000000000..ab655b8e4 --- /dev/null +++ b/src/empathy-streamed-media-handler.h @@ -0,0 +1,106 @@ +/* + * empathy-streamed-media-handler.h - Header for EmpathyStreamedMediaHandler + * Copyright (C) 2008-2009 Collabora Ltd. + * @author Sjoerd Simons <sjoerd.simons@collabora.co.uk> + * + * 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 __EMPATHY_STREAMED_MEDIA_HANDLER_H__ +#define __EMPATHY_STREAMED_MEDIA_HANDLER_H__ + +#include <glib-object.h> + +#include <gst/gst.h> +#include <gst/farsight/fs-conference-iface.h> + +#include <libempathy/empathy-tp-streamed-media.h> +#include <libempathy/empathy-contact.h> + +G_BEGIN_DECLS + +typedef struct _EmpathyStreamedMediaHandler EmpathyStreamedMediaHandler; +typedef struct _EmpathyStreamedMediaHandlerClass EmpathyStreamedMediaHandlerClass; + +struct _EmpathyStreamedMediaHandlerClass { + GObjectClass parent_class; +}; + +struct _EmpathyStreamedMediaHandler { + GObject parent; + gpointer priv; +}; + +GType empathy_streamed_media_handler_get_type (void); + +/* TYPE MACROS */ +#define EMPATHY_TYPE_STREAMED_MEDIA_HANDLER \ + (empathy_streamed_media_handler_get_type ()) +#define EMPATHY_STREAMED_MEDIA_HANDLER(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), EMPATHY_TYPE_STREAMED_MEDIA_HANDLER, \ + EmpathyStreamedMediaHandler)) +#define EMPATHY_STREAMED_MEDIA_HANDLER_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), EMPATHY_TYPE_STREAMED_MEDIA_HANDLER, \ + EmpathyStreamedMediaHandlerClass)) +#define EMPATHY_IS_STREAMED_MEDIA_HANDLER(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), EMPATHY_TYPE_STREAMED_MEDIA_HANDLER)) +#define EMPATHY_IS_STREAMED_MEDIA_HANDLER_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass), EMPATHY_TYPE_STREAMED_MEDIA_HANDLER)) +#define EMPATHY_STREAMED_MEDIA_HANDLER_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), EMPATHY_TYPE_STREAMED_MEDIA_HANDLER, \ + EmpathyStreamedMediaHandlerClass)) + +EmpathyStreamedMediaHandler * empathy_streamed_media_handler_new_for_contact ( + EmpathyContact *contact); + +EmpathyStreamedMediaHandler * empathy_streamed_media_handler_new_for_channel ( + EmpathyTpStreamedMedia *call); + +void empathy_streamed_media_handler_start_call (EmpathyStreamedMediaHandler *handler, + gint64 timestamp); +void empathy_streamed_media_handler_stop_call (EmpathyStreamedMediaHandler *handler); + +gboolean empathy_streamed_media_handler_has_initial_video (EmpathyStreamedMediaHandler *handler); + +void empathy_streamed_media_handler_bus_message (EmpathyStreamedMediaHandler *handler, + GstBus *bus, GstMessage *message); + +FsCodec * empathy_streamed_media_handler_get_send_audio_codec ( + EmpathyStreamedMediaHandler *self); + +FsCodec * empathy_streamed_media_handler_get_send_video_codec ( + EmpathyStreamedMediaHandler *self); + +GList * empathy_streamed_media_handler_get_recv_audio_codecs ( + EmpathyStreamedMediaHandler *self); + +GList * empathy_streamed_media_handler_get_recv_video_codecs ( + EmpathyStreamedMediaHandler *self); + +FsCandidate * empathy_streamed_media_handler_get_audio_remote_candidate ( + EmpathyStreamedMediaHandler *self); + +FsCandidate * empathy_streamed_media_handler_get_audio_local_candidate ( + EmpathyStreamedMediaHandler *self); + +FsCandidate * empathy_streamed_media_handler_get_video_remote_candidate ( + EmpathyStreamedMediaHandler *self); + +FsCandidate * empathy_streamed_media_handler_get_video_local_candidate ( + EmpathyStreamedMediaHandler *self); + +G_END_DECLS + +#endif /* #ifndef __EMPATHY_STREAMED_MEDIA_HANDLER_H__*/ diff --git a/src/empathy-call-window-fullscreen.c b/src/empathy-streamed-media-window-fullscreen.c index 966d49add..caa34ffd1 100644 --- a/src/empathy-call-window-fullscreen.c +++ b/src/empathy-streamed-media-window-fullscreen.c @@ -1,5 +1,5 @@ /* - * empathy-call-window-fullscreen.c - Source for EmpathyCallWindowFullscreen + * empathy-streamed-media-window-fullscreen.c - Source for EmpathyStreamedMediaWindowFullscreen * Copyright (C) 2009 Collabora Ltd. * * Some code is based on the Totem Movie Player, especially @@ -22,7 +22,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "empathy-call-window-fullscreen.h" +#include "empathy-streamed-media-window-fullscreen.h" #include <gtk/gtk.h> @@ -33,16 +33,16 @@ be shown */ #define FULLSCREEN_POPUP_TIMEOUT 5 -G_DEFINE_TYPE (EmpathyCallWindowFullscreen, empathy_call_window_fullscreen, +G_DEFINE_TYPE (EmpathyStreamedMediaWindowFullscreen, empathy_streamed_media_window_fullscreen, G_TYPE_OBJECT) /* private structure */ -typedef struct _EmpathyCallWindowFullscreenPriv - EmpathyCallWindowFullscreenPriv; +typedef struct _EmpathyStreamedMediaWindowFullscreenPriv + EmpathyStreamedMediaWindowFullscreenPriv; -struct _EmpathyCallWindowFullscreenPriv +struct _EmpathyStreamedMediaWindowFullscreenPriv { - EmpathyCallWindow *parent_window; + EmpathyStreamedMediaWindow *parent_window; GtkWidget *leave_fullscreen_popup; GtkWidget *video_widget; @@ -53,21 +53,21 @@ struct _EmpathyCallWindowFullscreenPriv }; #define GET_PRIV(o) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((o), EMPATHY_TYPE_CALL_WINDOW_FULLSCREEN, \ - EmpathyCallWindowFullscreenPriv)) + (G_TYPE_INSTANCE_GET_PRIVATE ((o), EMPATHY_TYPE_STREAMED_MEDIA_WINDOW_FULLSCREEN, \ + EmpathyStreamedMediaWindowFullscreenPriv)) -static void empathy_call_window_fullscreen_dispose (GObject *object); -static void empathy_call_window_fullscreen_finalize (GObject *object); +static void empathy_streamed_media_window_fullscreen_dispose (GObject *object); +static void empathy_streamed_media_window_fullscreen_finalize (GObject *object); -static gboolean empathy_call_window_fullscreen_hide_popup ( - EmpathyCallWindowFullscreen *fs); +static gboolean empathy_streamed_media_window_fullscreen_hide_popup ( + EmpathyStreamedMediaWindowFullscreen *fs); static void -empathy_call_window_fullscreen_set_cursor_visible ( - EmpathyCallWindowFullscreen *fs, +empathy_streamed_media_window_fullscreen_set_cursor_visible ( + EmpathyStreamedMediaWindowFullscreen *fs, gboolean show_cursor) { - EmpathyCallWindowFullscreenPriv *priv = GET_PRIV (fs); + EmpathyStreamedMediaWindowFullscreenPriv *priv = GET_PRIV (fs); GdkWindow *window; if (priv->video_widget == NULL) @@ -82,23 +82,23 @@ empathy_call_window_fullscreen_set_cursor_visible ( } static void -empathy_call_window_fullscreen_add_popup_timeout ( - EmpathyCallWindowFullscreen *self) +empathy_streamed_media_window_fullscreen_add_popup_timeout ( + EmpathyStreamedMediaWindowFullscreen *self) { - EmpathyCallWindowFullscreenPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaWindowFullscreenPriv *priv = GET_PRIV (self); if (priv->popup_timeout == 0) { priv->popup_timeout = g_timeout_add_seconds (FULLSCREEN_POPUP_TIMEOUT, - (GSourceFunc) empathy_call_window_fullscreen_hide_popup, self); + (GSourceFunc) empathy_streamed_media_window_fullscreen_hide_popup, self); } } static void -empathy_call_window_fullscreen_remove_popup_timeout ( - EmpathyCallWindowFullscreen *self) +empathy_streamed_media_window_fullscreen_remove_popup_timeout ( + EmpathyStreamedMediaWindowFullscreen *self) { - EmpathyCallWindowFullscreenPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaWindowFullscreenPriv *priv = GET_PRIV (self); if (priv->popup_timeout != 0) { @@ -108,12 +108,12 @@ empathy_call_window_fullscreen_remove_popup_timeout ( } void -empathy_call_window_fullscreen_show_popup (EmpathyCallWindowFullscreen *self) +empathy_streamed_media_window_fullscreen_show_popup (EmpathyStreamedMediaWindowFullscreen *self) { gint leave_fullscreen_width, leave_fullscreen_height; GdkScreen *screen; GdkRectangle fullscreen_rect; - EmpathyCallWindowFullscreenPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaWindowFullscreenPriv *priv = GET_PRIV (self); g_assert (self->is_fullscreen); @@ -127,7 +127,7 @@ empathy_call_window_fullscreen_show_popup (EmpathyCallWindowFullscreen *self) priv->popup_creation_in_progress = TRUE; - empathy_call_window_fullscreen_set_cursor_visible (self, TRUE); + empathy_streamed_media_window_fullscreen_set_cursor_visible (self, TRUE); /* Obtaining the screen rectangle */ screen = gtk_window_get_screen (GTK_WINDOW (priv->parent_window)); @@ -157,31 +157,31 @@ empathy_call_window_fullscreen_show_popup (EmpathyCallWindowFullscreen *self) } gtk_widget_show_all (priv->leave_fullscreen_popup); - empathy_call_window_fullscreen_add_popup_timeout (self); + empathy_streamed_media_window_fullscreen_add_popup_timeout (self); priv->popup_creation_in_progress = FALSE; } static gboolean -empathy_call_window_fullscreen_hide_popup (EmpathyCallWindowFullscreen *fs) +empathy_streamed_media_window_fullscreen_hide_popup (EmpathyStreamedMediaWindowFullscreen *fs) { - EmpathyCallWindowFullscreenPriv *priv = GET_PRIV (fs); + EmpathyStreamedMediaWindowFullscreenPriv *priv = GET_PRIV (fs); if (priv->video_widget == NULL || !fs->is_fullscreen) return TRUE; gtk_widget_hide (priv->leave_fullscreen_popup); - empathy_call_window_fullscreen_remove_popup_timeout (fs); + empathy_streamed_media_window_fullscreen_remove_popup_timeout (fs); - empathy_call_window_fullscreen_set_cursor_visible (fs, FALSE); + empathy_streamed_media_window_fullscreen_set_cursor_visible (fs, FALSE); return FALSE; } static void -empathy_call_window_fullscreen_init (EmpathyCallWindowFullscreen *self) +empathy_streamed_media_window_fullscreen_init (EmpathyStreamedMediaWindowFullscreen *self) { - EmpathyCallWindowFullscreenPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaWindowFullscreenPriv *priv = GET_PRIV (self); GtkBuilder *gui; gchar *filename; @@ -198,22 +198,22 @@ empathy_call_window_fullscreen_init (EmpathyCallWindowFullscreen *self) } static void -empathy_call_window_fullscreen_class_init ( - EmpathyCallWindowFullscreenClass *klass) +empathy_streamed_media_window_fullscreen_class_init ( + EmpathyStreamedMediaWindowFullscreenClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - g_type_class_add_private (klass, sizeof (EmpathyCallWindowFullscreenPriv)); + g_type_class_add_private (klass, sizeof (EmpathyStreamedMediaWindowFullscreenPriv)); - object_class->dispose = empathy_call_window_fullscreen_dispose; - object_class->finalize = empathy_call_window_fullscreen_finalize; + object_class->dispose = empathy_streamed_media_window_fullscreen_dispose; + object_class->finalize = empathy_streamed_media_window_fullscreen_finalize; } void -empathy_call_window_fullscreen_dispose (GObject *object) +empathy_streamed_media_window_fullscreen_dispose (GObject *object) { - EmpathyCallWindowFullscreen *self = EMPATHY_CALL_WINDOW_FULLSCREEN (object); - EmpathyCallWindowFullscreenPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaWindowFullscreen *self = EMPATHY_STREAMED_MEDIA_WINDOW_FULLSCREEN (object); + EmpathyStreamedMediaWindowFullscreenPriv *priv = GET_PRIV (self); if (priv->dispose_has_run) return; @@ -224,29 +224,29 @@ empathy_call_window_fullscreen_dispose (GObject *object) gtk_widget_destroy (priv->leave_fullscreen_popup); priv->leave_fullscreen_popup = NULL; - if (G_OBJECT_CLASS (empathy_call_window_fullscreen_parent_class)->dispose) + if (G_OBJECT_CLASS (empathy_streamed_media_window_fullscreen_parent_class)->dispose) { G_OBJECT_CLASS ( - empathy_call_window_fullscreen_parent_class)->dispose (object); + empathy_streamed_media_window_fullscreen_parent_class)->dispose (object); } } void -empathy_call_window_fullscreen_finalize (GObject *object) +empathy_streamed_media_window_fullscreen_finalize (GObject *object) { - EmpathyCallWindowFullscreen *self = EMPATHY_CALL_WINDOW_FULLSCREEN (object); + EmpathyStreamedMediaWindowFullscreen *self = EMPATHY_STREAMED_MEDIA_WINDOW_FULLSCREEN (object); - empathy_call_window_fullscreen_remove_popup_timeout (self); + empathy_streamed_media_window_fullscreen_remove_popup_timeout (self); G_OBJECT_CLASS ( - empathy_call_window_fullscreen_parent_class)->finalize (object); + empathy_streamed_media_window_fullscreen_parent_class)->finalize (object); } static void -empathy_call_window_fullscreen_parent_window_notify (GtkWidget *parent_window, - GParamSpec *property, EmpathyCallWindowFullscreen *fs) +empathy_streamed_media_window_fullscreen_parent_window_notify (GtkWidget *parent_window, + GParamSpec *property, EmpathyStreamedMediaWindowFullscreen *fs) { - EmpathyCallWindowFullscreenPriv *priv = GET_PRIV (fs); + EmpathyStreamedMediaWindowFullscreenPriv *priv = GET_PRIV (fs); if (!fs->is_fullscreen) return; @@ -254,54 +254,54 @@ empathy_call_window_fullscreen_parent_window_notify (GtkWidget *parent_window, if (parent_window == GTK_WIDGET (priv->parent_window) && !gtk_window_is_active (GTK_WINDOW (parent_window))) { - empathy_call_window_fullscreen_hide_popup (fs); - empathy_call_window_fullscreen_set_cursor_visible (fs, TRUE); + empathy_streamed_media_window_fullscreen_hide_popup (fs); + empathy_streamed_media_window_fullscreen_set_cursor_visible (fs, TRUE); } } -EmpathyCallWindowFullscreen * -empathy_call_window_fullscreen_new (EmpathyCallWindow *parent_window) +EmpathyStreamedMediaWindowFullscreen * +empathy_streamed_media_window_fullscreen_new (EmpathyStreamedMediaWindow *parent_window) { - EmpathyCallWindowFullscreen *self = EMPATHY_CALL_WINDOW_FULLSCREEN ( - g_object_new (EMPATHY_TYPE_CALL_WINDOW_FULLSCREEN, NULL)); - EmpathyCallWindowFullscreenPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaWindowFullscreen *self = EMPATHY_STREAMED_MEDIA_WINDOW_FULLSCREEN ( + g_object_new (EMPATHY_TYPE_STREAMED_MEDIA_WINDOW_FULLSCREEN, NULL)); + EmpathyStreamedMediaWindowFullscreenPriv *priv = GET_PRIV (self); priv->parent_window = parent_window; g_signal_connect (G_OBJECT (priv->parent_window), "notify::is-active", - G_CALLBACK (empathy_call_window_fullscreen_parent_window_notify), self); + G_CALLBACK (empathy_streamed_media_window_fullscreen_parent_window_notify), self); return self; } void -empathy_call_window_fullscreen_set_fullscreen (EmpathyCallWindowFullscreen *fs, +empathy_streamed_media_window_fullscreen_set_fullscreen (EmpathyStreamedMediaWindowFullscreen *fs, gboolean set_fullscreen) { if (set_fullscreen) - empathy_call_window_fullscreen_remove_popup_timeout (fs); + empathy_streamed_media_window_fullscreen_remove_popup_timeout (fs); else - empathy_call_window_fullscreen_hide_popup (fs); + empathy_streamed_media_window_fullscreen_hide_popup (fs); - empathy_call_window_fullscreen_set_cursor_visible (fs, !set_fullscreen); + empathy_streamed_media_window_fullscreen_set_cursor_visible (fs, !set_fullscreen); fs->is_fullscreen = set_fullscreen; } static void video_widget_destroy_cb (GtkWidget *widget, - EmpathyCallWindowFullscreen *self) + EmpathyStreamedMediaWindowFullscreen *self) { - EmpathyCallWindowFullscreenPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaWindowFullscreenPriv *priv = GET_PRIV (self); priv->video_widget = NULL; } void -empathy_call_window_fullscreen_set_video_widget ( - EmpathyCallWindowFullscreen *fs, +empathy_streamed_media_window_fullscreen_set_video_widget ( + EmpathyStreamedMediaWindowFullscreen *fs, GtkWidget *video_widget) { - EmpathyCallWindowFullscreenPriv *priv = GET_PRIV (fs); + EmpathyStreamedMediaWindowFullscreenPriv *priv = GET_PRIV (fs); priv->video_widget = video_widget; tp_g_signal_connect_object (video_widget, "destroy", diff --git a/src/empathy-streamed-media-window-fullscreen.h b/src/empathy-streamed-media-window-fullscreen.h new file mode 100644 index 000000000..bdb95fb0b --- /dev/null +++ b/src/empathy-streamed-media-window-fullscreen.h @@ -0,0 +1,77 @@ +/* + * empathy-streamed-media-window-fullscreen.h - Header for EmpathyStreamedMediaWindowFullscreen + * Copyright (C) 2009 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 __EMPATHY_STREAMED_MEDIA_WINDOW_FULLSCREEN_H__ +#define __EMPATHY_STREAMED_MEDIA_WINDOW_FULLSCREEN_H__ + +#include <glib-object.h> +#include <gtk/gtk.h> + +#include "empathy-streamed-media-window.h" + +G_BEGIN_DECLS + +typedef struct _EmpathyStreamedMediaWindowFullscreen EmpathyStreamedMediaWindowFullscreen; +typedef struct _EmpathyStreamedMediaWindowFullscreenClass + EmpathyStreamedMediaWindowFullscreenClass; + +struct _EmpathyStreamedMediaWindowFullscreenClass { + GObjectClass parent_class; +}; + +struct _EmpathyStreamedMediaWindowFullscreen { + GObject parent; + gboolean is_fullscreen; + GtkWidget *leave_fullscreen_button; +}; + +GType empathy_streamed_media_window_fullscreen_get_type (void); + +/* TYPE MACROS */ +#define EMPATHY_TYPE_STREAMED_MEDIA_WINDOW_FULLSCREEN \ + (empathy_streamed_media_window_fullscreen_get_type ()) +#define EMPATHY_STREAMED_MEDIA_WINDOW_FULLSCREEN(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), EMPATHY_TYPE_STREAMED_MEDIA_WINDOW_FULLSCREEN, \ + EmpathyStreamedMediaWindowFullscreen)) +#define EMPATHY_STREAMED_MEDIA_WINDOW_FULLSCREEN_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), EMPATHY_TYPE_STREAMED_MEDIA_WINDOW_FULLSCREEN, \ + EmpathyStreamedMediaWindowClassFullscreen)) +#define EMPATHY_IS_STREAMED_MEDIA_WINDOW_FULLSCREEN(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), EMPATHY_TYPE_STREAMED_MEDIA_WINDOW_FULLSCREEN)) +#define EMPATHY_IS_STREAMED_MEDIA_WINDOW_FULLSCREEN_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass), EMPATHY_TYPE_STREAMED_MEDIA_WINDOW_FULLSCREEN)) +#define EMPATHY_STREAMED_MEDIA_WINDOW_FULLSCREEN_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), EMPATHY_TYPE_STREAMED_MEDIA_WINDOW_FULLSCREEN, \ + EmpathyStreamedMediaWindowFullscreenClass)) + +EmpathyStreamedMediaWindowFullscreen *empathy_streamed_media_window_fullscreen_new ( + EmpathyStreamedMediaWindow *parent); + +void empathy_streamed_media_window_fullscreen_set_fullscreen ( + EmpathyStreamedMediaWindowFullscreen *fs, + gboolean set_fullscreen); +void empathy_streamed_media_window_fullscreen_set_video_widget ( + EmpathyStreamedMediaWindowFullscreen *fs, + GtkWidget *video_widget); +void empathy_streamed_media_window_fullscreen_show_popup ( + EmpathyStreamedMediaWindowFullscreen *fs); + +G_END_DECLS + +#endif /* #ifndef __EMPATHY_STREAMED_MEDIA_WINDOW_FULLSCREEN_H__*/ diff --git a/src/empathy-call-window.c b/src/empathy-streamed-media-window.c index c2dbebba9..189537f7c 100644 --- a/src/empathy-call-window.c +++ b/src/empathy-streamed-media-window.c @@ -1,5 +1,5 @@ /* - * empathy-call-window.c - Source for EmpathyCallWindow + * empathy-streamed-media-window.c - Source for EmpathyStreamedMediaWindow * Copyright (C) 2008-2009 Collabora Ltd. * @author Sjoerd Simons <sjoerd.simons@collabora.co.uk> * @@ -36,7 +36,6 @@ #include <gst/farsight/fs-element-added-notifier.h> #include <libempathy/empathy-tp-contact-factory.h> -#include <libempathy/empathy-call-factory.h> #include <libempathy/empathy-utils.h> #include <libempathy-gtk/empathy-avatar-image.h> #include <libempathy-gtk/empathy-video-widget.h> @@ -51,8 +50,8 @@ #define DEBUG_FLAG EMPATHY_DEBUG_VOIP #include <libempathy/empathy-debug.h> -#include "empathy-call-window.h" -#include "empathy-call-window-fullscreen.h" +#include "empathy-streamed-media-window.h" +#include "empathy-streamed-media-window-fullscreen.h" #include "empathy-sidebar.h" #define BUTTON_ID "empathy-call-dtmf-button-id" @@ -76,7 +75,7 @@ /* The time interval in milliseconds between 2 outgoing rings */ #define MS_BETWEEN_RING 500 -G_DEFINE_TYPE(EmpathyCallWindow, empathy_call_window, GTK_TYPE_WINDOW) +G_DEFINE_TYPE(EmpathyStreamedMediaWindow, empathy_streamed_media_window, GTK_TYPE_WINDOW) /* signal enum */ #if 0 @@ -89,7 +88,7 @@ static guint signals[LAST_SIGNAL] = {0}; #endif enum { - PROP_CALL_HANDLER = 1, + PROP_STREAMED_MEDIA_HANDLER = 1, }; typedef enum { @@ -106,12 +105,12 @@ typedef enum { } CameraState; /* private structure */ -typedef struct _EmpathyCallWindowPriv EmpathyCallWindowPriv; +typedef struct _EmpathyStreamedMediaWindowPriv EmpathyStreamedMediaWindowPriv; -struct _EmpathyCallWindowPriv +struct _EmpathyStreamedMediaWindowPriv { gboolean dispose_has_run; - EmpathyCallHandler *handler; + EmpathyStreamedMediaHandler *handler; EmpathyContact *contact; guint call_state; @@ -208,7 +207,7 @@ struct _EmpathyCallWindowPriv gboolean sending_video; CameraState camera_state; - EmpathyCallWindowFullscreen *fullscreen; + EmpathyStreamedMediaWindowFullscreen *fullscreen; gboolean is_fullscreen; /* Those fields represent the state of the window before it actually was in @@ -224,78 +223,78 @@ struct _EmpathyCallWindowPriv }; #define GET_PRIV(o) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((o), EMPATHY_TYPE_CALL_WINDOW, \ - EmpathyCallWindowPriv)) + (G_TYPE_INSTANCE_GET_PRIVATE ((o), EMPATHY_TYPE_STREAMED_MEDIA_WINDOW, \ + EmpathyStreamedMediaWindowPriv)) -static void empathy_call_window_realized_cb (GtkWidget *widget, - EmpathyCallWindow *window); +static void empathy_streamed_media_window_realized_cb (GtkWidget *widget, + EmpathyStreamedMediaWindow *window); -static gboolean empathy_call_window_delete_cb (GtkWidget *widget, - GdkEvent *event, EmpathyCallWindow *window); +static gboolean empathy_streamed_media_window_delete_cb (GtkWidget *widget, + GdkEvent *event, EmpathyStreamedMediaWindow *window); -static gboolean empathy_call_window_state_event_cb (GtkWidget *widget, - GdkEventWindowState *event, EmpathyCallWindow *window); +static gboolean empathy_streamed_media_window_state_event_cb (GtkWidget *widget, + GdkEventWindowState *event, EmpathyStreamedMediaWindow *window); -static void empathy_call_window_sidebar_toggled_cb (GtkToggleButton *toggle, - EmpathyCallWindow *window); +static void empathy_streamed_media_window_sidebar_toggled_cb (GtkToggleButton *toggle, + EmpathyStreamedMediaWindow *window); -static void empathy_call_window_set_send_video (EmpathyCallWindow *window, +static void empathy_streamed_media_window_set_send_video (EmpathyStreamedMediaWindow *window, CameraState state); -static void empathy_call_window_mic_toggled_cb ( - GtkToggleToolButton *toggle, EmpathyCallWindow *window); +static void empathy_streamed_media_window_mic_toggled_cb ( + GtkToggleToolButton *toggle, EmpathyStreamedMediaWindow *window); -static void empathy_call_window_sidebar_hidden_cb (EmpathySidebar *sidebar, - EmpathyCallWindow *window); +static void empathy_streamed_media_window_sidebar_hidden_cb (EmpathySidebar *sidebar, + EmpathyStreamedMediaWindow *window); -static void empathy_call_window_sidebar_shown_cb (EmpathySidebar *sidebar, - EmpathyCallWindow *window); +static void empathy_streamed_media_window_sidebar_shown_cb (EmpathySidebar *sidebar, + EmpathyStreamedMediaWindow *window); -static void empathy_call_window_hangup_cb (gpointer object, - EmpathyCallWindow *window); +static void empathy_streamed_media_window_hangup_cb (gpointer object, + EmpathyStreamedMediaWindow *window); -static void empathy_call_window_fullscreen_cb (gpointer object, - EmpathyCallWindow *window); +static void empathy_streamed_media_window_fullscreen_cb (gpointer object, + EmpathyStreamedMediaWindow *window); -static void empathy_call_window_fullscreen_toggle (EmpathyCallWindow *window); +static void empathy_streamed_media_window_fullscreen_toggle (EmpathyStreamedMediaWindow *window); -static gboolean empathy_call_window_video_button_press_cb ( - GtkWidget *video_output, GdkEventButton *event, EmpathyCallWindow *window); +static gboolean empathy_streamed_media_window_video_button_press_cb ( + GtkWidget *video_output, GdkEventButton *event, EmpathyStreamedMediaWindow *window); -static gboolean empathy_call_window_key_press_cb (GtkWidget *video_output, - GdkEventKey *event, EmpathyCallWindow *window); +static gboolean empathy_streamed_media_window_key_press_cb (GtkWidget *video_output, + GdkEventKey *event, EmpathyStreamedMediaWindow *window); -static gboolean empathy_call_window_video_output_motion_notify ( - GtkWidget *widget, GdkEventMotion *event, EmpathyCallWindow *window); +static gboolean empathy_streamed_media_window_video_output_motion_notify ( + GtkWidget *widget, GdkEventMotion *event, EmpathyStreamedMediaWindow *window); -static void empathy_call_window_video_menu_popup (EmpathyCallWindow *window, +static void empathy_streamed_media_window_video_menu_popup (EmpathyStreamedMediaWindow *window, guint button); -static void empathy_call_window_redial_cb (gpointer object, - EmpathyCallWindow *window); +static void empathy_streamed_media_window_redial_cb (gpointer object, + EmpathyStreamedMediaWindow *window); -static void empathy_call_window_restart_call (EmpathyCallWindow *window); +static void empathy_streamed_media_window_restart_call (EmpathyStreamedMediaWindow *window); -static void empathy_call_window_status_message (EmpathyCallWindow *window, +static void empathy_streamed_media_window_status_message (EmpathyStreamedMediaWindow *window, gchar *message); -static void empathy_call_window_update_avatars_visibility (EmpathyTpCall *call, - EmpathyCallWindow *window); +static void empathy_streamed_media_window_update_avatars_visibility (EmpathyTpStreamedMedia *call, + EmpathyStreamedMediaWindow *window); -static gboolean empathy_call_window_bus_message (GstBus *bus, +static gboolean empathy_streamed_media_window_bus_message (GstBus *bus, GstMessage *message, gpointer user_data); static void -empathy_call_window_volume_changed_cb (GtkScaleButton *button, - gdouble value, EmpathyCallWindow *window); +empathy_streamed_media_window_volume_changed_cb (GtkScaleButton *button, + gdouble value, EmpathyStreamedMediaWindow *window); -static void block_camera_control_signals (EmpathyCallWindow *self); -static void unblock_camera_control_signals (EmpathyCallWindow *self); +static void block_camera_control_signals (EmpathyStreamedMediaWindow *self); +static void unblock_camera_control_signals (EmpathyStreamedMediaWindow *self); static void -empathy_call_window_setup_toolbar (EmpathyCallWindow *self) +empathy_streamed_media_window_setup_toolbar (EmpathyStreamedMediaWindow *self) { - EmpathyCallWindowPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (self); GtkToolItem *tool_item; GtkWidget *camera_off_icon; GdkPixbuf *pixbuf, *modded_pixbuf; @@ -329,7 +328,7 @@ empathy_call_window_setup_toolbar (EmpathyCallWindow *self) * volume will do */ gtk_scale_button_set_value (GTK_SCALE_BUTTON (priv->volume_button), 1.0); g_signal_connect (G_OBJECT (priv->volume_button), "value-changed", - G_CALLBACK (empathy_call_window_volume_changed_cb), self); + G_CALLBACK (empathy_streamed_media_window_volume_changed_cb), self); tool_item = gtk_tool_item_new (); gtk_container_add (GTK_CONTAINER (tool_item), priv->volume_button); @@ -338,10 +337,10 @@ empathy_call_window_setup_toolbar (EmpathyCallWindow *self) } static void -dtmf_button_pressed_cb (GtkButton *button, EmpathyCallWindow *window) +dtmf_button_pressed_cb (GtkButton *button, EmpathyStreamedMediaWindow *window) { - EmpathyCallWindowPriv *priv = GET_PRIV (window); - EmpathyTpCall *call; + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (window); + EmpathyTpStreamedMedia *call; GQuark button_quark; TpDTMFEvent event; @@ -351,26 +350,26 @@ dtmf_button_pressed_cb (GtkButton *button, EmpathyCallWindow *window) event = GPOINTER_TO_UINT (g_object_get_qdata (G_OBJECT (button), button_quark)); - empathy_tp_call_start_tone (call, event); + empathy_tp_streamed_media_start_tone (call, event); g_object_unref (call); } static void -dtmf_button_released_cb (GtkButton *button, EmpathyCallWindow *window) +dtmf_button_released_cb (GtkButton *button, EmpathyStreamedMediaWindow *window) { - EmpathyCallWindowPriv *priv = GET_PRIV (window); - EmpathyTpCall *call; + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (window); + EmpathyTpStreamedMedia *call; g_object_get (priv->handler, "tp-call", &call, NULL); - empathy_tp_call_stop_tone (call); + empathy_tp_streamed_media_stop_tone (call); g_object_unref (call); } static GtkWidget * -empathy_call_window_create_dtmf (EmpathyCallWindow *self) +empathy_streamed_media_window_create_dtmf (EmpathyStreamedMediaWindow *self) { GtkWidget *table; int i; @@ -415,7 +414,7 @@ empathy_call_window_create_dtmf (EmpathyCallWindow *self) } static GtkWidget * -empathy_call_window_create_video_input_add_slider (EmpathyCallWindow *self, +empathy_streamed_media_window_create_video_input_add_slider (EmpathyStreamedMediaWindow *self, gchar *label_text, GtkWidget *bin) { GtkWidget *vbox = gtk_vbox_new (FALSE, 2); @@ -434,33 +433,33 @@ empathy_call_window_create_video_input_add_slider (EmpathyCallWindow *self, } static void -empathy_call_window_video_contrast_changed_cb (GtkAdjustment *adj, - EmpathyCallWindow *self) +empathy_streamed_media_window_video_contrast_changed_cb (GtkAdjustment *adj, + EmpathyStreamedMediaWindow *self) { - EmpathyCallWindowPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (self); empathy_video_src_set_channel (priv->video_input, EMPATHY_GST_VIDEO_SRC_CHANNEL_CONTRAST, gtk_adjustment_get_value (adj)); } static void -empathy_call_window_video_brightness_changed_cb (GtkAdjustment *adj, - EmpathyCallWindow *self) +empathy_streamed_media_window_video_brightness_changed_cb (GtkAdjustment *adj, + EmpathyStreamedMediaWindow *self) { - EmpathyCallWindowPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (self); empathy_video_src_set_channel (priv->video_input, EMPATHY_GST_VIDEO_SRC_CHANNEL_BRIGHTNESS, gtk_adjustment_get_value (adj)); } static void -empathy_call_window_video_gamma_changed_cb (GtkAdjustment *adj, - EmpathyCallWindow *self) +empathy_streamed_media_window_video_gamma_changed_cb (GtkAdjustment *adj, + EmpathyStreamedMediaWindow *self) { - EmpathyCallWindowPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (self); empathy_video_src_set_channel (priv->video_input, EMPATHY_GST_VIDEO_SRC_CHANNEL_GAMMA, gtk_adjustment_get_value (adj)); @@ -468,29 +467,29 @@ empathy_call_window_video_gamma_changed_cb (GtkAdjustment *adj, static GtkWidget * -empathy_call_window_create_video_input (EmpathyCallWindow *self) +empathy_streamed_media_window_create_video_input (EmpathyStreamedMediaWindow *self) { - EmpathyCallWindowPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (self); GtkWidget *hbox; hbox = gtk_hbox_new (TRUE, 3); - priv->video_contrast = empathy_call_window_create_video_input_add_slider ( + priv->video_contrast = empathy_streamed_media_window_create_video_input_add_slider ( self, _("Contrast"), hbox); - priv->video_brightness = empathy_call_window_create_video_input_add_slider ( + priv->video_brightness = empathy_streamed_media_window_create_video_input_add_slider ( self, _("Brightness"), hbox); - priv->video_gamma = empathy_call_window_create_video_input_add_slider ( + priv->video_gamma = empathy_streamed_media_window_create_video_input_add_slider ( self, _("Gamma"), hbox); return hbox; } static void -empathy_call_window_setup_video_input (EmpathyCallWindow *self) +empathy_streamed_media_window_setup_video_input (EmpathyStreamedMediaWindow *self) { - EmpathyCallWindowPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (self); guint supported; GtkAdjustment *adj; @@ -505,7 +504,7 @@ empathy_call_window_setup_video_input (EmpathyCallWindow *self) EMPATHY_GST_VIDEO_SRC_CHANNEL_CONTRAST)); g_signal_connect (G_OBJECT (adj), "value-changed", - G_CALLBACK (empathy_call_window_video_contrast_changed_cb), self); + G_CALLBACK (empathy_streamed_media_window_video_contrast_changed_cb), self); gtk_widget_set_sensitive (priv->video_contrast, TRUE); } @@ -519,7 +518,7 @@ empathy_call_window_setup_video_input (EmpathyCallWindow *self) EMPATHY_GST_VIDEO_SRC_CHANNEL_BRIGHTNESS)); g_signal_connect (G_OBJECT (adj), "value-changed", - G_CALLBACK (empathy_call_window_video_brightness_changed_cb), self); + G_CALLBACK (empathy_streamed_media_window_video_brightness_changed_cb), self); gtk_widget_set_sensitive (priv->video_brightness, TRUE); } @@ -532,16 +531,16 @@ empathy_call_window_setup_video_input (EmpathyCallWindow *self) EMPATHY_GST_VIDEO_SRC_CHANNEL_GAMMA)); g_signal_connect (G_OBJECT (adj), "value-changed", - G_CALLBACK (empathy_call_window_video_gamma_changed_cb), self); + G_CALLBACK (empathy_streamed_media_window_video_gamma_changed_cb), self); gtk_widget_set_sensitive (priv->video_gamma, TRUE); } } static void -empathy_call_window_mic_volume_changed_cb (GtkAdjustment *adj, - EmpathyCallWindow *self) +empathy_streamed_media_window_mic_volume_changed_cb (GtkAdjustment *adj, + EmpathyStreamedMediaWindow *self) { - EmpathyCallWindowPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (self); gdouble volume; volume = gtk_adjustment_get_value (adj)/100.0; @@ -563,11 +562,11 @@ empathy_call_window_mic_volume_changed_cb (GtkAdjustment *adj, } static void -empathy_call_window_audio_input_level_changed_cb (EmpathyGstAudioSrc *src, - gdouble level, EmpathyCallWindow *window) +empathy_streamed_media_window_audio_input_level_changed_cb (EmpathyGstAudioSrc *src, + gdouble level, EmpathyStreamedMediaWindow *window) { gdouble value; - EmpathyCallWindowPriv *priv = GET_PRIV (window); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (window); value = CLAMP (pow (10, level / 20), 0.0, 1.0); gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (priv->volume_progress_bar), @@ -575,9 +574,9 @@ empathy_call_window_audio_input_level_changed_cb (EmpathyGstAudioSrc *src, } static GtkWidget * -empathy_call_window_create_audio_input (EmpathyCallWindow *self) +empathy_streamed_media_window_create_audio_input (EmpathyStreamedMediaWindow *self) { - EmpathyCallWindowPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (self); GtkWidget *hbox, *vbox, *label; hbox = gtk_hbox_new (TRUE, 3); @@ -596,7 +595,7 @@ empathy_call_window_create_audio_input (EmpathyCallWindow *self) gtk_adjustment_set_value (priv->audio_input_adj, priv->volume * 100); g_signal_connect (G_OBJECT (priv->audio_input_adj), "value-changed", - G_CALLBACK (empathy_call_window_mic_volume_changed_cb), self); + G_CALLBACK (empathy_streamed_media_window_mic_volume_changed_cb), self); gtk_box_pack_start (GTK_BOX (vbox), priv->volume_scale, TRUE, TRUE, 3); gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 3); @@ -625,9 +624,9 @@ empathy_call_window_create_audio_input (EmpathyCallWindow *self) } static void -create_video_output_widget (EmpathyCallWindow *self) +create_video_output_widget (EmpathyStreamedMediaWindow *self) { - EmpathyCallWindowPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (self); GstBus *bus; g_assert (priv->video_output == NULL); @@ -642,15 +641,15 @@ create_video_output_widget (EmpathyCallWindow *self) gtk_widget_add_events (priv->video_output, GDK_BUTTON_PRESS_MASK | GDK_POINTER_MOTION_MASK); g_signal_connect (G_OBJECT (priv->video_output), "button-press-event", - G_CALLBACK (empathy_call_window_video_button_press_cb), self); + G_CALLBACK (empathy_streamed_media_window_video_button_press_cb), self); g_object_unref (bus); } static void -create_audio_output (EmpathyCallWindow *self) +create_audio_output (EmpathyStreamedMediaWindow *self) { - EmpathyCallWindowPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (self); g_assert (priv->audio_output == NULL); priv->audio_output = empathy_audio_sink_new (); @@ -659,9 +658,9 @@ create_audio_output (EmpathyCallWindow *self) } static void -create_video_input (EmpathyCallWindow *self) +create_video_input (EmpathyStreamedMediaWindow *self) { - EmpathyCallWindowPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (self); g_assert (priv->video_input == NULL); priv->video_input = empathy_video_src_new (); @@ -670,9 +669,9 @@ create_video_input (EmpathyCallWindow *self) } static void -create_audio_input (EmpathyCallWindow *self) +create_audio_input (EmpathyStreamedMediaWindow *self) { - EmpathyCallWindowPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (self); g_assert (priv->audio_input == NULL); priv->audio_input = empathy_audio_src_new (); @@ -680,14 +679,14 @@ create_audio_input (EmpathyCallWindow *self) gst_object_sink (priv->audio_input); tp_g_signal_connect_object (priv->audio_input, "peak-level-changed", - G_CALLBACK (empathy_call_window_audio_input_level_changed_cb), + G_CALLBACK (empathy_streamed_media_window_audio_input_level_changed_cb), self, 0); } static void -add_video_preview_to_pipeline (EmpathyCallWindow *self) +add_video_preview_to_pipeline (EmpathyStreamedMediaWindow *self) { - EmpathyCallWindowPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (self); GstElement *preview; g_assert (priv->video_preview != NULL); @@ -730,9 +729,9 @@ add_video_preview_to_pipeline (EmpathyCallWindow *self) } static void -create_video_preview (EmpathyCallWindow *self) +create_video_preview (EmpathyStreamedMediaWindow *self) { - EmpathyCallWindowPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (self); GstBus *bus; g_assert (priv->video_preview == NULL); @@ -755,10 +754,10 @@ create_video_preview (EmpathyCallWindow *self) } static void -play_camera (EmpathyCallWindow *window, +play_camera (EmpathyStreamedMediaWindow *window, gboolean play) { - EmpathyCallWindowPriv *priv = GET_PRIV (window); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (window); GstElement *preview; GstState state; @@ -782,10 +781,10 @@ play_camera (EmpathyCallWindow *window, } static void -display_video_preview (EmpathyCallWindow *self, +display_video_preview (EmpathyStreamedMediaWindow *self, gboolean display) { - EmpathyCallWindowPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (self); if (display) { @@ -811,11 +810,11 @@ display_video_preview (EmpathyCallWindow *self, } static void -empathy_call_window_set_state_connecting (EmpathyCallWindow *window) +empathy_streamed_media_window_set_state_connecting (EmpathyStreamedMediaWindow *window) { - EmpathyCallWindowPriv *priv = GET_PRIV (window); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (window); - empathy_call_window_status_message (window, _("Connecting…")); + empathy_streamed_media_window_status_message (window, _("Connecting…")); priv->call_state = CONNECTING; if (priv->outgoing) @@ -824,9 +823,9 @@ empathy_call_window_set_state_connecting (EmpathyCallWindow *window) } static void -disable_camera (EmpathyCallWindow *self) +disable_camera (EmpathyStreamedMediaWindow *self) { - EmpathyCallWindowPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (self); if (priv->camera_state == CAMERA_STATE_OFF) return; @@ -836,7 +835,7 @@ disable_camera (EmpathyCallWindow *self) display_video_preview (self, FALSE); if (priv->camera_state == CAMERA_STATE_ON) - empathy_call_window_set_send_video (self, CAMERA_STATE_OFF); + empathy_streamed_media_window_set_send_video (self, CAMERA_STATE_OFF); block_camera_control_signals (self); gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON ( @@ -855,9 +854,9 @@ disable_camera (EmpathyCallWindow *self) static void tool_button_camera_off_toggled_cb (GtkToggleToolButton *toggle, - EmpathyCallWindow *self) + EmpathyStreamedMediaWindow *self) { - EmpathyCallWindowPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (self); if (!gtk_toggle_tool_button_get_active (toggle)) { @@ -876,9 +875,9 @@ tool_button_camera_off_toggled_cb (GtkToggleToolButton *toggle, } static void -enable_preview (EmpathyCallWindow *self) +enable_preview (EmpathyStreamedMediaWindow *self) { - EmpathyCallWindowPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (self); if (priv->camera_state == CAMERA_STATE_PREVIEW) return; @@ -888,7 +887,7 @@ enable_preview (EmpathyCallWindow *self) if (priv->camera_state == CAMERA_STATE_ON) { /* preview is already displayed so we just have to stop sending */ - empathy_call_window_set_send_video (self, CAMERA_STATE_PREVIEW); + empathy_streamed_media_window_set_send_video (self, CAMERA_STATE_PREVIEW); } else { @@ -912,9 +911,9 @@ enable_preview (EmpathyCallWindow *self) static void tool_button_camera_preview_toggled_cb (GtkToggleToolButton *toggle, - EmpathyCallWindow *self) + EmpathyStreamedMediaWindow *self) { - EmpathyCallWindowPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (self); if (!gtk_toggle_tool_button_get_active (toggle)) { @@ -933,9 +932,9 @@ tool_button_camera_preview_toggled_cb (GtkToggleToolButton *toggle, } static void -enable_camera (EmpathyCallWindow *self) +enable_camera (EmpathyStreamedMediaWindow *self) { - EmpathyCallWindowPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (self); if (priv->camera_state == CAMERA_STATE_ON) return; @@ -949,7 +948,7 @@ enable_camera (EmpathyCallWindow *self) DEBUG ("Enable camera"); - empathy_call_window_set_send_video (self, CAMERA_STATE_ON); + empathy_streamed_media_window_set_send_video (self, CAMERA_STATE_ON); block_camera_control_signals (self); gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON ( @@ -968,9 +967,9 @@ enable_camera (EmpathyCallWindow *self) static void tool_button_camera_on_toggled_cb (GtkToggleToolButton *toggle, - EmpathyCallWindow *self) + EmpathyStreamedMediaWindow *self) { - EmpathyCallWindowPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (self); if (!gtk_toggle_tool_button_get_active (toggle)) { @@ -991,7 +990,7 @@ tool_button_camera_on_toggled_cb (GtkToggleToolButton *toggle, static void action_camera_change_cb (GtkRadioAction *action, GtkRadioAction *current, - EmpathyCallWindow *self) + EmpathyStreamedMediaWindow *self) { CameraState state; @@ -1017,9 +1016,9 @@ action_camera_change_cb (GtkRadioAction *action, } static void -create_pipeline (EmpathyCallWindow *self) +create_pipeline (EmpathyStreamedMediaWindow *self) { - EmpathyCallWindowPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (self); GstBus *bus; g_assert (priv->pipeline == NULL); @@ -1029,16 +1028,16 @@ create_pipeline (EmpathyCallWindow *self) bus = gst_pipeline_get_bus (GST_PIPELINE (priv->pipeline)); priv->bus_message_source_id = gst_bus_add_watch (bus, - empathy_call_window_bus_message, self); + empathy_streamed_media_window_bus_message, self); g_object_unref (bus); } static void -empathy_call_window_init (EmpathyCallWindow *self) +empathy_streamed_media_window_init (EmpathyStreamedMediaWindow *self) { - EmpathyCallWindowPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (self); GtkBuilder *gui; GtkWidget *top_vbox; GtkWidget *h; @@ -1082,12 +1081,12 @@ empathy_call_window_init (EmpathyCallWindow *self) g_free (filename); empathy_builder_connect (gui, self, - "menuhangup", "activate", empathy_call_window_hangup_cb, - "hangup", "clicked", empathy_call_window_hangup_cb, - "menuredial", "activate", empathy_call_window_redial_cb, - "redial", "clicked", empathy_call_window_redial_cb, - "microphone", "toggled", empathy_call_window_mic_toggled_cb, - "menufullscreen", "activate", empathy_call_window_fullscreen_cb, + "menuhangup", "activate", empathy_streamed_media_window_hangup_cb, + "hangup", "clicked", empathy_streamed_media_window_hangup_cb, + "menuredial", "activate", empathy_streamed_media_window_redial_cb, + "redial", "clicked", empathy_streamed_media_window_redial_cb, + "microphone", "toggled", empathy_streamed_media_window_mic_toggled_cb, + "menufullscreen", "activate", empathy_streamed_media_window_fullscreen_cb, "camera_off", "toggled", tool_button_camera_off_toggled_cb, "camera_preview", "toggled", tool_button_camera_preview_toggled_cb, "camera_on", "toggled", tool_button_camera_on_toggled_cb, @@ -1170,12 +1169,12 @@ empathy_call_window_init (EmpathyCallWindow *self) gtk_box_pack_start (GTK_BOX (priv->vbox), priv->self_user_output_frame, FALSE, FALSE, 0); - empathy_call_window_setup_toolbar (self); + empathy_streamed_media_window_setup_toolbar (self); priv->sidebar_button = gtk_toggle_button_new_with_mnemonic (_("_Sidebar")); arrow = gtk_arrow_new (GTK_ARROW_RIGHT, GTK_SHADOW_NONE); g_signal_connect (G_OBJECT (priv->sidebar_button), "toggled", - G_CALLBACK (empathy_call_window_sidebar_toggled_cb), self); + G_CALLBACK (empathy_streamed_media_window_sidebar_toggled_cb), self); gtk_button_set_image (GTK_BUTTON (priv->sidebar_button), arrow); @@ -1185,22 +1184,22 @@ empathy_call_window_init (EmpathyCallWindow *self) priv->sidebar = empathy_sidebar_new (); g_signal_connect (G_OBJECT (priv->sidebar), - "hide", G_CALLBACK (empathy_call_window_sidebar_hidden_cb), self); + "hide", G_CALLBACK (empathy_streamed_media_window_sidebar_hidden_cb), self); g_signal_connect (G_OBJECT (priv->sidebar), - "show", G_CALLBACK (empathy_call_window_sidebar_shown_cb), self); + "show", G_CALLBACK (empathy_streamed_media_window_sidebar_shown_cb), self); gtk_paned_pack2 (GTK_PANED (priv->pane), priv->sidebar, FALSE, FALSE); - page = empathy_call_window_create_audio_input (self); - empathy_sidebar_add_page (EMPATHY_SIDEBAR (priv->sidebar), _("Audio input"), - page); + page = empathy_streamed_media_window_create_audio_input (self); + empathy_sidebar_add_page (EMPATHY_SIDEBAR (priv->sidebar), + _("Audio input"), page); - page = empathy_call_window_create_video_input (self); - empathy_sidebar_add_page (EMPATHY_SIDEBAR (priv->sidebar), _("Video input"), - page); + page = empathy_streamed_media_window_create_video_input (self); + empathy_sidebar_add_page (EMPATHY_SIDEBAR (priv->sidebar), + _("Video input"), page); - priv->dtmf_panel = empathy_call_window_create_dtmf (self); - empathy_sidebar_add_page (EMPATHY_SIDEBAR (priv->sidebar), _("Dialpad"), - priv->dtmf_panel); + priv->dtmf_panel = empathy_streamed_media_window_create_dtmf (self); + empathy_sidebar_add_page (EMPATHY_SIDEBAR (priv->sidebar), + _("Dialpad"), priv->dtmf_panel); gtk_widget_set_sensitive (priv->dtmf_panel, FALSE); @@ -1211,23 +1210,23 @@ empathy_call_window_init (EmpathyCallWindow *self) gtk_widget_hide (priv->sidebar); - priv->fullscreen = empathy_call_window_fullscreen_new (self); - empathy_call_window_fullscreen_set_video_widget (priv->fullscreen, + priv->fullscreen = empathy_streamed_media_window_fullscreen_new (self); + empathy_streamed_media_window_fullscreen_set_video_widget (priv->fullscreen, priv->video_output); g_signal_connect (G_OBJECT (priv->fullscreen->leave_fullscreen_button), - "clicked", G_CALLBACK (empathy_call_window_fullscreen_cb), self); + "clicked", G_CALLBACK (empathy_streamed_media_window_fullscreen_cb), self); g_signal_connect (G_OBJECT (self), "realize", - G_CALLBACK (empathy_call_window_realized_cb), self); + G_CALLBACK (empathy_streamed_media_window_realized_cb), self); g_signal_connect (G_OBJECT (self), "delete-event", - G_CALLBACK (empathy_call_window_delete_cb), self); + G_CALLBACK (empathy_streamed_media_window_delete_cb), self); g_signal_connect (G_OBJECT (self), "window-state-event", - G_CALLBACK (empathy_call_window_state_event_cb), self); + G_CALLBACK (empathy_streamed_media_window_state_event_cb), self); g_signal_connect (G_OBJECT (self), "key-press-event", - G_CALLBACK (empathy_call_window_key_press_cb), self); + G_CALLBACK (empathy_streamed_media_window_key_press_cb), self); priv->timer = g_timer_new (); @@ -1265,9 +1264,9 @@ init_contact_avatar_with_size (EmpathyContact *contact, } static void -set_window_title (EmpathyCallWindow *self) +set_window_title (EmpathyStreamedMediaWindow *self) { - EmpathyCallWindowPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (self); gchar *tmp; /* translators: Call is a noun and %s is the contact name. This string @@ -1280,7 +1279,7 @@ set_window_title (EmpathyCallWindow *self) static void contact_name_changed_cb (EmpathyContact *contact, - GParamSpec *pspec, EmpathyCallWindow *self) + GParamSpec *pspec, EmpathyStreamedMediaWindow *self) { set_window_title (self); } @@ -1306,12 +1305,12 @@ contact_avatar_changed_cb (EmpathyContact *contact, } static void -empathy_call_window_got_self_contact_cb (TpConnection *connection, +empathy_streamed_media_window_got_self_contact_cb (TpConnection *connection, EmpathyContact *contact, const GError *error, gpointer user_data, GObject *weak_object) { - EmpathyCallWindow *self = EMPATHY_CALL_WINDOW (user_data); - EmpathyCallWindowPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaWindow *self = EMPATHY_STREAMED_MEDIA_WINDOW (user_data); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (self); init_contact_avatar_with_size (contact, priv->self_user_avatar_widget, MIN (SELF_VIDEO_SECTION_WIDTH, SELF_VIDEO_SECTION_HEIGTH)); @@ -1321,10 +1320,10 @@ empathy_call_window_got_self_contact_cb (TpConnection *connection, } static void -empathy_call_window_setup_avatars (EmpathyCallWindow *self, - EmpathyCallHandler *handler) +empathy_streamed_media_window_setup_avatars (EmpathyStreamedMediaWindow *self, + EmpathyStreamedMediaHandler *handler) { - EmpathyCallWindowPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (self); g_object_get (handler, "contact", &(priv->contact), NULL); @@ -1344,7 +1343,7 @@ empathy_call_window_setup_avatars (EmpathyCallWindow *self, connection = empathy_contact_get_connection (priv->contact); empathy_tp_contact_factory_get_from_handle (connection, tp_connection_get_self_handle (connection), - empathy_call_window_got_self_contact_cb, self, NULL, G_OBJECT (self)); + empathy_streamed_media_window_got_self_contact_cb, self, NULL, G_OBJECT (self)); } else { @@ -1372,22 +1371,22 @@ empathy_call_window_setup_avatars (EmpathyCallWindow *self, } static void -update_send_codec (EmpathyCallWindow *self, +update_send_codec (EmpathyStreamedMediaWindow *self, gboolean audio) { - EmpathyCallWindowPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (self); FsCodec *codec; GtkWidget *widget; gchar *tmp; if (audio) { - codec = empathy_call_handler_get_send_audio_codec (priv->handler); + codec = empathy_streamed_media_handler_get_send_audio_codec (priv->handler); widget = priv->acodec_encoding_label; } else { - codec = empathy_call_handler_get_send_video_codec (priv->handler); + codec = empathy_streamed_media_handler_get_send_video_codec (priv->handler); widget = priv->vcodec_encoding_label; } @@ -1404,7 +1403,7 @@ send_audio_codec_notify_cb (GObject *object, GParamSpec *pspec, gpointer user_data) { - EmpathyCallWindow *self = user_data; + EmpathyStreamedMediaWindow *self = user_data; update_send_codec (self, TRUE); } @@ -1414,28 +1413,28 @@ send_video_codec_notify_cb (GObject *object, GParamSpec *pspec, gpointer user_data) { - EmpathyCallWindow *self = user_data; + EmpathyStreamedMediaWindow *self = user_data; update_send_codec (self, FALSE); } static void -update_recv_codec (EmpathyCallWindow *self, +update_recv_codec (EmpathyStreamedMediaWindow *self, gboolean audio) { - EmpathyCallWindowPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (self); GList *codecs, *l; GtkWidget *widget; GString *str = NULL; if (audio) { - codecs = empathy_call_handler_get_recv_audio_codecs (priv->handler); + codecs = empathy_streamed_media_handler_get_recv_audio_codecs (priv->handler); widget = priv->acodec_decoding_label; } else { - codecs = empathy_call_handler_get_recv_video_codecs (priv->handler); + codecs = empathy_streamed_media_handler_get_recv_video_codecs (priv->handler); widget = priv->vcodec_decoding_label; } @@ -1464,7 +1463,7 @@ recv_audio_codecs_notify_cb (GObject *object, GParamSpec *pspec, gpointer user_data) { - EmpathyCallWindow *self = user_data; + EmpathyStreamedMediaWindow *self = user_data; update_recv_codec (self, TRUE); } @@ -1474,7 +1473,7 @@ recv_video_codecs_notify_cb (GObject *object, GParamSpec *pspec, gpointer user_data) { - EmpathyCallWindow *self = user_data; + EmpathyStreamedMediaWindow *self = user_data; update_recv_codec (self, FALSE); } @@ -1520,7 +1519,7 @@ candidate_type_to_desc (FsCandidate *candidate) } static void -update_candidat_widget (EmpathyCallWindow *self, +update_candidat_widget (EmpathyStreamedMediaWindow *self, GtkWidget *label, GtkWidget *img, FsCandidate *candidate) @@ -1540,22 +1539,22 @@ update_candidat_widget (EmpathyCallWindow *self, static void candidates_changed_cb (GObject *object, FsMediaType type, - EmpathyCallWindow *self) + EmpathyStreamedMediaWindow *self) { - EmpathyCallWindowPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (self); FsCandidate *candidate = NULL; if (type == FS_MEDIA_TYPE_VIDEO) { /* Update remote candidate */ - candidate = empathy_call_handler_get_video_remote_candidate ( + candidate = empathy_streamed_media_handler_get_video_remote_candidate ( priv->handler); update_candidat_widget (self, priv->video_remote_candidate_label, priv->video_remote_candidate_info_img, candidate); /* Update local candidate */ - candidate = empathy_call_handler_get_video_local_candidate ( + candidate = empathy_streamed_media_handler_get_video_local_candidate ( priv->handler); update_candidat_widget (self, priv->video_local_candidate_label, @@ -1564,14 +1563,14 @@ candidates_changed_cb (GObject *object, else { /* Update remote candidate */ - candidate = empathy_call_handler_get_audio_remote_candidate ( + candidate = empathy_streamed_media_handler_get_audio_remote_candidate ( priv->handler); update_candidat_widget (self, priv->audio_remote_candidate_label, priv->audio_remote_candidate_info_img, candidate); /* Update local candidate */ - candidate = empathy_call_handler_get_audio_local_candidate ( + candidate = empathy_streamed_media_handler_get_audio_local_candidate ( priv->handler); update_candidat_widget (self, priv->audio_local_candidate_label, @@ -1580,11 +1579,11 @@ candidates_changed_cb (GObject *object, } static void -empathy_call_window_constructed (GObject *object) +empathy_streamed_media_window_constructed (GObject *object) { - EmpathyCallWindow *self = EMPATHY_CALL_WINDOW (object); - EmpathyCallWindowPriv *priv = GET_PRIV (self); - EmpathyTpCall *call; + EmpathyStreamedMediaWindow *self = EMPATHY_STREAMED_MEDIA_WINDOW (object); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (self); + EmpathyTpStreamedMedia *call; g_assert (priv->handler != NULL); @@ -1593,10 +1592,10 @@ empathy_call_window_constructed (GObject *object) if (call != NULL) g_object_unref (call); - empathy_call_window_setup_avatars (self, priv->handler); - empathy_call_window_set_state_connecting (self); + empathy_streamed_media_window_setup_avatars (self, priv->handler); + empathy_streamed_media_window_set_state_connecting (self); - if (!empathy_call_handler_has_initial_video (priv->handler)) + if (!empathy_streamed_media_handler_has_initial_video (priv->handler)) { gtk_toggle_tool_button_set_active ( GTK_TOGGLE_TOOL_BUTTON (priv->tool_button_camera_off), TRUE); @@ -1622,18 +1621,18 @@ empathy_call_window_constructed (GObject *object) G_CALLBACK (candidates_changed_cb), self, 0); } -static void empathy_call_window_dispose (GObject *object); -static void empathy_call_window_finalize (GObject *object); +static void empathy_streamed_media_window_dispose (GObject *object); +static void empathy_streamed_media_window_finalize (GObject *object); static void -empathy_call_window_set_property (GObject *object, +empathy_streamed_media_window_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { - EmpathyCallWindowPriv *priv = GET_PRIV (object); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (object); switch (property_id) { - case PROP_CALL_HANDLER: + case PROP_STREAMED_MEDIA_HANDLER: priv->handler = g_value_dup_object (value); break; default: @@ -1642,14 +1641,14 @@ empathy_call_window_set_property (GObject *object, } static void -empathy_call_window_get_property (GObject *object, +empathy_streamed_media_window_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { - EmpathyCallWindowPriv *priv = GET_PRIV (object); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (object); switch (property_id) { - case PROP_CALL_HANDLER: + case PROP_STREAMED_MEDIA_HANDLER: g_value_set_object (value, priv->handler); break; default: @@ -1658,44 +1657,44 @@ empathy_call_window_get_property (GObject *object, } static void -empathy_call_window_class_init ( - EmpathyCallWindowClass *empathy_call_window_class) +empathy_streamed_media_window_class_init ( + EmpathyStreamedMediaWindowClass *empathy_streamed_media_window_class) { - GObjectClass *object_class = G_OBJECT_CLASS (empathy_call_window_class); + GObjectClass *object_class = G_OBJECT_CLASS (empathy_streamed_media_window_class); GParamSpec *param_spec; - g_type_class_add_private (empathy_call_window_class, - sizeof (EmpathyCallWindowPriv)); + g_type_class_add_private (empathy_streamed_media_window_class, + sizeof (EmpathyStreamedMediaWindowPriv)); - object_class->constructed = empathy_call_window_constructed; - object_class->set_property = empathy_call_window_set_property; - object_class->get_property = empathy_call_window_get_property; + object_class->constructed = empathy_streamed_media_window_constructed; + object_class->set_property = empathy_streamed_media_window_set_property; + object_class->get_property = empathy_streamed_media_window_get_property; - object_class->dispose = empathy_call_window_dispose; - object_class->finalize = empathy_call_window_finalize; + object_class->dispose = empathy_streamed_media_window_dispose; + object_class->finalize = empathy_streamed_media_window_finalize; param_spec = g_param_spec_object ("handler", "handler", "The call handler", - EMPATHY_TYPE_CALL_HANDLER, + EMPATHY_TYPE_STREAMED_MEDIA_HANDLER, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); g_object_class_install_property (object_class, - PROP_CALL_HANDLER, param_spec); + PROP_STREAMED_MEDIA_HANDLER, param_spec); } static void -empathy_call_window_video_stream_changed_cb (EmpathyTpCall *call, - GParamSpec *property, EmpathyCallWindow *self) +empathy_streamed_media_window_video_stream_changed_cb (EmpathyTpStreamedMedia *call, + GParamSpec *property, EmpathyStreamedMediaWindow *self) { DEBUG ("video stream changed"); - empathy_call_window_update_avatars_visibility (call, self); + empathy_streamed_media_window_update_avatars_visibility (call, self); } void -empathy_call_window_dispose (GObject *object) +empathy_streamed_media_window_dispose (GObject *object) { - EmpathyTpCall *call; - EmpathyCallWindow *self = EMPATHY_CALL_WINDOW (object); - EmpathyCallWindowPriv *priv = GET_PRIV (self); + EmpathyTpStreamedMedia *call; + EmpathyStreamedMediaWindow *self = EMPATHY_STREAMED_MEDIA_WINDOW (object); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (self); if (priv->dispose_has_run) return; @@ -1711,7 +1710,7 @@ empathy_call_window_dispose (GObject *object) if (priv->handler != NULL) { - empathy_call_handler_stop_call (priv->handler); + empathy_streamed_media_handler_stop_call (priv->handler); g_object_unref (priv->handler); } priv->handler = NULL; @@ -1771,14 +1770,14 @@ empathy_call_window_dispose (GObject *object) } /* release any references held by the object here */ - if (G_OBJECT_CLASS (empathy_call_window_parent_class)->dispose) - G_OBJECT_CLASS (empathy_call_window_parent_class)->dispose (object); + if (G_OBJECT_CLASS (empathy_streamed_media_window_parent_class)->dispose) + G_OBJECT_CLASS (empathy_streamed_media_window_parent_class)->dispose (object); } static void -disconnect_video_output_motion_handler (EmpathyCallWindow *self) +disconnect_video_output_motion_handler (EmpathyStreamedMediaWindow *self) { - EmpathyCallWindowPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (self); if (priv->video_output_motion_handler_id != 0) { @@ -1789,10 +1788,10 @@ disconnect_video_output_motion_handler (EmpathyCallWindow *self) } void -empathy_call_window_finalize (GObject *object) +empathy_streamed_media_window_finalize (GObject *object) { - EmpathyCallWindow *self = EMPATHY_CALL_WINDOW (object); - EmpathyCallWindowPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaWindow *self = EMPATHY_STREAMED_MEDIA_WINDOW (object); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (self); disconnect_video_output_motion_handler (self); @@ -1801,23 +1800,23 @@ empathy_call_window_finalize (GObject *object) g_timer_destroy (priv->timer); - G_OBJECT_CLASS (empathy_call_window_parent_class)->finalize (object); + G_OBJECT_CLASS (empathy_streamed_media_window_parent_class)->finalize (object); } -EmpathyCallWindow * -empathy_call_window_new (EmpathyCallHandler *handler) +EmpathyStreamedMediaWindow * +empathy_streamed_media_window_new (EmpathyStreamedMediaHandler *handler) { - return EMPATHY_CALL_WINDOW ( - g_object_new (EMPATHY_TYPE_CALL_WINDOW, "handler", handler, NULL)); + return EMPATHY_STREAMED_MEDIA_WINDOW ( + g_object_new (EMPATHY_TYPE_STREAMED_MEDIA_WINDOW, "handler", handler, NULL)); } static void -empathy_call_window_conference_added_cb (EmpathyCallHandler *handler, +empathy_streamed_media_window_conference_added_cb (EmpathyStreamedMediaHandler *handler, GstElement *conference, gpointer user_data) { - EmpathyCallWindow *self = EMPATHY_CALL_WINDOW (user_data); - EmpathyCallWindowPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaWindow *self = EMPATHY_STREAMED_MEDIA_WINDOW (user_data); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (self); gst_bin_add (GST_BIN (priv->pipeline), conference); @@ -1825,11 +1824,11 @@ empathy_call_window_conference_added_cb (EmpathyCallHandler *handler, } static gboolean -empathy_call_window_request_resource_cb (EmpathyCallHandler *handler, +empathy_streamed_media_window_request_resource_cb (EmpathyStreamedMediaHandler *handler, FsMediaType type, FsStreamDirection direction, gpointer user_data) { - EmpathyCallWindow *self = EMPATHY_CALL_WINDOW (user_data); - EmpathyCallWindowPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaWindow *self = EMPATHY_STREAMED_MEDIA_WINDOW (user_data); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (self); if (type != FS_MEDIA_TYPE_VIDEO) return TRUE; @@ -1842,10 +1841,10 @@ empathy_call_window_request_resource_cb (EmpathyCallHandler *handler, } static gboolean -empathy_call_window_reset_pipeline (EmpathyCallWindow *self) +empathy_streamed_media_window_reset_pipeline (EmpathyStreamedMediaWindow *self) { GstStateChangeReturn state_change_return; - EmpathyCallWindowPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (self); if (priv->pipeline == NULL) return TRUE; @@ -1866,7 +1865,7 @@ empathy_call_window_reset_pipeline (EmpathyCallWindow *self) priv->pipeline = NULL; g_signal_handlers_disconnect_by_func (priv->audio_input_adj, - empathy_call_window_mic_volume_changed_cb, self); + empathy_streamed_media_window_mic_volume_changed_cb, self); if (priv->video_tee != NULL) g_object_unref (priv->video_tee); @@ -1896,9 +1895,9 @@ empathy_call_window_reset_pipeline (EmpathyCallWindow *self) } static void -reset_details_pane (EmpathyCallWindow *self) +reset_details_pane (EmpathyStreamedMediaWindow *self) { - EmpathyCallWindowPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (self); gtk_label_set_text (GTK_LABEL (priv->vcodec_encoding_label), _("Unknown")); gtk_label_set_text (GTK_LABEL (priv->acodec_encoding_label), _("Unknown")); @@ -1907,11 +1906,11 @@ reset_details_pane (EmpathyCallWindow *self) } static gboolean -empathy_call_window_disconnected (EmpathyCallWindow *self, +empathy_streamed_media_window_disconnected (EmpathyStreamedMediaWindow *self, gboolean restart) { gboolean could_disconnect = FALSE; - EmpathyCallWindowPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (self); gboolean could_reset_pipeline; /* Leave full screen mode if needed */ @@ -1919,7 +1918,7 @@ empathy_call_window_disconnected (EmpathyCallWindow *self, gtk_action_set_sensitive (priv->menu_fullscreen, FALSE); - could_reset_pipeline = empathy_call_window_reset_pipeline (self); + could_reset_pipeline = empathy_streamed_media_window_reset_pipeline (self); if (priv->call_state == CONNECTING) empathy_sound_stop (EMPATHY_SOUND_PHONE_OUTGOING); @@ -1944,7 +1943,7 @@ empathy_call_window_disconnected (EmpathyCallWindow *self, * a video preview */ return TRUE; - empathy_call_window_status_message (self, _("Disconnected")); + empathy_streamed_media_window_status_message (self, _("Disconnected")); gtk_action_set_sensitive (priv->redial, TRUE); gtk_widget_set_sensitive (priv->redial_button, TRUE); @@ -1995,24 +1994,24 @@ empathy_call_window_disconnected (EmpathyCallWindow *self, static void -empathy_call_window_channel_closed_cb (EmpathyCallHandler *handler, +empathy_streamed_media_window_channel_closed_cb (EmpathyStreamedMediaHandler *handler, gpointer user_data) { - EmpathyCallWindow *self = EMPATHY_CALL_WINDOW (user_data); - EmpathyCallWindowPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaWindow *self = EMPATHY_STREAMED_MEDIA_WINDOW (user_data); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (self); - if (empathy_call_window_disconnected (self, TRUE) && + if (empathy_streamed_media_window_disconnected (self, TRUE) && priv->call_state == REDIALING) - empathy_call_window_restart_call (self); + empathy_streamed_media_window_restart_call (self); } static void -empathy_call_window_channel_stream_closed_cb (EmpathyCallHandler *handler, +empathy_streamed_media_window_channel_stream_closed_cb (EmpathyStreamedMediaHandler *handler, TfStream *stream, gpointer user_data) { - EmpathyCallWindow *self = EMPATHY_CALL_WINDOW (user_data); - EmpathyCallWindowPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaWindow *self = EMPATHY_STREAMED_MEDIA_WINDOW (user_data); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (self); guint media_type; g_object_get (stream, "media-type", &media_type, NULL); @@ -2054,9 +2053,9 @@ empathy_call_window_channel_stream_closed_cb (EmpathyCallHandler *handler, /* Called with global lock held */ static GstPad * -empathy_call_window_get_video_sink_pad (EmpathyCallWindow *self) +empathy_streamed_media_window_get_video_sink_pad (EmpathyStreamedMediaWindow *self) { - EmpathyCallWindowPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (self); GstPad *pad; GstElement *output; @@ -2135,9 +2134,9 @@ empathy_call_window_get_video_sink_pad (EmpathyCallWindow *self) /* Called with global lock held */ static GstPad * -empathy_call_window_get_audio_sink_pad (EmpathyCallWindow *self) +empathy_streamed_media_window_get_audio_sink_pad (EmpathyStreamedMediaWindow *self) { - EmpathyCallWindowPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (self); GstPad *pad; GstElement *filter; GError *gerror = NULL; @@ -2250,10 +2249,10 @@ empathy_call_window_get_audio_sink_pad (EmpathyCallWindow *self) } static gboolean -empathy_call_window_update_timer (gpointer user_data) +empathy_streamed_media_window_update_timer (gpointer user_data) { - EmpathyCallWindow *self = EMPATHY_CALL_WINDOW (user_data); - EmpathyCallWindowPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaWindow *self = EMPATHY_STREAMED_MEDIA_WINDOW (user_data); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (self); gchar *str; gdouble time_; @@ -2262,21 +2261,21 @@ empathy_call_window_update_timer (gpointer user_data) /* Translators: number of minutes:seconds the caller has been connected */ str = g_strdup_printf (_("Connected — %d:%02dm"), (int) time_ / 60, (int) time_ % 60); - empathy_call_window_status_message (self, str); + empathy_streamed_media_window_status_message (self, str); g_free (str); return TRUE; } static void -display_error (EmpathyCallWindow *self, - EmpathyTpCall *call, +display_error (EmpathyStreamedMediaWindow *self, + EmpathyTpStreamedMedia *call, const gchar *img, const gchar *title, const gchar *desc, const gchar *details) { - EmpathyCallWindowPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (self); GtkWidget *info_bar; GtkWidget *content_area; GtkWidget *hbox; @@ -2344,12 +2343,12 @@ display_error (EmpathyCallWindow *self, } static gchar * -media_stream_error_to_txt (EmpathyCallWindow *self, - EmpathyTpCall *call, +media_stream_error_to_txt (EmpathyStreamedMediaWindow *self, + EmpathyTpStreamedMedia *call, gboolean audio, TpMediaStreamError error) { - EmpathyCallWindowPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (self); const gchar *cm; gchar *url; gchar *result; @@ -2387,7 +2386,7 @@ media_stream_error_to_txt (EmpathyCallWindow *self, "are not installed on your computer")); case TP_MEDIA_STREAM_ERROR_INVALID_CM_BEHAVIOR: - cm = empathy_tp_call_get_connection_manager (call); + cm = empathy_tp_streamed_media_get_connection_manager (call); url = g_strdup_printf ("http://bugs.freedesktop.org/enter_bug.cgi?" "product=Telepathy&component=%s", cm); @@ -2413,8 +2412,8 @@ media_stream_error_to_txt (EmpathyCallWindow *self, } static void -empathy_call_window_stream_error (EmpathyCallWindow *self, - EmpathyTpCall *call, +empathy_streamed_media_window_stream_error (EmpathyStreamedMediaWindow *self, + EmpathyTpStreamedMedia *call, gboolean audio, guint code, const gchar *msg, @@ -2438,31 +2437,31 @@ empathy_call_window_stream_error (EmpathyCallWindow *self, } static void -empathy_call_window_audio_stream_error (EmpathyTpCall *call, +empathy_streamed_media_window_audio_stream_error (EmpathyTpStreamedMedia *call, guint code, const gchar *msg, - EmpathyCallWindow *self) + EmpathyStreamedMediaWindow *self) { - empathy_call_window_stream_error (self, call, TRUE, code, msg, + empathy_streamed_media_window_stream_error (self, call, TRUE, code, msg, "gnome-stock-mic", _("Can't establish audio stream")); } static void -empathy_call_window_video_stream_error (EmpathyTpCall *call, +empathy_streamed_media_window_video_stream_error (EmpathyTpStreamedMedia *call, guint code, const gchar *msg, - EmpathyCallWindow *self) + EmpathyStreamedMediaWindow *self) { - empathy_call_window_stream_error (self, call, FALSE, code, msg, + empathy_streamed_media_window_stream_error (self, call, FALSE, code, msg, "camera-web", _("Can't establish video stream")); } static gboolean -empathy_call_window_connected (gpointer user_data) +empathy_streamed_media_window_connected (gpointer user_data) { - EmpathyCallWindow *self = EMPATHY_CALL_WINDOW (user_data); - EmpathyCallWindowPriv *priv = GET_PRIV (self); - EmpathyTpCall *call; + EmpathyStreamedMediaWindow *self = EMPATHY_STREAMED_MEDIA_WINDOW (user_data); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (self); + EmpathyTpStreamedMedia *call; gboolean can_send_video; empathy_sound_stop (EMPATHY_SOUND_PHONE_OUTGOING); @@ -2473,17 +2472,17 @@ empathy_call_window_connected (gpointer user_data) g_object_get (priv->handler, "tp-call", &call, NULL); tp_g_signal_connect_object (call, "notify::video-stream", - G_CALLBACK (empathy_call_window_video_stream_changed_cb), + G_CALLBACK (empathy_streamed_media_window_video_stream_changed_cb), self, 0); - if (empathy_tp_call_has_dtmf (call)) + if (empathy_tp_streamed_media_has_dtmf (call)) gtk_widget_set_sensitive (priv->dtmf_panel, TRUE); if (priv->video_input == NULL) - empathy_call_window_set_send_video (self, CAMERA_STATE_OFF); + empathy_streamed_media_window_set_send_video (self, CAMERA_STATE_OFF); priv->sending_video = can_send_video ? - empathy_tp_call_is_sending_video (call) : FALSE; + empathy_tp_streamed_media_is_sending_video (call) : FALSE; gtk_toggle_tool_button_set_active ( GTK_TOGGLE_TOOL_BUTTON (priv->tool_button_camera_on), @@ -2495,18 +2494,18 @@ empathy_call_window_connected (gpointer user_data) gtk_widget_set_sensitive (priv->mic_button, TRUE); - empathy_call_window_update_avatars_visibility (call, self); + empathy_streamed_media_window_update_avatars_visibility (call, self); g_object_unref (call); g_mutex_lock (priv->lock); priv->timer_id = g_timeout_add_seconds (1, - empathy_call_window_update_timer, self); + empathy_streamed_media_window_update_timer, self); g_mutex_unlock (priv->lock); - empathy_call_window_update_timer (self); + empathy_streamed_media_window_update_timer (self); gtk_action_set_sensitive (priv->menu_fullscreen, TRUE); @@ -2516,11 +2515,11 @@ empathy_call_window_connected (gpointer user_data) /* Called from the streaming thread */ static gboolean -empathy_call_window_src_added_cb (EmpathyCallHandler *handler, +empathy_streamed_media_window_src_added_cb (EmpathyStreamedMediaHandler *handler, GstPad *src, guint media_type, gpointer user_data) { - EmpathyCallWindow *self = EMPATHY_CALL_WINDOW (user_data); - EmpathyCallWindowPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaWindow *self = EMPATHY_STREAMED_MEDIA_WINDOW (user_data); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (self); gboolean retval = FALSE; GstPad *pad; @@ -2530,19 +2529,19 @@ empathy_call_window_src_added_cb (EmpathyCallHandler *handler, if (priv->call_state != CONNECTED) { g_timer_start (priv->timer); - priv->timer_id = g_idle_add (empathy_call_window_connected, self); + priv->timer_id = g_idle_add (empathy_streamed_media_window_connected, self); priv->call_state = CONNECTED; } switch (media_type) { case TP_MEDIA_STREAM_TYPE_AUDIO: - pad = empathy_call_window_get_audio_sink_pad (self); + pad = empathy_streamed_media_window_get_audio_sink_pad (self); break; case TP_MEDIA_STREAM_TYPE_VIDEO: gtk_widget_hide (priv->remote_user_avatar_widget); gtk_widget_show (priv->video_output); - pad = empathy_call_window_get_video_sink_pad (self); + pad = empathy_streamed_media_window_get_video_sink_pad (self); break; default: g_assert_not_reached (); @@ -2597,11 +2596,11 @@ empathy_call_window_src_added_cb (EmpathyCallHandler *handler, } static gboolean -empathy_call_window_sink_added_cb (EmpathyCallHandler *handler, +empathy_streamed_media_window_sink_added_cb (EmpathyStreamedMediaHandler *handler, GstPad *sink, guint media_type, gpointer user_data) { - EmpathyCallWindow *self = EMPATHY_CALL_WINDOW (user_data); - EmpathyCallWindowPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaWindow *self = EMPATHY_STREAMED_MEDIA_WINDOW (user_data); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (self); GstPad *pad; gboolean retval = FALSE; @@ -2664,9 +2663,9 @@ empathy_call_window_sink_added_cb (EmpathyCallHandler *handler, } static void -empathy_call_window_remove_video_input (EmpathyCallWindow *self) +empathy_streamed_media_window_remove_video_input (EmpathyStreamedMediaWindow *self) { - EmpathyCallWindowPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (self); GstElement *preview; disable_camera (self); @@ -2694,15 +2693,15 @@ empathy_call_window_remove_video_input (EmpathyCallWindow *self) } static void -start_call (EmpathyCallWindow *self) +start_call (EmpathyStreamedMediaWindow *self) { - EmpathyCallWindowPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (self); priv->call_started = TRUE; - empathy_call_handler_start_call (priv->handler, + empathy_streamed_media_handler_start_call (priv->handler, gtk_get_current_event_time ()); - if (empathy_call_handler_has_initial_video (priv->handler)) + if (empathy_streamed_media_handler_has_initial_video (priv->handler)) { /* Enable 'send video' buttons and display the preview */ gtk_toggle_tool_button_set_active ( @@ -2711,14 +2710,14 @@ start_call (EmpathyCallWindow *self) } static gboolean -empathy_call_window_bus_message (GstBus *bus, GstMessage *message, +empathy_streamed_media_window_bus_message (GstBus *bus, GstMessage *message, gpointer user_data) { - EmpathyCallWindow *self = EMPATHY_CALL_WINDOW (user_data); - EmpathyCallWindowPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaWindow *self = EMPATHY_STREAMED_MEDIA_WINDOW (user_data); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (self); GstState newstate; - empathy_call_handler_bus_message (priv->handler, bus, message); + empathy_streamed_media_handler_bus_message (priv->handler, bus, message); switch (GST_MESSAGE_TYPE (message)) { @@ -2727,7 +2726,7 @@ empathy_call_window_bus_message (GstBus *bus, GstMessage *message, { gst_message_parse_state_changed (message, NULL, &newstate, NULL); if (newstate == GST_STATE_PAUSED) - empathy_call_window_setup_video_input (self); + empathy_streamed_media_window_setup_video_input (self); } if (GST_MESSAGE_SRC (message) == GST_OBJECT (priv->pipeline) && !priv->call_started) @@ -2759,12 +2758,12 @@ empathy_call_window_bus_message (GstBus *bus, GstMessage *message, { /* Remove the video input and continue */ if (priv->video_input != NULL) - empathy_call_window_remove_video_input (self); + empathy_streamed_media_window_remove_video_input (self); gst_element_set_state (priv->pipeline, GST_STATE_PLAYING); } else { - empathy_call_window_disconnected (self, TRUE); + empathy_streamed_media_window_disconnected (self, TRUE); } g_error_free (error); g_free (debug); @@ -2796,12 +2795,12 @@ empathy_call_window_bus_message (GstBus *bus, GstMessage *message, } static void -empathy_call_window_update_avatars_visibility (EmpathyTpCall *call, - EmpathyCallWindow *window) +empathy_streamed_media_window_update_avatars_visibility (EmpathyTpStreamedMedia *call, + EmpathyStreamedMediaWindow *window) { - EmpathyCallWindowPriv *priv = GET_PRIV (window); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (window); - if (empathy_tp_call_is_receiving_video (call)) + if (empathy_tp_streamed_media_is_receiving_video (call)) { gtk_widget_hide (priv->remote_user_avatar_widget); gtk_widget_show (priv->video_output); @@ -2814,52 +2813,52 @@ empathy_call_window_update_avatars_visibility (EmpathyTpCall *call, } static void -call_handler_notify_tp_call_cb (EmpathyCallHandler *handler, +call_handler_notify_tp_streamed_media_cb (EmpathyStreamedMediaHandler *handler, GParamSpec *spec, - EmpathyCallWindow *self) + EmpathyStreamedMediaWindow *self) { - EmpathyCallWindowPriv *priv = GET_PRIV (self); - EmpathyTpCall *call; + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (self); + EmpathyTpStreamedMedia *call; g_object_get (priv->handler, "tp-call", &call, NULL); if (call == NULL) return; tp_g_signal_connect_object (call, "audio-stream-error", - G_CALLBACK (empathy_call_window_audio_stream_error), self, 0); + G_CALLBACK (empathy_streamed_media_window_audio_stream_error), self, 0); tp_g_signal_connect_object (call, "video-stream-error", - G_CALLBACK (empathy_call_window_video_stream_error), self, 0); + G_CALLBACK (empathy_streamed_media_window_video_stream_error), self, 0); g_object_unref (call); } static void -empathy_call_window_realized_cb (GtkWidget *widget, EmpathyCallWindow *window) +empathy_streamed_media_window_realized_cb (GtkWidget *widget, EmpathyStreamedMediaWindow *window) { - EmpathyCallWindowPriv *priv = GET_PRIV (window); - EmpathyTpCall *call; + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (window); + EmpathyTpStreamedMedia *call; g_signal_connect (priv->handler, "conference-added", - G_CALLBACK (empathy_call_window_conference_added_cb), window); + G_CALLBACK (empathy_streamed_media_window_conference_added_cb), window); g_signal_connect (priv->handler, "request-resource", - G_CALLBACK (empathy_call_window_request_resource_cb), window); + G_CALLBACK (empathy_streamed_media_window_request_resource_cb), window); g_signal_connect (priv->handler, "closed", - G_CALLBACK (empathy_call_window_channel_closed_cb), window); + G_CALLBACK (empathy_streamed_media_window_channel_closed_cb), window); g_signal_connect (priv->handler, "src-pad-added", - G_CALLBACK (empathy_call_window_src_added_cb), window); + G_CALLBACK (empathy_streamed_media_window_src_added_cb), window); g_signal_connect (priv->handler, "sink-pad-added", - G_CALLBACK (empathy_call_window_sink_added_cb), window); + G_CALLBACK (empathy_streamed_media_window_sink_added_cb), window); g_signal_connect (priv->handler, "stream-closed", - G_CALLBACK (empathy_call_window_channel_stream_closed_cb), window); + G_CALLBACK (empathy_streamed_media_window_channel_stream_closed_cb), window); g_object_get (priv->handler, "tp-call", &call, NULL); if (call != NULL) { tp_g_signal_connect_object (call, "audio-stream-error", - G_CALLBACK (empathy_call_window_audio_stream_error), window, + G_CALLBACK (empathy_streamed_media_window_audio_stream_error), window, 0); tp_g_signal_connect_object (call, "video-stream-error", - G_CALLBACK (empathy_call_window_video_stream_error), window, + G_CALLBACK (empathy_streamed_media_window_video_stream_error), window, 0); g_object_unref (call); @@ -2869,17 +2868,17 @@ empathy_call_window_realized_cb (GtkWidget *widget, EmpathyCallWindow *window) /* tp-call doesn't exist yet, we'll connect signals once it has been * set */ g_signal_connect (priv->handler, "notify::tp-call", - G_CALLBACK (call_handler_notify_tp_call_cb), window); + G_CALLBACK (call_handler_notify_tp_streamed_media_cb), window); } gst_element_set_state (priv->pipeline, GST_STATE_PAUSED); } static gboolean -empathy_call_window_delete_cb (GtkWidget *widget, GdkEvent*event, - EmpathyCallWindow *window) +empathy_streamed_media_window_delete_cb (GtkWidget *widget, GdkEvent*event, + EmpathyStreamedMediaWindow *window) { - EmpathyCallWindowPriv *priv = GET_PRIV (window); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (window); if (priv->pipeline != NULL) { @@ -2899,10 +2898,10 @@ empathy_call_window_delete_cb (GtkWidget *widget, GdkEvent*event, } static void -show_controls (EmpathyCallWindow *window, gboolean set_fullscreen) +show_controls (EmpathyStreamedMediaWindow *window, gboolean set_fullscreen) { GtkWidget *menu; - EmpathyCallWindowPriv *priv = GET_PRIV (window); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (window); menu = gtk_ui_manager_get_widget (priv->ui_manager, "/menubar1"); @@ -2931,9 +2930,9 @@ show_controls (EmpathyCallWindow *window, gboolean set_fullscreen) } static void -show_borders (EmpathyCallWindow *window, gboolean set_fullscreen) +show_borders (EmpathyStreamedMediaWindow *window, gboolean set_fullscreen) { - EmpathyCallWindowPriv *priv = GET_PRIV (window); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (window); gtk_container_set_border_width (GTK_CONTAINER (priv->content_hbox), set_fullscreen ? 0 : CONTENT_HBOX_BORDER_WIDTH); @@ -2955,12 +2954,12 @@ show_borders (EmpathyCallWindow *window, gboolean set_fullscreen) } static gboolean -empathy_call_window_state_event_cb (GtkWidget *widget, - GdkEventWindowState *event, EmpathyCallWindow *window) +empathy_streamed_media_window_state_event_cb (GtkWidget *widget, + GdkEventWindowState *event, EmpathyStreamedMediaWindow *window) { if (event->changed_mask & GDK_WINDOW_STATE_FULLSCREEN) { - EmpathyCallWindowPriv *priv = GET_PRIV (window); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (window); gboolean set_fullscreen = event->new_window_state & GDK_WINDOW_STATE_FULLSCREEN; @@ -2985,7 +2984,7 @@ empathy_call_window_state_event_cb (GtkWidget *widget, { priv->video_output_motion_handler_id = g_signal_connect ( G_OBJECT (priv->video_output), "motion-notify-event", - G_CALLBACK (empathy_call_window_video_output_motion_notify), + G_CALLBACK (empathy_streamed_media_window_video_output_motion_notify), window); } } @@ -2994,7 +2993,7 @@ empathy_call_window_state_event_cb (GtkWidget *widget, disconnect_video_output_motion_handler (window); } - empathy_call_window_fullscreen_set_fullscreen (priv->fullscreen, + empathy_streamed_media_window_fullscreen_set_fullscreen (priv->fullscreen, set_fullscreen); show_controls (window, set_fullscreen); show_borders (window, set_fullscreen); @@ -3007,10 +3006,10 @@ empathy_call_window_state_event_cb (GtkWidget *widget, } static void -empathy_call_window_sidebar_toggled_cb (GtkToggleButton *toggle, - EmpathyCallWindow *window) +empathy_streamed_media_window_sidebar_toggled_cb (GtkToggleButton *toggle, + EmpathyStreamedMediaWindow *window) { - EmpathyCallWindowPriv *priv = GET_PRIV (window); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (window); GtkWidget *arrow; int w, h, handle_size; GtkAllocation allocation, sidebar_allocation; @@ -3042,11 +3041,11 @@ empathy_call_window_sidebar_toggled_cb (GtkToggleButton *toggle, } static void -empathy_call_window_set_send_video (EmpathyCallWindow *window, +empathy_streamed_media_window_set_send_video (EmpathyStreamedMediaWindow *window, CameraState state) { - EmpathyCallWindowPriv *priv = GET_PRIV (window); - EmpathyTpCall *call; + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (window); + EmpathyTpStreamedMedia *call; priv->sending_video = (state == CAMERA_STATE_ON); @@ -3067,15 +3066,15 @@ empathy_call_window_set_send_video (EmpathyCallWindow *window, g_object_get (priv->handler, "tp-call", &call, NULL); DEBUG ("%s sending video", priv->sending_video ? "start": "stop"); - empathy_tp_call_request_video_stream_direction (call, priv->sending_video); + empathy_tp_streamed_media_request_video_stream_direction (call, priv->sending_video); g_object_unref (call); } static void -empathy_call_window_mic_toggled_cb (GtkToggleToolButton *toggle, - EmpathyCallWindow *window) +empathy_streamed_media_window_mic_toggled_cb (GtkToggleToolButton *toggle, + EmpathyStreamedMediaWindow *window) { - EmpathyCallWindowPriv *priv = GET_PRIV (window); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (window); gboolean active; active = (gtk_toggle_tool_button_get_active (toggle)); @@ -3100,41 +3099,41 @@ empathy_call_window_mic_toggled_cb (GtkToggleToolButton *toggle, } static void -empathy_call_window_sidebar_hidden_cb (EmpathySidebar *sidebar, - EmpathyCallWindow *window) +empathy_streamed_media_window_sidebar_hidden_cb (EmpathySidebar *sidebar, + EmpathyStreamedMediaWindow *window) { - EmpathyCallWindowPriv *priv = GET_PRIV (window); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (window); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->sidebar_button), FALSE); } static void -empathy_call_window_sidebar_shown_cb (EmpathySidebar *sidebar, - EmpathyCallWindow *window) +empathy_streamed_media_window_sidebar_shown_cb (EmpathySidebar *sidebar, + EmpathyStreamedMediaWindow *window) { - EmpathyCallWindowPriv *priv = GET_PRIV (window); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (window); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->sidebar_button), TRUE); } static void -empathy_call_window_hangup_cb (gpointer object, - EmpathyCallWindow *window) +empathy_streamed_media_window_hangup_cb (gpointer object, + EmpathyStreamedMediaWindow *window) { - EmpathyCallWindowPriv *priv = GET_PRIV (window); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (window); - empathy_call_handler_stop_call (priv->handler); + empathy_streamed_media_handler_stop_call (priv->handler); - if (empathy_call_window_disconnected (window, FALSE)) + if (empathy_streamed_media_window_disconnected (window, FALSE)) gtk_widget_destroy (GTK_WIDGET (window)); } static void -empathy_call_window_restart_call (EmpathyCallWindow *window) +empathy_streamed_media_window_restart_call (EmpathyStreamedMediaWindow *window) { - EmpathyCallWindowPriv *priv = GET_PRIV (window); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (window); /* Remove error info bars */ gtk_container_forall (GTK_CONTAINER (priv->errors_vbox), @@ -3143,15 +3142,15 @@ empathy_call_window_restart_call (EmpathyCallWindow *window) create_video_output_widget (window); g_signal_connect (G_OBJECT (priv->audio_input_adj), "value-changed", - G_CALLBACK (empathy_call_window_mic_volume_changed_cb), window); + G_CALLBACK (empathy_streamed_media_window_mic_volume_changed_cb), window); /* While the call was disconnected, the input volume might have changed. * However, since the audio_input source was destroyed, its volume has not * been updated during that time. That's why we manually update it here */ - empathy_call_window_mic_volume_changed_cb (priv->audio_input_adj, window); + empathy_streamed_media_window_mic_volume_changed_cb (priv->audio_input_adj, window); priv->outgoing = TRUE; - empathy_call_window_set_state_connecting (window); + empathy_streamed_media_window_set_state_connecting (window); if (priv->pipeline_playing) start_call (window); @@ -3160,38 +3159,38 @@ empathy_call_window_restart_call (EmpathyCallWindow *window) priv->start_call_when_playing = TRUE; - empathy_call_window_setup_avatars (window, priv->handler); + empathy_streamed_media_window_setup_avatars (window, priv->handler); gtk_action_set_sensitive (priv->redial, FALSE); gtk_widget_set_sensitive (priv->redial_button, FALSE); } static void -empathy_call_window_redial_cb (gpointer object, - EmpathyCallWindow *window) +empathy_streamed_media_window_redial_cb (gpointer object, + EmpathyStreamedMediaWindow *window) { - EmpathyCallWindowPriv *priv = GET_PRIV (window); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (window); if (priv->call_state == CONNECTED) priv->call_state = REDIALING; - empathy_call_handler_stop_call (priv->handler); + empathy_streamed_media_handler_stop_call (priv->handler); if (priv->call_state != CONNECTED) - empathy_call_window_restart_call (window); + empathy_streamed_media_window_restart_call (window); } static void -empathy_call_window_fullscreen_cb (gpointer object, - EmpathyCallWindow *window) +empathy_streamed_media_window_fullscreen_cb (gpointer object, + EmpathyStreamedMediaWindow *window) { - empathy_call_window_fullscreen_toggle (window); + empathy_streamed_media_window_fullscreen_toggle (window); } static void -empathy_call_window_fullscreen_toggle (EmpathyCallWindow *window) +empathy_streamed_media_window_fullscreen_toggle (EmpathyStreamedMediaWindow *window) { - EmpathyCallWindowPriv *priv = GET_PRIV (window); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (window); if (priv->is_fullscreen) gtk_window_unfullscreen (GTK_WINDOW (window)); @@ -3200,12 +3199,12 @@ empathy_call_window_fullscreen_toggle (EmpathyCallWindow *window) } static gboolean -empathy_call_window_video_button_press_cb (GtkWidget *video_output, - GdkEventButton *event, EmpathyCallWindow *window) +empathy_streamed_media_window_video_button_press_cb (GtkWidget *video_output, + GdkEventButton *event, EmpathyStreamedMediaWindow *window) { if (event->button == 3 && event->type == GDK_BUTTON_PRESS) { - empathy_call_window_video_menu_popup (window, event->button); + empathy_streamed_media_window_video_menu_popup (window, event->button); return TRUE; } @@ -3213,16 +3212,16 @@ empathy_call_window_video_button_press_cb (GtkWidget *video_output, } static gboolean -empathy_call_window_key_press_cb (GtkWidget *video_output, - GdkEventKey *event, EmpathyCallWindow *window) +empathy_streamed_media_window_key_press_cb (GtkWidget *video_output, + GdkEventKey *event, EmpathyStreamedMediaWindow *window) { - EmpathyCallWindowPriv *priv = GET_PRIV (window); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (window); if (priv->is_fullscreen && event->keyval == GDK_Escape) { /* Since we are in fullscreen mode, toggling will bring us back to normal mode. */ - empathy_call_window_fullscreen_toggle (window); + empathy_streamed_media_window_fullscreen_toggle (window); return TRUE; } @@ -3230,25 +3229,25 @@ empathy_call_window_key_press_cb (GtkWidget *video_output, } static gboolean -empathy_call_window_video_output_motion_notify (GtkWidget *widget, - GdkEventMotion *event, EmpathyCallWindow *window) +empathy_streamed_media_window_video_output_motion_notify (GtkWidget *widget, + GdkEventMotion *event, EmpathyStreamedMediaWindow *window) { - EmpathyCallWindowPriv *priv = GET_PRIV (window); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (window); if (priv->is_fullscreen) { - empathy_call_window_fullscreen_show_popup (priv->fullscreen); + empathy_streamed_media_window_fullscreen_show_popup (priv->fullscreen); return TRUE; } return FALSE; } static void -empathy_call_window_video_menu_popup (EmpathyCallWindow *window, +empathy_streamed_media_window_video_menu_popup (EmpathyStreamedMediaWindow *window, guint button) { GtkWidget *menu; - EmpathyCallWindowPriv *priv = GET_PRIV (window); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (window); menu = gtk_ui_manager_get_widget (priv->ui_manager, "/video-popup"); @@ -3258,10 +3257,10 @@ empathy_call_window_video_menu_popup (EmpathyCallWindow *window, } static void -empathy_call_window_status_message (EmpathyCallWindow *window, +empathy_streamed_media_window_status_message (EmpathyStreamedMediaWindow *window, gchar *message) { - EmpathyCallWindowPriv *priv = GET_PRIV (window); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (window); if (priv->context_id == 0) { @@ -3278,10 +3277,10 @@ empathy_call_window_status_message (EmpathyCallWindow *window, } static void -empathy_call_window_volume_changed_cb (GtkScaleButton *button, - gdouble value, EmpathyCallWindow *window) +empathy_streamed_media_window_volume_changed_cb (GtkScaleButton *button, + gdouble value, EmpathyStreamedMediaWindow *window) { - EmpathyCallWindowPriv *priv = GET_PRIV (window); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (window); if (priv->audio_output == NULL) return; @@ -3294,9 +3293,9 @@ empathy_call_window_volume_changed_cb (GtkScaleButton *button, * when we are manually updating the UI and so don't want to fire the * callbacks */ static void -block_camera_control_signals (EmpathyCallWindow *self) +block_camera_control_signals (EmpathyStreamedMediaWindow *self) { - EmpathyCallWindowPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (self); g_signal_handlers_block_by_func (priv->tool_button_camera_off, tool_button_camera_off_toggled_cb, self); @@ -3309,9 +3308,9 @@ block_camera_control_signals (EmpathyCallWindow *self) } static void -unblock_camera_control_signals (EmpathyCallWindow *self) +unblock_camera_control_signals (EmpathyStreamedMediaWindow *self) { - EmpathyCallWindowPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (self); g_signal_handlers_unblock_by_func (priv->tool_button_camera_off, tool_button_camera_off_toggled_cb, self); diff --git a/src/empathy-streamed-media-window.h b/src/empathy-streamed-media-window.h new file mode 100644 index 000000000..aae56d882 --- /dev/null +++ b/src/empathy-streamed-media-window.h @@ -0,0 +1,65 @@ +/* + * empathy-streamed-media-window.h - Header for EmpathyStreamedMediaWindow + * Copyright (C) 2008 Collabora Ltd. + * @author Sjoerd Simons <sjoerd.simons@collabora.co.uk> + * + * 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 __EMPATHY_STREAMED_MEDIA_WINDOW_H__ +#define __EMPATHY_STREAMED_MEDIA_WINDOW_H__ + +#include <glib-object.h> +#include <gtk/gtk.h> + +#include "empathy-streamed-media-handler.h" + +G_BEGIN_DECLS + +typedef struct _EmpathyStreamedMediaWindow EmpathyStreamedMediaWindow; +typedef struct _EmpathyStreamedMediaWindowClass EmpathyStreamedMediaWindowClass; + +struct _EmpathyStreamedMediaWindowClass { + GtkWindowClass parent_class; +}; + +struct _EmpathyStreamedMediaWindow { + GtkWindow parent; +}; + +GType empathy_streamed_media_window_get_type (void); + +/* TYPE MACROS */ +#define EMPATHY_TYPE_STREAMED_MEDIA_WINDOW \ + (empathy_streamed_media_window_get_type ()) +#define EMPATHY_STREAMED_MEDIA_WINDOW(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), EMPATHY_TYPE_STREAMED_MEDIA_WINDOW, \ + EmpathyStreamedMediaWindow)) +#define EMPATHY_STREAMED_MEDIA_WINDOW_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), EMPATHY_TYPE_STREAMED_MEDIA_WINDOW, \ + EmpathyStreamedMediaWindowClass)) +#define EMPATHY_IS_STREAMED_MEDIA_WINDOW(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), EMPATHY_TYPE_STREAMED_MEDIA_WINDOW)) +#define EMPATHY_IS_STREAMED_MEDIA_WINDOW_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass), EMPATHY_TYPE_STREAMED_MEDIA_WINDOW)) +#define EMPATHY_STREAMED_MEDIA_WINDOW_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), EMPATHY_TYPE_STREAMED_MEDIA_WINDOW, \ + EmpathyStreamedMediaWindowClass)) + +EmpathyStreamedMediaWindow *empathy_streamed_media_window_new (EmpathyStreamedMediaHandler *handler); + +G_END_DECLS + +#endif /* #ifndef __EMPATHY_STREAMED_MEDIA_WINDOW_H__*/ |