empathy r866 - in branches/gnome-2-22: . libempathy libempathy-gtk src
- From: xclaesse svn gnome org
- To: svn-commits-list gnome org
- Subject: empathy r866 - in branches/gnome-2-22: . libempathy libempathy-gtk src
- Date: Fri, 4 Apr 2008 12:30:50 +0100 (BST)
Author: xclaesse
Date: Fri Apr 4 12:30:49 2008
New Revision: 866
URL: http://svn.gnome.org/viewvc/empathy?rev=866&view=rev
Log:
Import all changes from git's gnome-2-22 branch
Modified:
branches/gnome-2-22/configure.ac
branches/gnome-2-22/libempathy-gtk/empathy-call-window.c
branches/gnome-2-22/libempathy-gtk/empathy-chat.c
branches/gnome-2-22/libempathy/empathy-tp-call.c
branches/gnome-2-22/libempathy/empathy-tp-chat.c
branches/gnome-2-22/src/Makefile.am
branches/gnome-2-22/src/empathy.c
branches/gnome-2-22/src/org.gnome.Empathy.Chat.service.in
Modified: branches/gnome-2-22/configure.ac
==============================================================================
--- branches/gnome-2-22/configure.ac (original)
+++ branches/gnome-2-22/configure.ac Fri Apr 4 12:30:49 2008
@@ -287,7 +287,7 @@
AC_ARG_ENABLE(voip,
AS_HELP_STRING([--enable-voip=@<:@no/yes@:>@],
[Add support for Voice and Video call]), ,
- enable_voip=no)
+ enable_voip=yes)
if test "x$enable_voip" = "xyes"; then
AC_DEFINE(HAVE_VOIP, 1, [Define if we have voip])
Modified: branches/gnome-2-22/libempathy-gtk/empathy-call-window.c
==============================================================================
--- branches/gnome-2-22/libempathy-gtk/empathy-call-window.c (original)
+++ branches/gnome-2-22/libempathy-gtk/empathy-call-window.c Fri Apr 4 12:30:49 2008
@@ -236,26 +236,22 @@
gboolean is_incoming;
gchar *title;
- g_object_get (G_OBJECT (window->call), "status", &status, NULL);
- g_object_get (G_OBJECT (window->call), "audio-stream", &audio_stream, NULL);
- g_object_get (G_OBJECT (window->call), "video-stream", &video_stream, NULL);
+ g_object_get (window->call,
+ "status", &status,
+ "audio-stream", &audio_stream,
+ "video-stream", &video_stream,
+ NULL);
if (video_stream->state > audio_stream->state)
- {
stream_state = video_stream->state;
- }
else
- {
stream_state = audio_stream->state;
- }
empathy_debug (DEBUG_DOMAIN, "Status changed - status: %d, stream state: %d",
status, stream_state);
if (window->timeout_event_id)
- {
call_window_stop_timeout (window);
- }
if (status == EMPATHY_TP_CALL_STATUS_CLOSED)
{
@@ -266,9 +262,7 @@
call_window_set_output_video_is_drawing (window, FALSE);
}
else if (stream_state == TP_MEDIA_STREAM_STATE_DISCONNECTED)
- {
gtk_label_set_text (GTK_LABEL (window->status_label), "Disconnected");
- }
else if (status == EMPATHY_TP_CALL_STATUS_PENDING)
{
g_object_get (G_OBJECT (window->call), "contact", &contact, NULL);
@@ -283,28 +277,20 @@
g_object_get (G_OBJECT (window->call), "is-incoming", &is_incoming, NULL);
if (is_incoming)
- {
gtk_widget_set_sensitive (window->start_call_button, TRUE);
- }
else
- {
g_signal_connect (GTK_OBJECT (window->video_button), "toggled",
G_CALLBACK (call_window_video_button_toggled_cb),
window);
- }
}
else if (status == EMPATHY_TP_CALL_STATUS_ACCEPTED)
{
if (stream_state == TP_MEDIA_STREAM_STATE_CONNECTING)
- {
gtk_label_set_text (GTK_LABEL (window->status_label), "Connecting");
- }
else if (stream_state == TP_MEDIA_STREAM_STATE_CONNECTED)
{
if ((window->start_time).tv_sec == 0)
- {
g_get_current_time (&(window->start_time));
- }
window->timeout_event_id = g_timeout_add (1000,
call_window_update_timer, window);
empathy_debug (DEBUG_DOMAIN, "Timer started");
Modified: branches/gnome-2-22/libempathy-gtk/empathy-chat.c
==============================================================================
--- branches/gnome-2-22/libempathy-gtk/empathy-chat.c (original)
+++ branches/gnome-2-22/libempathy-gtk/empathy-chat.c Fri Apr 4 12:30:49 2008
@@ -78,7 +78,6 @@
GList *compositors;
guint scroll_idle_id;
gboolean first_tp_chat;
- time_t last_log_timestamp;
gboolean is_first_char;
guint block_events_timeout_id;
/* Used to automatically shrink a window that has temporarily
@@ -512,22 +511,9 @@
{
EmpathyChatPriv *priv;
EmpathyContact *sender;
- time_t timestamp;
priv = GET_PRIV (chat);
- timestamp = empathy_message_get_timestamp (message);
- if (timestamp <= priv->last_log_timestamp) {
- /* Do not take care of messages anterior of the last
- * logged message. Some Jabber chatroom sends messages
- * received before we joined the room, this avoid
- * displaying those messages if we already logged them
- * last time we joined that room. */
- empathy_debug (DEBUG_DOMAIN, "Skipping message because it is "
- "anterior of last logged message.");
- return;
- }
-
sender = empathy_message_get_sender (message);
empathy_debug (DEBUG_DOMAIN, "Appending message ('%s')",
empathy_contact_get_name (sender));
@@ -1282,7 +1268,6 @@
continue;
}
- priv->last_log_timestamp = empathy_message_get_timestamp (message);
empathy_chat_view_append_message (chat->view, message);
g_object_unref (message);
Modified: branches/gnome-2-22/libempathy/empathy-tp-call.c
==============================================================================
--- branches/gnome-2-22/libempathy/empathy-tp-call.c (original)
+++ branches/gnome-2-22/libempathy/empathy-tp-call.c Fri Apr 4 12:30:49 2008
@@ -57,6 +57,7 @@
EmpathyContact *contact;
gboolean is_incoming;
guint status;
+ gboolean stream_engine_started;
EmpathyTpCallStream *audio;
EmpathyTpCallStream *video;
@@ -226,6 +227,18 @@
}
static void
+tp_call_invalidated_cb (TpProxy *stream_engine,
+ GQuark domain,
+ gint code,
+ gchar *message,
+ EmpathyTpCall *call)
+{
+ empathy_debug (DEBUG_DOMAIN, "Stream engine proxy invalidated: %s",
+ message);
+ empathy_tp_call_close_channel (call);
+}
+
+static void
tp_call_channel_closed_cb (TpChan *channel,
EmpathyTpCall *call)
{
@@ -244,13 +257,21 @@
TELEPATHY_CHAN_IFACE_GROUP_QUARK);
dbus_g_proxy_disconnect_signal (DBUS_G_PROXY (priv->channel), "Closed",
- G_CALLBACK (tp_call_channel_closed_cb), (gpointer) call);
+ G_CALLBACK (tp_call_channel_closed_cb), call);
dbus_g_proxy_disconnect_signal (streamed_iface, "StreamStateChanged",
- G_CALLBACK (tp_call_stream_state_changed_cb), (gpointer) call);
+ G_CALLBACK (tp_call_stream_state_changed_cb), call);
dbus_g_proxy_disconnect_signal (streamed_iface, "StreamAdded",
- G_CALLBACK (tp_call_stream_added_cb), (gpointer) call);
+ G_CALLBACK (tp_call_stream_added_cb), call);
dbus_g_proxy_disconnect_signal (streamed_iface, "StreamRemoved",
- G_CALLBACK (tp_call_stream_removed_cb), (gpointer) call);
+ G_CALLBACK (tp_call_stream_removed_cb), call);
+
+ if (priv->stream_engine)
+ {
+ g_signal_handlers_disconnect_by_func (priv->stream_engine,
+ tp_call_invalidated_cb, call);
+ g_object_unref (priv->stream_engine);
+ priv->stream_engine = NULL;
+ }
}
static void
@@ -506,28 +527,26 @@
}
static void
-tp_call_invalidated_cb (TpProxy *stream_engine,
- GQuark domain,
- gint code,
- gchar *message,
- EmpathyTpCall *call)
-{
- empathy_debug (DEBUG_DOMAIN, "Stream engine proxy invalidated: %s",
- message);
- empathy_tp_call_close_channel (call);
-}
-
-static void
tp_call_watch_name_owner_cb (TpDBusDaemon *daemon,
const gchar *name,
const gchar *new_owner,
gpointer call)
{
- if (G_STR_EMPTY (new_owner))
+ EmpathyTpCallPriv *priv = GET_PRIV (call);
+
+ /* G_STR_EMPTY(new_owner) means either stream-engine has not started yet or
+ * has crashed. We want to close the channel if stream-engine has crashed.
+ * */
+ empathy_debug (DEBUG_DOMAIN,
+ "Watch SE: name='%s' SE started='%s' new_owner='%s'",
+ name, priv->stream_engine_started ? "yes" : "no",
+ new_owner ? new_owner : "none");
+ if (priv->stream_engine_started && G_STR_EMPTY (new_owner))
{
empathy_debug (DEBUG_DOMAIN, "Stream engine falled off the bus");
empathy_tp_call_close_channel (call);
}
+ priv->stream_engine_started = !G_STR_EMPTY (new_owner);
}
static void
@@ -587,20 +606,20 @@
priv = GET_PRIV (call);
dbus_g_proxy_connect_signal (DBUS_G_PROXY (priv->channel), "Closed",
- G_CALLBACK (tp_call_channel_closed_cb), (gpointer) call, NULL);
+ G_CALLBACK (tp_call_channel_closed_cb), call, NULL);
streamed_iface = tp_chan_get_interface (priv->channel,
TELEPATHY_CHAN_IFACE_STREAMED_QUARK);
dbus_g_proxy_connect_signal (streamed_iface, "StreamStateChanged",
G_CALLBACK (tp_call_stream_state_changed_cb),
- (gpointer) call, NULL);
+ call, NULL);
dbus_g_proxy_connect_signal (streamed_iface, "StreamDirectionChanged",
G_CALLBACK (tp_call_stream_direction_changed_cb),
- (gpointer) call, NULL);
+ call, NULL);
dbus_g_proxy_connect_signal (streamed_iface, "StreamAdded",
- G_CALLBACK (tp_call_stream_added_cb), (gpointer) call, NULL);
+ G_CALLBACK (tp_call_stream_added_cb), call, NULL);
dbus_g_proxy_connect_signal (streamed_iface, "StreamRemoved",
- G_CALLBACK (tp_call_stream_removed_cb), (gpointer) call, NULL);
+ G_CALLBACK (tp_call_stream_removed_cb), call, NULL);
mc = empathy_mission_control_new ();
account = mission_control_get_account_for_connection (mc, priv->connection,
@@ -609,11 +628,11 @@
g_object_unref (mc);
g_signal_connect (G_OBJECT (priv->group), "member-added",
- G_CALLBACK (tp_call_member_added_cb), (gpointer) call);
+ G_CALLBACK (tp_call_member_added_cb), call);
g_signal_connect (G_OBJECT (priv->group), "local-pending",
- G_CALLBACK (tp_call_local_pending_cb), (gpointer) call);
+ G_CALLBACK (tp_call_local_pending_cb), call);
g_signal_connect (G_OBJECT (priv->group), "remote-pending",
- G_CALLBACK (tp_call_remote_pending_cb), (gpointer) call);
+ G_CALLBACK (tp_call_remote_pending_cb), call);
tp_call_start_stream_engine (call);
/* FIXME: unnecessary for outgoing? */
@@ -800,6 +819,7 @@
priv->status = EMPATHY_TP_CALL_STATUS_READYING;
priv->contact = NULL;
+ priv->stream_engine_started = FALSE;
priv->audio = g_slice_new0 (EmpathyTpCallStream);
priv->video = g_slice_new0 (EmpathyTpCallStream);
priv->audio->exists = FALSE;
@@ -889,7 +909,7 @@
g_clear_error (&error);
}
else
- priv->status = EMPATHY_TP_CALL_STATUS_CLOSED;
+ priv->status = EMPATHY_TP_CALL_STATUS_CLOSED;
}
void
Modified: branches/gnome-2-22/libempathy/empathy-tp-chat.c
==============================================================================
--- branches/gnome-2-22/libempathy/empathy-tp-chat.c (original)
+++ branches/gnome-2-22/libempathy/empathy-tp-chat.c Fri Apr 4 12:30:49 2008
@@ -50,7 +50,6 @@
MissionControl *mc;
gboolean acknowledge;
gboolean had_pending_messages;
- GSList *message_queue;
TpChan *tp_chan;
DBusGProxy *props_iface;
DBusGProxy *text_iface;
@@ -161,84 +160,6 @@
}
static void
-tp_chat_sender_ready_notify_cb (EmpathyContact *contact,
- GParamSpec *param_spec,
- EmpathyTpChat *chat)
-{
- EmpathyTpChatPriv *priv = GET_PRIV (chat);
- EmpathyMessage *message;
- EmpathyContact *sender;
- gboolean removed = FALSE;
- const gchar *name, *id;
-
- /* Emit all messages queued until we find a message with not
- * ready sender. When leaving this loop, sender is the first not ready
- * contact queued and removed tells if at least one message got removed
- * from the queue. */
- while (priv->message_queue) {
- message = priv->message_queue->data;
- sender = empathy_message_get_sender (message);
- name = empathy_contact_get_name (sender);
- id = empathy_contact_get_id (sender);
-
- if (!tp_strdiff (name, id)) {
- break;
- }
-
- empathy_debug (DEBUG_DOMAIN, "Queued message ready");
- g_signal_emit (chat, signals[MESSAGE_RECEIVED], 0, message);
- priv->message_queue = g_slist_remove (priv->message_queue,
- message);
- g_object_unref (message);
- removed = TRUE;
- }
-
- if (removed) {
- g_signal_handlers_disconnect_by_func (contact,
- tp_chat_sender_ready_notify_cb,
- chat);
-
- if (priv->message_queue) {
- g_signal_connect (sender, "notify::name",
- G_CALLBACK (tp_chat_sender_ready_notify_cb),
- chat);
- }
- }
-}
-
-static void
-tp_chat_emit_or_queue_message (EmpathyTpChat *chat,
- EmpathyMessage *message)
-{
- EmpathyTpChatPriv *priv = GET_PRIV (chat);
- EmpathyContact *sender;
- const gchar *name, *id;
-
- if (priv->message_queue != NULL) {
- empathy_debug (DEBUG_DOMAIN, "Message queue not empty");
- priv->message_queue = g_slist_append (priv->message_queue,
- g_object_ref (message));
- return;
- }
-
- sender = empathy_message_get_sender (message);
- name = empathy_contact_get_name (sender);
- id = empathy_contact_get_id (sender);
- if (tp_strdiff (name, id)) {
- empathy_debug (DEBUG_DOMAIN, "Message queue empty and sender ready");
- g_signal_emit (chat, signals[MESSAGE_RECEIVED], 0, message);
- return;
- }
-
- empathy_debug (DEBUG_DOMAIN, "Sender not ready");
- priv->message_queue = g_slist_append (priv->message_queue,
- g_object_ref (message));
- g_signal_connect (sender, "notify::name",
- G_CALLBACK (tp_chat_sender_ready_notify_cb),
- chat);
-}
-
-static void
tp_chat_received_cb (DBusGProxy *text_iface,
guint message_id,
guint timestamp,
@@ -265,7 +186,7 @@
from_handle,
message_body);
- tp_chat_emit_or_queue_message (EMPATHY_TP_CHAT (chat), message);
+ g_signal_emit (chat, signals[MESSAGE_RECEIVED], 0, message);
g_object_unref (message);
if (priv->acknowledge) {
@@ -296,7 +217,7 @@
0,
message_body);
- tp_chat_emit_or_queue_message (EMPATHY_TP_CHAT (chat), message);
+ g_signal_emit (chat, signals[MESSAGE_RECEIVED], 0, message);
g_object_unref (message);
}
@@ -385,7 +306,7 @@
from_handle,
message_body);
- tp_chat_emit_or_queue_message (chat, message);
+ g_signal_emit (chat, signals[MESSAGE_RECEIVED], 0, message);
g_object_unref (message);
g_value_array_free (message_struct);
Modified: branches/gnome-2-22/src/Makefile.am
==============================================================================
--- branches/gnome-2-22/src/Makefile.am (original)
+++ branches/gnome-2-22/src/Makefile.am Fri Apr 4 12:30:49 2008
@@ -19,16 +19,12 @@
empathy-accounts \
empathy-logs
-libexec_PROGRAMS = \
- empathy-chat-chandler
-
empathy_SOURCES = \
empathy.c \
bacon-message-connection.c \
bacon-message-connection.h
empathy_accounts_SOURCES = empathy-accounts.c
empathy_logs_SOURCES = empathy-logs.c
-empathy_chat_chandler_SOURCES = empathy-chat-chandler.c
# Dbus service files
servicedir = $(datadir)/dbus-1/services
@@ -36,7 +32,7 @@
org.gnome.Empathy.Chat.service
%.service: %.service.in Makefile
- @sed -e "s|\ libexecdir\@|$(libexecdir)|" $< > $@
+ @sed -e "s|\ libexecdir\@|$(libexecdir)|" $< | sed -e "s|\ bindir\@|$(bindir)|" > $@
chandlerdir = $(datadir)/telepathy/managers
chandler_DATA = \
@@ -54,7 +50,7 @@
CLEANFILES = $(BUILT_SOURCES)
if HAVE_VOIP
-libexec_PROGRAMS += empathy-call-chandler
+libexec_PROGRAMS = empathy-call-chandler
empathy_call_chandler_SOURCES = empathy-call-chandler.c
service_DATA += org.gnome.Empathy.Call.service
chandler_DATA += empathy-call.chandler
Modified: branches/gnome-2-22/src/empathy.c
==============================================================================
--- branches/gnome-2-22/src/empathy.c (original)
+++ branches/gnome-2-22/src/empathy.c Fri Apr 4 12:30:49 2008
@@ -39,6 +39,9 @@
#include <libmissioncontrol/mission-control.h>
#include <libempathy/empathy-idle.h>
+#include <libempathy/empathy-tp-chat.h>
+#include <libempathy/empathy-tp-chatroom.h>
+#include <libempathy/empathy-chandler.h>
#include <libempathy/empathy-utils.h>
#include <libempathy/empathy-debug.h>
@@ -46,14 +49,78 @@
#include <libempathy-gtk/empathy-preferences.h>
#include <libempathy-gtk/empathy-main-window.h>
#include <libempathy-gtk/empathy-status-icon.h>
+#include <libempathy-gtk/empathy-chat.h>
+#include <libempathy-gtk/empathy-private-chat.h>
+#include <libempathy-gtk/empathy-group-chat.h>
+#include <libempathy-gtk/empathy-chat-window.h>
#include "bacon-message-connection.h"
#define DEBUG_DOMAIN "EmpathyMain"
+#define BUS_NAME "org.gnome.Empathy.ChatChandler"
+#define OBJECT_PATH "/org/gnome/Empathy/ChatChandler"
static BaconMessageConnection *connection = NULL;
static void
+new_text_channel_cb (EmpathyChandler *chandler,
+ TpConn *tp_conn,
+ TpChan *tp_chan,
+ MissionControl *mc)
+{
+ EmpathyTpChat *tp_chat;
+ McAccount *account;
+ EmpathyChat *chat;
+ gchar *id;
+
+ account = mission_control_get_account_for_connection (mc, tp_conn, NULL);
+ id = empathy_inspect_channel (account, tp_chan);
+ chat = empathy_chat_window_find_chat (account, id);
+ g_free (id);
+
+ if (chat) {
+ /* The chat already exists */
+ if (!empathy_chat_is_connected (chat)) {
+ /* The chat died, give him the new text channel */
+ if (empathy_chat_is_group_chat (chat)) {
+ tp_chat = EMPATHY_TP_CHAT (empathy_tp_chatroom_new (account, tp_chan));
+ } else {
+ tp_chat = empathy_tp_chat_new (account, tp_chan);
+ }
+ empathy_chat_set_tp_chat (chat, tp_chat);
+ g_object_unref (tp_chat);
+ }
+ empathy_chat_present (chat);
+
+ g_object_unref (account);
+ return;
+ }
+
+ if (tp_chan->handle_type == TP_HANDLE_TYPE_CONTACT) {
+ /* We have a new private chat channel */
+ tp_chat = empathy_tp_chat_new (account, tp_chan);
+ chat = EMPATHY_CHAT (empathy_private_chat_new (tp_chat));
+ }
+ else if (tp_chan->handle_type == TP_HANDLE_TYPE_ROOM) {
+ /* We have a new group chat channel */
+ tp_chat = EMPATHY_TP_CHAT (empathy_tp_chatroom_new (account, tp_chan));
+ chat = EMPATHY_CHAT (empathy_group_chat_new (EMPATHY_TP_CHATROOM (tp_chat)));
+ } else {
+ empathy_debug (DEBUG_DOMAIN,
+ "Unknown handle type (%d) for Text channel",
+ tp_chan->handle_type);
+ g_object_unref (account);
+ return;
+ }
+
+ empathy_chat_present (chat);
+
+ g_object_unref (chat);
+ g_object_unref (account);
+ g_object_unref (tp_chat);
+}
+
+static void
service_ended_cb (MissionControl *mc,
gpointer user_data)
{
@@ -276,6 +343,7 @@
MissionControl *mc;
McAccountMonitor *monitor;
EmpathyIdle *idle;
+ EmpathyChandler *chandler;
gboolean autoconnect = TRUE;
GError *error = NULL;
@@ -361,10 +429,18 @@
window);
}
+ /* Handle text channels */
+ chandler = empathy_chandler_new (BUS_NAME, OBJECT_PATH);
+ g_signal_connect (chandler, "new-channel",
+ G_CALLBACK (new_text_channel_cb),
+ mc);
+ empathy_debug (DEBUG_DOMAIN, "Ready to handle new text channels");
+
gtk_main ();
empathy_idle_set_state (idle, MC_PRESENCE_OFFLINE);
+ g_object_unref (chandler);
g_object_unref (monitor);
g_object_unref (mc);
g_object_unref (idle);
Modified: branches/gnome-2-22/src/org.gnome.Empathy.Chat.service.in
==============================================================================
--- branches/gnome-2-22/src/org.gnome.Empathy.Chat.service.in (original)
+++ branches/gnome-2-22/src/org.gnome.Empathy.Chat.service.in Fri Apr 4 12:30:49 2008
@@ -1,3 +1,3 @@
[D-BUS Service]
Name=org.gnome.Empathy.ChatChandler
-Exec= libexecdir@/empathy-chat-chandler
+Exec= bindir@/empathy
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]