empathy r861 - trunk/libempathy
- From: xclaesse svn gnome org
- To: svn-commits-list gnome org
- Subject: empathy r861 - trunk/libempathy
- Date: Wed, 2 Apr 2008 14:12:41 +0100 (BST)
Author: xclaesse
Date: Wed Apr 2 14:12:41 2008
New Revision: 861
URL: http://svn.gnome.org/viewvc/empathy?rev=861&view=rev
Log:
Add a 'ready' property telling if the object is ready to use.
Modified:
trunk/libempathy/empathy-tp-chat.c
trunk/libempathy/empathy-tp-chat.h
Modified: trunk/libempathy/empathy-tp-chat.c
==============================================================================
--- trunk/libempathy/empathy-tp-chat.c (original)
+++ trunk/libempathy/empathy-tp-chat.c Wed Apr 2 14:12:41 2008
@@ -55,6 +55,7 @@
GSList *message_queue;
gboolean had_properties_list;
GPtrArray *properties;
+ gboolean ready;
};
typedef struct {
@@ -75,6 +76,7 @@
PROP_CHANNEL,
PROP_ACKNOWLEDGE,
PROP_REMOTE_CONTACT,
+ PROP_READY,
};
enum {
@@ -652,6 +654,8 @@
TpChatProperty *property;
guint i;
+ g_return_if_fail (priv->ready);
+
for (i = 0; i < priv->properties->len; i++) {
property = g_ptr_array_index (priv->properties, i);
if (!tp_strdiff (property->name, name)) {
@@ -699,6 +703,7 @@
empathy_debug (DEBUG_DOMAIN, "Channel ready");
+ priv->ready = TRUE;
if (tp_proxy_has_interface_by_id (priv->channel,
TP_IFACE_QUARK_CHANNEL_INTERFACE_GROUP)) {
priv->group = empathy_tp_group_new (priv->account, priv->tp_chan);
@@ -956,6 +961,13 @@
"The remote contact if there is no group iface on the channel",
EMPATHY_TYPE_CONTACT,
G_PARAM_READABLE));
+ g_object_class_install_property (object_class,
+ PROP_READY,
+ g_param_spec_boolean ("ready",
+ "Is the object ready",
+ "This object is can't be used until this becomes true",
+ FALSE,
+ G_PARAM_READABLE));
/* Signals */
signals[MESSAGE_RECEIVED] =
@@ -1126,14 +1138,13 @@
empathy_tp_chat_send (EmpathyTpChat *chat,
EmpathyMessage *message)
{
- EmpathyTpChatPriv *priv;
+ EmpathyTpChatPriv *priv = GET_PRIV (chat);
const gchar *message_body;
EmpathyMessageType message_type;
g_return_if_fail (EMPATHY_IS_TP_CHAT (chat));
g_return_if_fail (EMPATHY_IS_MESSAGE (message));
-
- priv = GET_PRIV (chat);
+ g_return_if_fail (priv->ready);
message_body = empathy_message_get_body (message);
message_type = empathy_message_get_type (message);
@@ -1151,11 +1162,10 @@
empathy_tp_chat_set_state (EmpathyTpChat *chat,
TpChannelChatState state)
{
- EmpathyTpChatPriv *priv;
+ EmpathyTpChatPriv *priv = GET_PRIV (chat);
g_return_if_fail (EMPATHY_IS_TP_CHAT (chat));
-
- priv = GET_PRIV (chat);
+ g_return_if_fail (priv->ready);
empathy_debug (DEBUG_DOMAIN, "Set state: %d", state);
tp_cli_channel_interface_chat_state_call_set_chat_state (priv->channel, -1,
@@ -1192,3 +1202,13 @@
return priv->remote_contact;
}
+gboolean
+empathy_tp_chat_is_ready (EmpathyTpChat *chat)
+{
+ EmpathyTpChatPriv *priv = GET_PRIV (chat);
+
+ g_return_val_if_fail (EMPATHY_IS_TP_CHAT (chat), FALSE);
+
+ return priv->ready;
+}
+
Modified: trunk/libempathy/empathy-tp-chat.h
==============================================================================
--- trunk/libempathy/empathy-tp-chat.h (original)
+++ trunk/libempathy/empathy-tp-chat.h Wed Apr 2 14:12:41 2008
@@ -63,6 +63,7 @@
TpChan * empathy_tp_chat_get_channel (EmpathyTpChat *chat);
const gchar * empathy_tp_chat_get_id (EmpathyTpChat *chat);
EmpathyContact*empathy_tp_chat_get_remote_contact (EmpathyTpChat *chat);
+gboolean empathy_tp_chat_is_ready (EmpathyTpChat *chat);
void empathy_tp_chat_send (EmpathyTpChat *chat,
EmpathyMessage *message);
void empathy_tp_chat_set_state (EmpathyTpChat *chat,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]