summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnkit Vani <a@nevitus.org>2013-11-17 18:11:04 +0530
committerAnkit Vani <a@nevitus.org>2013-11-17 18:11:04 +0530
commitd056a562a94d8aaeda95ed2ceb24ce45cda38a17 (patch)
tree8b88395ad52f701d324d411a84da425a2aa16f3d
parent55d9f149f2f65965d4f7c6bbe9882839e6338d72 (diff)
downloadpidgin-d056a562a94d8aaeda95ed2ceb24ce45cda38a17.tar.gz
libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
-rw-r--r--libpurple/account.c26
-rw-r--r--libpurple/blistnode.c11
-rw-r--r--libpurple/blistnodetypes.c47
-rw-r--r--libpurple/circularbuffer.c32
-rw-r--r--libpurple/connection.c15
-rw-r--r--libpurple/conversation.c22
-rw-r--r--libpurple/conversationtypes.c45
-rw-r--r--libpurple/presence.c23
-rw-r--r--libpurple/protocols/jabber/jingle/content.c9
-rw-r--r--libpurple/roomlist.c9
-rw-r--r--libpurple/status.c14
-rw-r--r--libpurple/whiteboard.c10
-rw-r--r--libpurple/xfer.c94
13 files changed, 241 insertions, 116 deletions
diff --git a/libpurple/account.c b/libpurple/account.c
index fdcc48aab9..e7fe1f2621 100644
--- a/libpurple/account.c
+++ b/libpurple/account.c
@@ -802,6 +802,7 @@ purple_account_set_private_alias(PurpleAccount *account, const char *alias)
char *old = priv->alias;
priv->alias = g_strdup(alias);
+ g_object_notify(G_OBJECT(account), "private-alias");
purple_signal_emit(purple_accounts_get_handle(), "account-alias-changed",
account, old);
g_free(old);
@@ -856,6 +857,8 @@ purple_account_set_protocol_id(PurpleAccount *account, const char *protocol_id)
g_free(priv->protocol_id);
priv->protocol_id = g_strdup(protocol_id);
+ g_object_notify(G_OBJECT(account), "protocol-id");
+
purple_accounts_schedule_save();
}
@@ -868,6 +871,8 @@ purple_account_set_connection(PurpleAccount *account, PurpleConnection *gc)
priv = PURPLE_ACCOUNT_GET_PRIVATE(account);
priv->gc = gc;
+
+ g_object_notify(G_OBJECT(account), "connection");
}
void
@@ -916,6 +921,8 @@ purple_account_set_enabled(PurpleAccount *account, const char *ui,
else if(!was_enabled && value)
purple_signal_emit(purple_accounts_get_handle(), "account-enabled", account);
+ g_object_notify(G_OBJECT(account), "enabled");
+
if ((gc != NULL) && (_purple_connection_wants_to_die(gc)))
wants_to_die = TRUE;
@@ -3064,55 +3071,56 @@ purple_account_class_init(PurpleAccountClass *klass)
g_object_class_install_property(obj_class, PROP_USERNAME,
g_param_spec_string("username", "Username",
"The username for the account.", NULL,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT)
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, PROP_PRIVATE_ALIAS,
g_param_spec_string("private-alias", "Private Alias",
"The private alias for the account.", NULL,
- G_PARAM_READWRITE)
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, PROP_USER_INFO,
g_param_spec_string("user-info", "User information",
"Detailed user information for the account.", NULL,
- G_PARAM_READWRITE)
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, PROP_BUDDY_ICON_PATH,
g_param_spec_string("buddy-icon-path", "Buddy icon path",
"Path to the buddyicon for the account.", NULL,
- G_PARAM_READWRITE)
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, PROP_ENABLED,
g_param_spec_boolean("enabled", "Enabled",
"Whether the account is enabled or not.", FALSE,
- G_PARAM_READWRITE)
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, PROP_REMEMBER_PASSWORD,
g_param_spec_boolean("remember-password", "Remember password",
"Whether to remember and store the password for this account.", FALSE,
- G_PARAM_READWRITE)
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, PROP_CHECK_MAIL,
g_param_spec_boolean("check-mail", "Check mail",
"Whether to check mails for this account.", FALSE,
- G_PARAM_READWRITE)
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, PROP_CONNECTION,
g_param_spec_object("connection", "Connection",
"The connection for the account.", PURPLE_TYPE_CONNECTION,
- G_PARAM_READWRITE)
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, PROP_PROTOCOL_ID,
g_param_spec_string("protocol-id", "Protocol ID",
"ID of the protocol that is responsible for the account.", NULL,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS)
);
g_type_class_add_private(klass, sizeof(PurpleAccountPrivate));
diff --git a/libpurple/blistnode.c b/libpurple/blistnode.c
index 46632cc0d1..e035493867 100644
--- a/libpurple/blistnode.c
+++ b/libpurple/blistnode.c
@@ -410,7 +410,7 @@ purple_blist_node_class_init(PurpleBlistNodeClass *klass)
g_object_class_install_property(obj_class, BLNODE_PROP_TRANSIENT,
g_param_spec_boolean("transient", "Transient",
"Whether node should not be saved with the buddy list.",
- FALSE, G_PARAM_READWRITE)
+ FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)
);
g_type_class_add_private(klass, sizeof(PurpleBlistNodePrivate));
@@ -605,19 +605,22 @@ purple_counting_node_class_init(PurpleCountingNodeClass *klass)
g_object_class_install_property(obj_class, CNODE_PROP_TOTAL_SIZE,
g_param_spec_int("total-size", "Total size",
"The number of children under this node.",
- G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)
+ G_MININT, G_MAXINT, 0, G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, CNODE_PROP_CURRENT_SIZE,
g_param_spec_int("current-size", "Current size",
"The number of children with online accounts.",
- G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)
+ G_MININT, G_MAXINT, 0, G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, CNODE_PROP_ONLINE_COUNT,
g_param_spec_int("online-count", "Online count",
"The number of children that are online.",
- G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)
+ G_MININT, G_MAXINT, 0, G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS)
);
g_type_class_add_private(klass, sizeof(PurpleCountingNodePrivate));
diff --git a/libpurple/blistnodetypes.c b/libpurple/blistnodetypes.c
index 9091f98158..3b19e59658 100644
--- a/libpurple/blistnodetypes.c
+++ b/libpurple/blistnodetypes.c
@@ -154,6 +154,8 @@ purple_buddy_set_icon(PurpleBuddy *buddy, PurpleBuddyIcon *icon)
{
purple_buddy_icon_unref(priv->icon);
priv->icon = (icon != NULL ? purple_buddy_icon_ref(icon) : NULL);
+
+ g_object_notify(G_OBJECT(buddy), "icon");
}
purple_signal_emit(purple_blist_get_handle(), "buddy-icon-changed", buddy);
@@ -195,14 +197,14 @@ purple_buddy_set_name(PurpleBuddy *buddy, const char *name)
g_free(priv->name);
priv->name = purple_utf8_strip_unprintables(name);
+ g_object_notify(G_OBJECT(buddy), "name");
+
if (ops) {
if (ops->save_node)
ops->save_node(PURPLE_BLIST_NODE(buddy));
if (ops->update)
ops->update(purple_blist_get_buddy_list(), PURPLE_BLIST_NODE(buddy));
}
-
- g_object_notify(G_OBJECT(buddy), "name");
}
const char *
@@ -324,6 +326,8 @@ purple_buddy_set_local_alias(PurpleBuddy *buddy, const char *alias)
g_free(new_alias); /* could be "\0" */
}
+ g_object_notify(G_OBJECT(buddy), "local-alias");
+
if (ops && ops->save_node)
ops->save_node(PURPLE_BLIST_NODE(buddy));
@@ -377,6 +381,8 @@ purple_buddy_set_server_alias(PurpleBuddy *buddy, const char *alias)
g_free(new_alias); /* could be "\0"; */
}
+ g_object_notify(G_OBJECT(buddy), "server-alias");
+
if (ops) {
if (ops->save_node)
ops->save_node(PURPLE_BLIST_NODE(buddy));
@@ -682,44 +688,45 @@ static void purple_buddy_class_init(PurpleBuddyClass *klass)
g_object_class_install_property(obj_class, BUDDY_PROP_NAME,
g_param_spec_string("name", "Name",
"The name of the buddy.", NULL,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT)
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, BUDDY_PROP_LOCAL_ALIAS,
g_param_spec_string("local-alias", "Local alias",
"Local alias of thee buddy.", NULL,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT)
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, BUDDY_PROP_SERVER_ALIAS,
g_param_spec_string("server-alias", "Server alias",
"Server-side alias of the buddy.", NULL,
- G_PARAM_READWRITE)
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, BUDDY_PROP_ICON,
g_param_spec_pointer("icon", "Buddy icon",
"The icon for the buddy.",
- G_PARAM_READWRITE)
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, BUDDY_PROP_ACCOUNT,
g_param_spec_object("account", "Account",
"The account for the buddy.", PURPLE_TYPE_ACCOUNT,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, BUDDY_PROP_PRESENCE,
g_param_spec_object("presence", "Presence",
"The status information for the buddy.", PURPLE_TYPE_PRESENCE,
- G_PARAM_READABLE)
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, BUDDY_PROP_MEDIA_CAPS,
g_param_spec_enum("media-caps", "Media capabilities",
"The media capabilities of the buddy.",
PURPLE_MEDIA_TYPE_CAPS, PURPLE_MEDIA_CAPS_NONE,
- G_PARAM_READWRITE)
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)
);
g_type_class_add_private(klass, sizeof(PurpleBuddyPrivate));
@@ -813,6 +820,8 @@ purple_contact_compute_priority_buddy(PurpleContact *contact)
priv->priority_buddy = new_priority;
priv->priority_valid = TRUE;
+
+ g_object_notify(G_OBJECT(contact), "priority-buddy");
}
PurpleGroup *
@@ -852,6 +861,8 @@ purple_contact_set_alias(PurpleContact *contact, const char *alias)
g_free(new_alias); /* could be "\0" */
}
+ g_object_notify(G_OBJECT(contact), "alias");
+
if (ops) {
if (ops->save_node)
ops->save_node(PURPLE_BLIST_NODE(contact));
@@ -1043,13 +1054,13 @@ static void purple_contact_class_init(PurpleContactClass *klass)
g_object_class_install_property(obj_class, CONTACT_PROP_ALIAS,
g_param_spec_string("alias", "Alias",
"The alias for the contact.", NULL,
- G_PARAM_READWRITE)
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, CONTACT_PROP_PRIORITY_BUDDY,
g_param_spec_object("priority-buddy",
"Priority buddy", "The priority buddy of the contact.",
- PURPLE_TYPE_BUDDY, G_PARAM_READABLE)
+ PURPLE_TYPE_BUDDY, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)
);
g_type_class_add_private(klass, sizeof(PurpleContactPrivate));
@@ -1155,6 +1166,8 @@ purple_chat_set_alias(PurpleChat *chat, const char *alias)
g_free(new_alias); /* could be "\0" */
}
+ g_object_notify(G_OBJECT(chat), "alias");
+
if (ops) {
if (ops->save_node)
ops->save_node(PURPLE_BLIST_NODE(chat));
@@ -1299,19 +1312,21 @@ static void purple_chat_class_init(PurpleChatClass *klass)
g_object_class_install_property(obj_class, CHAT_PROP_ALIAS,
g_param_spec_string("alias", "Alias",
"The alias for the chat.", NULL,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT)
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, CHAT_PROP_ACCOUNT,
g_param_spec_object("account", "Account",
"The account that the chat belongs to.", PURPLE_TYPE_ACCOUNT,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, CHAT_PROP_COMPONENTS,
g_param_spec_pointer("components", "Components",
"The protocol components of the chat.",
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS)
);
g_type_class_add_private(klass, sizeof(PurpleChatPrivate));
@@ -1482,6 +1497,8 @@ void purple_group_set_name(PurpleGroup *source, const char *name)
old_name = priv->name;
priv->name = new_name;
+
+ g_object_notify(G_OBJECT(source), "name");
}
/* Save our changes */
@@ -1641,7 +1658,7 @@ static void purple_group_class_init(PurpleGroupClass *klass)
g_object_class_install_property(obj_class, GROUP_PROP_NAME,
g_param_spec_string("name", "Name",
"Name of the group.", NULL,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT)
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS)
);
g_type_class_add_private(klass, sizeof(PurpleGroupPrivate));
diff --git a/libpurple/circularbuffer.c b/libpurple/circularbuffer.c
index e38bea23dc..c539b189d2 100644
--- a/libpurple/circularbuffer.c
+++ b/libpurple/circularbuffer.c
@@ -81,6 +81,7 @@ purple_circular_buffer_real_grow(PurpleCircularBuffer *buffer, gsize len) {
PurpleCircularBufferPrivate *priv = NULL;
gsize in_offset = 0, out_offset = 0;
gsize start_buflen;
+ GObject *obj;
priv = PURPLE_CIRCULAR_BUFFER_GET_PRIVATE(buffer);
@@ -120,6 +121,12 @@ purple_circular_buffer_real_grow(PurpleCircularBuffer *buffer, gsize len) {
priv->input = priv->buffer + start_buflen + in_offset;
}
}
+
+ obj = G_OBJECT(buffer);
+ g_object_freeze_notify(obj);
+ g_object_notify(obj, "input");
+ g_object_notify(obj, "output");
+ g_object_thaw_notify(obj);
}
static void
@@ -128,6 +135,7 @@ purple_circular_buffer_real_append(PurpleCircularBuffer *buffer,
{
PurpleCircularBufferPrivate *priv = NULL;
gsize len_stored;
+ GObject *obj;
priv = PURPLE_CIRCULAR_BUFFER_GET_PRIVATE(buffer);
@@ -155,6 +163,12 @@ purple_circular_buffer_real_append(PurpleCircularBuffer *buffer,
}
priv->bufused += len;
+
+ obj = G_OBJECT(buffer);
+ g_object_freeze_notify(obj);
+ g_object_notify(obj, "buffer-used");
+ g_object_notify(obj, "input");
+ g_object_thaw_notify(obj);
}
static gsize
@@ -179,6 +193,7 @@ purple_circular_buffer_real_mark_read(PurpleCircularBuffer *buffer,
gsize len)
{
PurpleCircularBufferPrivate *priv = NULL;
+ GObject *obj;
g_return_val_if_fail(purple_circular_buffer_get_max_read(buffer) >= len, FALSE);
@@ -191,6 +206,12 @@ purple_circular_buffer_real_mark_read(PurpleCircularBuffer *buffer,
if((gsize)(priv->output - priv->buffer) == priv->buflen)
priv->output = priv->buffer;
+ obj = G_OBJECT(buffer);
+ g_object_freeze_notify(obj);
+ g_object_notify(obj, "buffer-used");
+ g_object_notify(obj, "output");
+ g_object_thaw_notify(obj);
+
return TRUE;
}
@@ -293,23 +314,24 @@ purple_circular_buffer_class_init(PurpleCircularBufferClass *klass) {
g_param_spec_ulong("grow-size", "grow-size",
"The grow size of the buffer",
0, G_MAXSIZE, 0,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_STRINGS));
g_object_class_install_property(obj_class, PROP_BUFFER_USED,
g_param_spec_ulong("buffer-used", "buffer-used",
"The amount of the buffer used",
0, G_MAXSIZE, 0,
- G_PARAM_READABLE));
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property(obj_class, PROP_INPUT,
g_param_spec_pointer("input", "input",
"The input pointer of the buffer",
- G_PARAM_READABLE));
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property(obj_class, PROP_OUTPUT,
g_param_spec_pointer("output", "output",
"The output pointer of the buffer",
- G_PARAM_READABLE));
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
}
/******************************************************************************
@@ -440,7 +462,7 @@ purple_circular_buffer_get_output(const PurpleCircularBuffer *buffer) {
void
purple_circular_buffer_reset(PurpleCircularBuffer *buffer) {
PurpleCircularBufferPrivate *priv = NULL;
- GObject *obj = NULL;
+ GObject *obj;
g_return_if_fail(PURPLE_IS_CIRCULAR_BUFFER(buffer));
diff --git a/libpurple/connection.c b/libpurple/connection.c
index 0af85807c6..bf0f459bcf 100644
--- a/libpurple/connection.c
+++ b/libpurple/connection.c
@@ -815,39 +815,42 @@ static void purple_connection_class_init(PurpleConnectionClass *klass)
g_object_class_install_property(obj_class, PROP_PRPL,
g_param_spec_pointer("prpl", "Protocol plugin",
"The prpl that is using the connection.",
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, PROP_FLAGS,
g_param_spec_flags("flags", "Connection flags",
"The flags of the connection.",
PURPLE_TYPE_CONNECTION_FLAGS, 0,
- G_PARAM_READWRITE)
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, PROP_STATE,
g_param_spec_enum("state", "Connection state",
"The current state of the connection.",
PURPLE_TYPE_CONNECTION_STATE, PURPLE_CONNECTION_DISCONNECTED,
- G_PARAM_READWRITE)
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, PROP_ACCOUNT,
g_param_spec_object("account", "Account",
"The account using the connection.", PURPLE_TYPE_ACCOUNT,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, PROP_PASSWORD,
g_param_spec_string("password", "Password",
"The password used for connection.", NULL,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, PROP_DISPLAY_NAME,
g_param_spec_string("display-name", "Display name",
"Your name that appears to other people.", NULL,
- G_PARAM_READWRITE)
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)
);
g_type_class_add_private(klass, sizeof(PurpleConnectionPrivate));
diff --git a/libpurple/conversation.c b/libpurple/conversation.c
index c868f171b8..bb51e3b9f6 100644
--- a/libpurple/conversation.c
+++ b/libpurple/conversation.c
@@ -282,6 +282,9 @@ purple_conversation_set_features(PurpleConversation *conv, PurpleConnectionFlags
g_return_if_fail(priv != NULL);
priv->features = features;
+
+ g_object_notify(G_OBJECT(conv), "features");
+
purple_conversation_update(conv, PURPLE_CONVERSATION_UPDATE_FEATURES);
}
@@ -335,6 +338,8 @@ purple_conversation_set_account(PurpleConversation *conv, PurpleAccount *account
purple_conversations_update_cache(conv, NULL, account);
priv->account = account;
+ g_object_notify(G_OBJECT(conv), "account");
+
purple_conversation_update(conv, PURPLE_CONVERSATION_UPDATE_ACCOUNT);
}
@@ -374,6 +379,8 @@ purple_conversation_set_title(PurpleConversation *conv, const char *title)
g_free(priv->title);
priv->title = g_strdup(title);
+ g_object_notify(G_OBJECT(conv), "title");
+
purple_conversation_update(conv, PURPLE_CONVERSATION_UPDATE_TITLE);
}
@@ -426,8 +433,9 @@ purple_conversation_set_name(PurpleConversation *conv, const char *name)
g_free(priv->name);
priv->name = g_strdup(name);
- purple_conversation_autoset_title(conv);
+ g_object_notify(G_OBJECT(conv), "name");
+ purple_conversation_autoset_title(conv);
purple_conversation_update(conv, PURPLE_CONVERSATION_UPDATE_NAME);
}
@@ -503,6 +511,8 @@ purple_conversation_set_logging(PurpleConversation *conv, gboolean log)
if (log && priv->logs == NULL)
open_log(conv);
+ g_object_notify(G_OBJECT(conv), "logging");
+
purple_conversation_update(conv, PURPLE_CONVERSATION_UPDATE_LOGGING);
}
}
@@ -1118,32 +1128,32 @@ purple_conversation_class_init(PurpleConversationClass *klass)
g_object_class_install_property(obj_class, PROP_ACCOUNT,
g_param_spec_object("account", "Account",
"The account for the conversation.", PURPLE_TYPE_ACCOUNT,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT)
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, PROP_NAME,
g_param_spec_string("name", "Name",
"The name of the conversation.", NULL,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT)
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, PROP_TITLE,
g_param_spec_string("title", "Title",
"The title of the conversation.", NULL,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT)
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, PROP_LOGGING,
g_param_spec_boolean("logging", "Logging status",
"Whether logging is enabled or not.", FALSE,
- G_PARAM_READWRITE)
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, PROP_FEATURES,
g_param_spec_flags("features", "Connection features",
"The connection features of the conversation.",
PURPLE_TYPE_CONNECTION_FLAGS, 0,
- G_PARAM_READWRITE)
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)
);
g_type_class_add_private(klass, sizeof(PurpleConversationPrivate));
diff --git a/libpurple/conversationtypes.c b/libpurple/conversationtypes.c
index a89a81ac37..c17195718f 100644
--- a/libpurple/conversationtypes.c
+++ b/libpurple/conversationtypes.c
@@ -181,6 +181,8 @@ purple_im_conversation_set_icon(PurpleIMConversation *im, PurpleBuddyIcon *icon)
purple_buddy_icon_unref(priv->icon);
priv->icon = (icon == NULL ? NULL : purple_buddy_icon_ref(icon));
+
+ g_object_notify(G_OBJECT(im), "icon");
}
purple_conversation_update(PURPLE_CONVERSATION(im),
@@ -213,6 +215,8 @@ purple_im_conversation_set_typing_state(PurpleIMConversation *im, PurpleIMTyping
{
priv->typing_state = state;
+ g_object_notify(G_OBJECT(im), "typing-state");
+
switch (state)
{
case PURPLE_IM_TYPING:
@@ -515,13 +519,15 @@ static void purple_im_conversation_class_init(PurpleIMConversationClass *klass)
g_param_spec_enum("typing-state", "Typing state",
"Status of the user's typing of a message.",
PURPLE_TYPE_IM_TYPING_STATE, PURPLE_IM_NOT_TYPING,
- G_PARAM_READWRITE)
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
+ G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, IM_PROP_ICON,
g_param_spec_pointer("icon", "Buddy icon",
"The buddy icon for the IM.",
- G_PARAM_READWRITE)
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
+ G_PARAM_STATIC_STRINGS)
);
g_type_class_add_private(klass, sizeof(PurpleIMConversationPrivate));
@@ -714,6 +720,7 @@ void
purple_chat_conversation_set_topic(PurpleChatConversation *chat, const char *who, const char *topic)
{
PurpleChatConversationPrivate *priv = PURPLE_CHAT_CONVERSATION_GET_PRIVATE(chat);
+ GObject *obj;
g_return_if_fail(priv != NULL);
@@ -723,6 +730,12 @@ purple_chat_conversation_set_topic(PurpleChatConversation *chat, const char *who
priv->who = g_strdup(who);
priv->topic = g_strdup(topic);
+ obj = G_OBJECT(chat);
+ g_object_freeze_notify(obj);
+ g_object_notify(obj, "topic-who");
+ g_object_notify(obj, "topic");
+ g_object_thaw_notify(obj);
+
purple_conversation_update(PURPLE_CONVERSATION(chat),
PURPLE_CONVERSATION_UPDATE_TOPIC);
@@ -1280,6 +1293,9 @@ purple_chat_conversation_leave(PurpleChatConversation *chat)
g_return_if_fail(priv != NULL);
priv->left = TRUE;
+
+ g_object_notify(G_OBJECT(chat), "left");
+
purple_conversation_update(PURPLE_CONVERSATION(chat), PURPLE_CONVERSATION_UPDATE_CHATLEFT);
}
@@ -1321,6 +1337,8 @@ chat_conversation_cleanup_for_rejoin(PurpleChatConversation *chat)
purple_chat_conversation_set_topic(chat, NULL, NULL);
priv->left = FALSE;
+ g_object_notify(G_OBJECT(chat), "left");
+
purple_conversation_update(conv, PURPLE_CONVERSATION_UPDATE_CHATLEFT);
}
@@ -1542,31 +1560,31 @@ static void purple_chat_conversation_class_init(PurpleChatConversationClass *kla
g_object_class_install_property(obj_class, CHAT_PROP_TOPIC_WHO,
g_param_spec_string("topic-who", "Who set topic",
"Who set the chat topic.", NULL,
- G_PARAM_READABLE)
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, CHAT_PROP_TOPIC,
g_param_spec_string("topic", "Topic",
"Topic of the chat.", NULL,
- G_PARAM_READABLE)
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, CHAT_PROP_ID,
g_param_spec_int("chat-id", "Chat ID",
"The ID of the chat.", G_MININT, G_MAXINT, 0,
- G_PARAM_READWRITE)
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, CHAT_PROP_NICK,
g_param_spec_string("nick", "Nickname",
"The nickname of the user in a chat.", NULL,
- G_PARAM_READWRITE)
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, CHAT_PROP_LEFT,
g_param_spec_boolean("left", "Left the chat",
"Whether the user has left the chat.", FALSE,
- G_PARAM_READWRITE)
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)
);
g_type_class_add_private(klass, sizeof(PurpleChatConversationPrivate));
@@ -1726,6 +1744,8 @@ purple_chat_user_set_flags(PurpleChatUser *cb,
oldflags = priv->flags;
priv->flags = flags;
+ g_object_notify(G_OBJECT(cb), "flags");
+
ops = purple_conversation_get_ui_ops(PURPLE_CONVERSATION(priv->chat));
if (ops != NULL && ops->chat_update_user != NULL)
@@ -1772,6 +1792,8 @@ purple_chat_user_set_chat(PurpleChatUser *cb,
g_return_if_fail(priv != NULL);
priv->chat = chat;
+
+ g_object_notify(G_OBJECT(cb), "chat");
}
PurpleChatConversation *
@@ -1913,26 +1935,27 @@ static void purple_chat_user_class_init(PurpleChatUserClass *klass)
g_object_class_install_property(obj_class, CU_PROP_CHAT,
g_param_spec_object("chat", "Chat",
"The chat the buddy belongs to.", PURPLE_TYPE_CHAT_CONVERSATION,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, CU_PROP_NAME,
g_param_spec_string("name", "Name",
"Name of the chat user.", NULL,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT)
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, CU_PROP_ALIAS,
g_param_spec_string("alias", "Alias",
"Alias of the chat user.", NULL,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT)
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, CU_PROP_FLAGS,
g_param_spec_flags("flags", "Buddy flags",
"The flags for the chat user.",
PURPLE_TYPE_CHAT_USER_FLAGS, PURPLE_CHAT_USER_NONE,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT)
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS)
);
g_type_class_add_private(klass, sizeof(PurpleChatUserPrivate));
diff --git a/libpurple/presence.c b/libpurple/presence.c
index 8d69c171fa..0080126c3e 100644
--- a/libpurple/presence.c
+++ b/libpurple/presence.c
@@ -146,6 +146,7 @@ purple_presence_set_idle(PurplePresence *presence, gboolean idle, time_t idle_ti
gboolean old_idle;
PurplePresencePrivate *priv = PURPLE_PRESENCE_GET_PRIVATE(presence);
PurplePresenceClass *klass = PURPLE_PRESENCE_GET_CLASS(presence);
+ GObject *obj;
g_return_if_fail(priv != NULL);
@@ -156,6 +157,12 @@ purple_presence_set_idle(PurplePresence *presence, gboolean idle, time_t idle_ti
priv->idle = idle;
priv->idle_time = (idle ? idle_time : 0);
+ obj = G_OBJECT(presence);
+ g_object_freeze_notify(obj);
+ g_object_notify(obj, "idle");
+ g_object_notify(obj, "idle-time");
+ g_object_thaw_notify(obj);
+
if (klass->update_idle)
klass->update_idle(presence, old_idle);
}
@@ -459,7 +466,7 @@ static void purple_presence_class_init(PurplePresenceClass *klass)
g_object_class_install_property(obj_class, PRES_PROP_IDLE,
g_param_spec_boolean("idle", "Idle",
"Whether the presence is in idle state.", FALSE,
- G_PARAM_READWRITE)
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)
);
@@ -480,7 +487,7 @@ static void purple_presence_class_init(PurplePresenceClass *klass)
#else
#error Unknown size of time_t
#endif
- G_PARAM_READWRITE)
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, PRES_PROP_LOGIN_TIME,
@@ -500,19 +507,19 @@ static void purple_presence_class_init(PurplePresenceClass *klass)
#else
#error Unknown size of time_t
#endif
- G_PARAM_READWRITE)
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, PRES_PROP_STATUSES,
g_param_spec_pointer("statuses", "Statuses",
"The list of statuses in the presence.",
- G_PARAM_READABLE)
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, PRES_PROP_ACTIVE_STATUS,
g_param_spec_object("active-status", "Active status",
"The active status for the presence.", PURPLE_TYPE_STATUS,
- G_PARAM_READWRITE)
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)
);
g_type_class_add_private(klass, sizeof(PurplePresencePrivate));
@@ -751,7 +758,8 @@ static void purple_account_presence_class_init(PurpleAccountPresenceClass *klass
g_object_class_install_property(obj_class, ACPRES_PROP_ACCOUNT,
g_param_spec_object("account", "Account",
"The account that this presence is of.", PURPLE_TYPE_ACCOUNT,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS)
);
g_type_class_add_private(klass, sizeof(PurpleAccountPresencePrivate));
@@ -945,7 +953,8 @@ static void purple_buddy_presence_class_init(PurpleBuddyPresenceClass *klass)
g_object_class_install_property(obj_class, BUDPRES_PROP_BUDDY,
g_param_spec_object("buddy", "Buddy",
"The buddy that this presence is of.", PURPLE_TYPE_BUDDY,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS)
);
g_type_class_add_private(klass, sizeof(PurpleBuddyPresencePrivate));
diff --git a/libpurple/protocols/jabber/jingle/content.c b/libpurple/protocols/jabber/jingle/content.c
index 97559b5492..f5ad0142e3 100644
--- a/libpurple/protocols/jabber/jingle/content.c
+++ b/libpurple/protocols/jabber/jingle/content.c
@@ -356,14 +356,19 @@ jingle_content_set_pending_transport(JingleContent *content, JingleTransport *tr
void
jingle_content_accept_transport(JingleContent *content)
{
+ GObject *obj;
+
if (content->priv->transport)
g_object_unref(content->priv->transport);
content->priv->transport = content->priv->pending_transport;
content->priv->pending_transport = NULL;
- g_object_notify(G_OBJECT(content), "transport");
- g_object_notify(G_OBJECT(content), "pending-transport");
+ obj = G_OBJECT(content);
+ g_object_freeze_notify(obj);
+ g_object_notify(obj, "transport");
+ g_object_notify(obj, "pending-transport");
+ g_object_thaw_notify(obj);
}
void
diff --git a/libpurple/roomlist.c b/libpurple/roomlist.c
index 503e6287e9..09c1364c11 100644
--- a/libpurple/roomlist.c
+++ b/libpurple/roomlist.c
@@ -374,19 +374,20 @@ purple_roomlist_class_init(PurpleRoomlistClass *klass)
g_param_spec_object("account", "Account",
"The account for the room list.",
PURPLE_TYPE_ACCOUNT,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, PROP_FIELDS,
g_param_spec_pointer("fields", "Fields",
"The list of fields for a roomlist.",
- G_PARAM_READWRITE)
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, PROP_IN_PROGRESS,
g_param_spec_boolean("in-progress", "In progress",
"Whether the room list is being fetched.", FALSE,
- G_PARAM_READWRITE)
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)
);
g_type_class_add_private(klass, sizeof(PurpleRoomlistPrivate));
@@ -480,6 +481,8 @@ void purple_roomlist_room_add_field(PurpleRoomlist *list, PurpleRoomlistRoom *ro
room->fields = g_list_append(room->fields, GINT_TO_POINTER(field));
break;
}
+
+ g_object_notify(G_OBJECT(list), "fields");
}
void purple_roomlist_room_join(PurpleRoomlist *list, PurpleRoomlistRoom *room)
diff --git a/libpurple/status.c b/libpurple/status.c
index 0c6bc89c87..2854681829 100644
--- a/libpurple/status.c
+++ b/libpurple/status.c
@@ -594,13 +594,13 @@ status_has_changed(PurpleStatus *status)
PURPLE_STATUS_GET_PRIVATE(old_status)->active = FALSE;
g_object_notify(G_OBJECT(old_status), "active");
}
-
- g_object_set(presence, "active-status", status, NULL);
- g_object_notify(G_OBJECT(status), "active");
}
else
old_status = NULL;
+ g_object_set(presence, "active-status", status, NULL);
+ g_object_notify(G_OBJECT(status), "active");
+
notify_status_update(presence, old_status, status);
}
@@ -1229,19 +1229,21 @@ purple_status_class_init(PurpleStatusClass *klass)
g_object_class_install_property(obj_class, PROP_STATUS_TYPE,
g_param_spec_pointer("status-type", "Status type",
"The PurpleStatusType of the status.",
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, PROP_PRESENCE,
g_param_spec_object("presence", "Presence",
"The presence that the status belongs to.", PURPLE_TYPE_PRESENCE,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, PROP_ACTIVE,
g_param_spec_boolean("active", "Active",
"Whether the status is active or not.", FALSE,
- G_PARAM_READWRITE)
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)
);
g_type_class_add_private(klass, sizeof(PurpleStatusPrivate));
diff --git a/libpurple/whiteboard.c b/libpurple/whiteboard.c
index 2fd99fec2c..dd68523fb7 100644
--- a/libpurple/whiteboard.c
+++ b/libpurple/whiteboard.c
@@ -442,25 +442,27 @@ purple_whiteboard_class_init(PurpleWhiteboardClass *klass)
g_param_spec_int("state", "State",
"State of the whiteboard.",
G_MININT, G_MAXINT, 0,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT)
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, PROP_ACCOUNT,
g_param_spec_object("account", "Account",
"The whiteboard's account.", PURPLE_TYPE_ACCOUNT,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, PROP_WHO,
g_param_spec_string("who", "Who",
"Who you're drawing with.", NULL,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, PROP_DRAW_LIST,
g_param_spec_pointer("draw-list", "Draw list",
"A list of points to draw to the buddy.",
- G_PARAM_READWRITE)
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)
);
g_type_class_add_private(klass, sizeof(PurpleWhiteboardPrivate));
diff --git a/libpurple/xfer.c b/libpurple/xfer.c
index be97393408..b849ce533d 100644
--- a/libpurple/xfer.c
+++ b/libpurple/xfer.c
@@ -189,6 +189,8 @@ purple_xfer_set_status(PurpleXfer *xfer, PurpleXferStatus status)
priv->status = status;
+ g_object_notify(G_OBJECT(xfer), "status");
+
if(priv->type == PURPLE_XFER_TYPE_SEND) {
switch(status) {
case PURPLE_XFER_STATUS_ACCEPTED:
@@ -606,7 +608,7 @@ purple_xfer_request_accepted(PurpleXfer *xfer, const char *filename)
purple_debug_misc("xfer", "request accepted for %p\n", xfer);
if (!filename && type == PURPLE_XFER_TYPE_RECEIVE) {
- priv->status = PURPLE_XFER_STATUS_ACCEPTED;
+ purple_xfer_set_status(xfer, PURPLE_XFER_STATUS_ACCEPTED);
priv->ops.init(xfer);
return;
}
@@ -662,7 +664,7 @@ purple_xfer_request_accepted(PurpleXfer *xfer, const char *filename)
}
else {
/* Receiving a file */
- priv->status = PURPLE_XFER_STATUS_ACCEPTED;
+ purple_xfer_set_status(xfer, PURPLE_XFER_STATUS_ACCEPTED);
purple_xfer_set_local_filename(xfer, filename);
msg = g_strdup_printf(_("Starting transfer of %s from %s"),
@@ -1046,7 +1048,9 @@ purple_xfer_set_bytes_sent(PurpleXfer *xfer, goffset bytes_sent)
g_return_if_fail(priv != NULL);
priv->bytes_sent = bytes_sent;
- priv->bytes_remaining = purple_xfer_get_size(xfer) - bytes_sent;
+
+ if (purple_xfer_get_size(xfer) > 0)
+ priv->bytes_remaining = purple_xfer_get_size(xfer) - bytes_sent;
g_object_notify(G_OBJECT(xfer), "bytes-sent");
}
@@ -1364,7 +1368,7 @@ do_transfer(PurpleXfer *xfer)
if (s == 0) {
if (priv->watcher) {
purple_input_remove(priv->watcher);
- priv->watcher = 0;
+ purple_xfer_set_watcher(xfer, 0);
}
return;
}
@@ -1389,7 +1393,7 @@ do_transfer(PurpleXfer *xfer)
*/
if (priv->watcher != 0) {
purple_input_remove(priv->watcher);
- priv->watcher = 0;
+ purple_xfer_set_watcher(xfer, 0);
}
/* Need to indicate the prpl is still ready... */
@@ -1441,10 +1445,7 @@ do_transfer(PurpleXfer *xfer)
}
if (r > 0) {
- if (purple_xfer_get_size(xfer) > 0)
- priv->bytes_remaining -= r;
-
- priv->bytes_sent += r;
+ purple_xfer_set_bytes_sent(xfer, priv->bytes_sent + r);
if (priv->ops.ack != NULL)
priv->ops.ack(xfer, buffer, r);
@@ -1472,7 +1473,7 @@ transfer_cb(gpointer data, gint source, PurpleInputCondition condition)
priv->ready |= PURPLE_XFER_READY_PRPL;
purple_input_remove(priv->watcher);
- priv->watcher = 0;
+ purple_xfer_set_watcher(xfer, 0);
purple_debug_misc("xfer", "prpl is ready on ft %p, waiting for UI\n", xfer);
return;
@@ -1510,10 +1511,13 @@ begin_transfer(PurpleXfer *xfer, PurpleInputCondition cond)
}
if (priv->fd != -1)
- priv->watcher = purple_input_add(priv->fd, cond, transfer_cb, xfer);
+ purple_xfer_set_watcher(xfer,
+ purple_input_add(priv->fd, cond, transfer_cb, xfer));
priv->start_time = time(NULL);
+ g_object_notify(G_OBJECT(xfer), "start-time");
+
if (priv->ops.start != NULL)
priv->ops.start(xfer);
}
@@ -1521,16 +1525,14 @@ begin_transfer(PurpleXfer *xfer, PurpleInputCondition cond)
static void
connect_cb(gpointer data, gint source, const gchar *error_message)
{
- PurpleXfer *xfer = (PurpleXfer *)data;
- PurpleXferPrivate *priv = PURPLE_XFER_GET_PRIVATE(xfer);
+ PurpleXfer *xfer = PURPLE_XFER(data);
if (source < 0) {
purple_xfer_cancel_local(xfer);
return;
}
- priv->fd = source;
-
+ purple_xfer_set_fd(xfer, source);
begin_transfer(xfer, PURPLE_INPUT_READ);
}
@@ -1559,7 +1561,8 @@ purple_xfer_ui_ready(PurpleXfer *xfer)
cond = PURPLE_INPUT_READ;
if (priv->watcher == 0 && priv->fd != -1)
- priv->watcher = purple_input_add(priv->fd, cond, transfer_cb, xfer);
+ purple_xfer_set_watcher(xfer,
+ purple_input_add(priv->fd, cond, transfer_cb, xfer));
priv->ready = PURPLE_XFER_READY_NONE;
@@ -1594,6 +1597,7 @@ purple_xfer_start(PurpleXfer *xfer, int fd, const char *ip, guint16 port)
PurpleXferPrivate *priv = PURPLE_XFER_GET_PRIVATE(xfer);
PurpleInputCondition cond;
PurpleXferType type;
+ GObject *obj;
g_return_if_fail(priv != NULL);
g_return_if_fail(purple_xfer_get_xfer_type(xfer) != PURPLE_XFER_TYPE_UNKNOWN);
@@ -1609,6 +1613,12 @@ purple_xfer_start(PurpleXfer *xfer, int fd, const char *ip, guint16 port)
priv->remote_ip = g_strdup(ip);
priv->remote_port = port;
+ obj = G_OBJECT(xfer);
+ g_object_freeze_notify(obj);
+ g_object_notify(obj, "remote-ip");
+ g_object_notify(obj, "remote-port");
+ g_object_thaw_notify(obj);
+
/* Establish a file descriptor. */
purple_proxy_connect(NULL, priv->account, priv->remote_ip,
priv->remote_port, connect_cb, xfer);
@@ -1616,13 +1626,13 @@ purple_xfer_start(PurpleXfer *xfer, int fd, const char *ip, guint16 port)
return;
}
else {
- priv->fd = fd;
+ purple_xfer_set_fd(xfer, fd);
}
}
else {
cond = PURPLE_INPUT_WRITE;
- priv->fd = fd;
+ purple_xfer_set_fd(xfer, fd);
}
begin_transfer(xfer, cond);
@@ -1642,12 +1652,15 @@ purple_xfer_end(PurpleXfer *xfer)
}
priv->end_time = time(NULL);
+
+ g_object_notify(G_OBJECT(xfer), "end-time");
+
if (priv->ops.end != NULL)
priv->ops.end(xfer);
if (priv->watcher != 0) {
purple_input_remove(priv->watcher);
- priv->watcher = 0;
+ purple_xfer_set_watcher(xfer, 0);
}
if (priv->fd != -1)
@@ -1700,6 +1713,8 @@ purple_xfer_cancel_local(PurpleXfer *xfer)
purple_xfer_set_status(xfer, PURPLE_XFER_STATUS_CANCEL_LOCAL);
priv->end_time = time(NULL);
+ g_object_notify(G_OBJECT(xfer), "end-time");
+
if (purple_xfer_get_filename(xfer) != NULL)
{
msg = g_strdup_printf(_("You cancelled the transfer of %s"),
@@ -1725,7 +1740,7 @@ purple_xfer_cancel_local(PurpleXfer *xfer)
if (priv->watcher != 0) {
purple_input_remove(priv->watcher);
- priv->watcher = 0;
+ purple_xfer_set_watcher(xfer, 0);
}
if (priv->fd != -1)
@@ -1761,6 +1776,8 @@ purple_xfer_cancel_remote(PurpleXfer *xfer)
purple_xfer_set_status(xfer, PURPLE_XFER_STATUS_CANCEL_REMOTE);
priv->end_time = time(NULL);
+ g_object_notify(G_OBJECT(xfer), "end-time");
+
account = purple_xfer_get_account(xfer);
buddy = purple_blist_find_buddy(account, priv->who);
@@ -1791,7 +1808,7 @@ purple_xfer_cancel_remote(PurpleXfer *xfer)
if (priv->watcher != 0) {
purple_input_remove(priv->watcher);
- priv->watcher = 0;
+ purple_xfer_set_watcher(xfer, 0);
}
if (priv->fd != -1)
@@ -2079,7 +2096,6 @@ purple_xfer_init(GTypeInstance *instance, gpointer klass)
PURPLE_DBUS_REGISTER_POINTER(xfer, PurpleXfer);
priv->ui_ops = purple_xfers_get_ui_ops();
- priv->message = NULL;
priv->current_buffer_size = FT_INITIAL_BUFFER_SIZE;
priv->fd = -1;
priv->ready = PURPLE_XFER_READY_NONE;
@@ -2166,86 +2182,88 @@ purple_xfer_class_init(PurpleXferClass *klass)
g_param_spec_enum("type", "Transfer type",
"The type of file transfer.", PURPLE_TYPE_XFER_TYPE,
PURPLE_XFER_TYPE_UNKNOWN,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, PROP_ACCOUNT,
g_param_spec_object("account", "Account",
"The account sending or receiving the file.",
PURPLE_TYPE_ACCOUNT,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, PROP_REMOTE_USER,
g_param_spec_string("remote-user", "Remote user",
"The name of the remote user.", NULL,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT)
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, PROP_MESSAGE,
g_param_spec_string("message", "Message",
"The message for the file transfer.", NULL,
- G_PARAM_READWRITE)
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, PROP_FILENAME,
g_param_spec_string("filename", "Filename",
"The filename for the file transfer.", NULL,
- G_PARAM_READWRITE)
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, PROP_LOCAL_FILENAME,
g_param_spec_string("local-filename", "Local filename",
"The local filename for the file transfer.", NULL,
- G_PARAM_READWRITE)
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, PROP_FILE_SIZE,
g_param_spec_int64("file-size", "File size",
"Size of the file in a file transfer.",
G_MININT64, G_MAXINT64, 0,
- G_PARAM_READWRITE)
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, PROP_REMOTE_IP,
g_param_spec_string("remote-ip", "Remote IP",
"The remote IP address in the file transfer.", NULL,
- G_PARAM_READABLE)
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, PROP_LOCAL_PORT,
g_param_spec_int("local-port", "Local port",
"The local port number in the file transfer.",
G_MININT, G_MAXINT, 0,
- G_PARAM_READWRITE)
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, PROP_REMOTE_PORT,
g_param_spec_int("remote-port", "Remote port",
"The remote port number in the file transfer.",
G_MININT, G_MAXINT, 0,
- G_PARAM_READABLE)
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, PROP_FD,
g_param_spec_int("fd", "Socket FD",
"The socket file descriptor.",
G_MININT, G_MAXINT, 0,
- G_PARAM_READWRITE)
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, PROP_WATCHER,
g_param_spec_int("watcher", "Watcher",
"The watcher for the file transfer.",
G_MININT, G_MAXINT, 0,
- G_PARAM_READWRITE)
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, PROP_BYTES_SENT,
g_param_spec_int64("bytes-sent", "Bytes sent",
"The number of bytes sent (or received) so far.",
G_MININT64, G_MAXINT64, 0,
- G_PARAM_READWRITE)
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, PROP_START_TIME,
@@ -2265,7 +2283,7 @@ purple_xfer_class_init(PurpleXferClass *klass)
#else
#error Unknown size of time_t
#endif
- G_PARAM_READABLE)
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, PROP_END_TIME,
@@ -2285,14 +2303,14 @@ purple_xfer_class_init(PurpleXferClass *klass)
#else
#error Unknown size of time_t
#endif
- G_PARAM_READABLE)
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)
);
g_object_class_install_property(obj_class, PROP_STATUS,
g_param_spec_enum("status", "Status",
"The current status for the file transfer.",
PURPLE_TYPE_XFER_STATUS, PURPLE_XFER_STATUS_UNKNOWN,
- G_PARAM_READWRITE)
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)
);
g_type_class_add_private(klass, sizeof(PurpleXferPrivate));