/soc/2013/ankitkv/gobjectification: 6e915db4db35: Backed out cha...
Ankit Vani
a at nevitus.org
Fri Sep 13 09:44:38 EDT 2013
Changeset: 6e915db4db359dcbf3192634445517852278ca9a
Author: Ankit Vani <a at nevitus.org>
Date: 2013-09-13 19:02 +0530
Branch: soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/6e915db4db35
Description:
Backed out changeset 7b1fefd1e2ee
diffstat:
libpurple/connection.c | 30 ++++++++----------------
libpurple/protocol.c | 32 -------------------------
libpurple/protocol.h | 48 --------------------------------------
libpurple/roomlist.c | 22 +++--------------
libpurple/whiteboard.c | 62 +++++++++++++++++++++++++++++++++----------------
libpurple/whiteboard.h | 20 +++++++++++++++-
libpurple/xfer.c | 26 ++++----------------
7 files changed, 81 insertions(+), 159 deletions(-)
diffs (truncated from 391 to 300 lines):
diff --git a/libpurple/connection.c b/libpurple/connection.c
--- a/libpurple/connection.c
+++ b/libpurple/connection.c
@@ -880,16 +880,11 @@ void
}
}
- if (PURPLE_PROTOCOL_IMPLEMENTS(protocol, connection_new))
- gc = purple_protocol_iface_connection_new(protocol, account, password);
- else
- gc = g_object_new(PURPLE_TYPE_CONNECTION,
- PROP_PROTOCOL_S, protocol,
- PROP_ACCOUNT_S, account,
- PROP_PASSWORD_S, password,
- NULL);
-
- g_return_if_fail(gc != NULL);
+ gc = g_object_new(PURPLE_TYPE_CONNECTION,
+ PROP_PROTOCOL_S, protocol,
+ PROP_PASSWORD_S, password,
+ PROP_ACCOUNT_S, account,
+ NULL);
if (regist)
{
@@ -945,16 +940,11 @@ void
return;
}
- if (PURPLE_PROTOCOL_IMPLEMENTS(protocol, connection_new))
- gc = purple_protocol_iface_connection_new(protocol, account, password);
- else
- gc = g_object_new(PURPLE_TYPE_CONNECTION,
- PROP_PROTOCOL_S, protocol,
- PROP_ACCOUNT_S, account,
- PROP_PASSWORD_S, password,
- NULL);
-
- g_return_if_fail(gc != NULL);
+ gc = g_object_new(PURPLE_TYPE_CONNECTION,
+ PROP_PROTOCOL_S, protocol,
+ PROP_PASSWORD_S, password,
+ PROP_ACCOUNT_S, account,
+ NULL);
purple_debug_info("connection", "Unregistering. gc = %p\n", gc);
diff --git a/libpurple/protocol.c b/libpurple/protocol.c
--- a/libpurple/protocol.c
+++ b/libpurple/protocol.c
@@ -255,38 +255,6 @@ purple_protocol_iface_get_type(void)
else \
return defaultreturn;
-PurpleConnection *
-purple_protocol_iface_connection_new(PurpleProtocol *protocol,
- PurpleAccount *account,
- const char *password)
-{
- DEFINE_PROTOCOL_FUNC_WITH_RETURN(protocol, NULL, connection_new, protocol,
- account, password);
-}
-
-PurpleRoomlist *
-purple_protocol_iface_roomlist_new(PurpleProtocol *protocol,
- PurpleAccount *account)
-{
- DEFINE_PROTOCOL_FUNC_WITH_RETURN(protocol, NULL, roomlist_new, account);
-}
-
-PurpleWhiteboard *
-purple_protocol_iface_whiteboard_new(PurpleProtocol *protocol,
- PurpleAccount *account, const char *who)
-{
- DEFINE_PROTOCOL_FUNC_WITH_RETURN(protocol, NULL, whiteboard_new, account,
- who);
-}
-
-PurpleXfer *
-purple_protocol_iface_xfer_new(PurpleProtocol *protocol, PurpleAccount *account,
- PurpleXferType type, const char *who)
-{
- DEFINE_PROTOCOL_FUNC_WITH_RETURN(protocol, NULL, xfer_new, account, type,
- who);
-}
-
GList *
purple_protocol_iface_get_actions(PurpleProtocol *protocol,
PurpleConnection *gc)
diff --git a/libpurple/protocol.h b/libpurple/protocol.h
--- a/libpurple/protocol.h
+++ b/libpurple/protocol.h
@@ -128,34 +128,6 @@ struct _PurpleProtocolInterface
GTypeInterface parent_iface;
/**
- * Creates a new protocol-specific connection object that inherits
- * PurpleConnection.
- */
- PurpleConnection *(*connection_new)(PurpleProtocol *protocol,
- PurpleAccount *account,
- const char *password);
-
- /**
- * Creates a new protocol-specific room list object that inherits
- * PurpleRoomlist.
- */
- PurpleRoomlist *(*roomlist_new)(PurpleAccount *account);
-
- /**
- * Creates a new protocol-specific whiteboard object that inherits
- * PurpleWhiteboard.
- */
- PurpleWhiteboard *(*whiteboard_new)(PurpleAccount *account,
- const char *who);
-
- /**
- * Creates a new protocol-specific file transfer object that inherits
- * PurpleXfer.
- */
- PurpleXfer *(*xfer_new)(PurpleAccount *account, PurpleXferType type,
- const char *who);
-
- /**
* Returns the actions the protocol can perform. These will show up in the
* Accounts menu, under a submenu with the name of the account.
*/
@@ -673,26 +645,6 @@ void purple_protocol_override(PurpleProt
*/
GType purple_protocol_iface_get_type(void);
-/** @copydoc _PurpleProtocolInterface::connection_new */
-PurpleConnection *purple_protocol_iface_connection_new(PurpleProtocol *protocol,
- PurpleAccount *account,
- const char *password);
-
-/** @copydoc _PurpleProtocolInterface::roomlist_new */
-PurpleRoomlist *purple_protocol_iface_roomlist_new(PurpleProtocol *,
- PurpleAccount *account);
-
-/** @copydoc _PurpleProtocolInterface::whiteboard_new */
-PurpleWhiteboard *purple_protocol_iface_whiteboard_new(PurpleProtocol *,
- PurpleAccount *account,
- const char *who);
-
-/** @copydoc _PurpleProtocolInterface::xfer_new */
-PurpleXfer *purple_protocol_iface_xfer_new(PurpleProtocol *,
- PurpleAccount *account,
- PurpleXferType type,
- const char *who);
-
/** @copydoc _PurpleProtocolInterface::get_actions */
GList *purple_protocol_iface_get_actions(PurpleProtocol *, PurpleConnection *);
diff --git a/libpurple/roomlist.c b/libpurple/roomlist.c
--- a/libpurple/roomlist.c
+++ b/libpurple/roomlist.c
@@ -398,26 +398,12 @@ purple_roomlist_get_type(void)
PurpleRoomlist *purple_roomlist_new(PurpleAccount *account)
{
- PurpleRoomlist *list;
- PurpleProtocol *protocol;
-
g_return_val_if_fail(account != NULL, NULL);
- protocol = purple_protocols_find(purple_account_get_protocol_id(account));
-
- g_return_val_if_fail(protocol != NULL, NULL);
-
- if (PURPLE_PROTOCOL_IMPLEMENTS(protocol, roomlist_new))
- list = purple_protocol_iface_roomlist_new(protocol, account);
- else
- list = g_object_new(PURPLE_TYPE_ROOMLIST,
- PROP_ACCOUNT_S, account,
- NULL
- );
-
- g_return_val_if_fail(list != NULL, NULL);
-
- return list;
+ return g_object_new(PURPLE_TYPE_ROOMLIST,
+ PROP_ACCOUNT_S, account,
+ NULL
+ );
}
/*@}*/
diff --git a/libpurple/whiteboard.c b/libpurple/whiteboard.c
--- a/libpurple/whiteboard.c
+++ b/libpurple/whiteboard.c
@@ -34,6 +34,8 @@ typedef struct _PurpleWhiteboardPrivate
/** Private data for a whiteboard */
struct _PurpleWhiteboardPrivate
{
+ int state; /**< State of whiteboard session */
+
PurpleAccount *account; /**< Account associated with this session */
char *who; /**< Name of the remote user */
@@ -47,6 +49,7 @@ struct _PurpleWhiteboardPrivate
enum
{
PROP_0,
+ PROP_STATE,
PROP_ACCOUNT,
PROP_WHO,
PROP_DRAW_LIST,
@@ -100,6 +103,24 @@ const char *purple_whiteboard_get_who(co
return priv->who;
}
+void purple_whiteboard_set_state(PurpleWhiteboard *wb, int state)
+{
+ PurpleWhiteboardPrivate *priv = PURPLE_WHITEBOARD_GET_PRIVATE(wb);
+
+ g_return_if_fail(priv != NULL);
+
+ priv->state = state;
+}
+
+int purple_whiteboard_get_state(const PurpleWhiteboard *wb)
+{
+ PurpleWhiteboardPrivate *priv = PURPLE_WHITEBOARD_GET_PRIVATE(wb);
+
+ g_return_val_if_fail(priv != NULL, -1);
+
+ return priv->state;
+}
+
void purple_whiteboard_start(PurpleWhiteboard *wb)
{
/* Create frontend for whiteboard */
@@ -279,6 +300,7 @@ gpointer purple_whiteboard_get_ui_data(c
* GObject code
*****************************************************************************/
/* GObject Property names */
+#define PROP_STATE_S "state"
#define PROP_ACCOUNT_S "account"
#define PROP_WHO_S "who"
#define PROP_DRAW_LIST_S "draw-list"
@@ -292,6 +314,9 @@ purple_whiteboard_set_property(GObject *
PurpleWhiteboardPrivate *priv = PURPLE_WHITEBOARD_GET_PRIVATE(wb);
switch (param_id) {
+ case PROP_STATE:
+ purple_whiteboard_set_state(wb, g_value_get_int(value));
+ break;
case PROP_ACCOUNT:
priv->account = g_value_get_object(value);
break;
@@ -315,6 +340,9 @@ purple_whiteboard_get_property(GObject *
PurpleWhiteboard *wb = PURPLE_WHITEBOARD(obj);
switch (param_id) {
+ case PROP_STATE:
+ g_value_set_int(value, purple_whiteboard_get_state(wb));
+ break;
case PROP_ACCOUNT:
g_value_set_object(value, purple_whiteboard_get_account(wb));
break;
@@ -402,6 +430,13 @@ purple_whiteboard_class_init(PurpleWhite
obj_class->get_property = purple_whiteboard_get_property;
obj_class->set_property = purple_whiteboard_set_property;
+ g_object_class_install_property(obj_class, PROP_STATE,
+ g_param_spec_int(PROP_STATE_S, _("State"),
+ _("State of the whiteboard."),
+ G_MININT, G_MAXINT, 0,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT)
+ );
+
g_object_class_install_property(obj_class, PROP_ACCOUNT,
g_param_spec_object(PROP_ACCOUNT_S, _("Account"),
_("The whiteboard's account."), PURPLE_TYPE_ACCOUNT,
@@ -449,28 +484,15 @@ purple_whiteboard_get_type(void)
return type;
}
-PurpleWhiteboard *purple_whiteboard_new(PurpleAccount *account, const char *who)
+PurpleWhiteboard *purple_whiteboard_new(PurpleAccount *account, const char *who, int state)
{
- PurpleWhiteboard *wb;
- PurpleProtocol *protocol;
-
g_return_val_if_fail(account != NULL, NULL);
g_return_val_if_fail(who != NULL, NULL);
- protocol = purple_protocols_find(purple_account_get_protocol_id(account));
-
- g_return_val_if_fail(protocol != NULL, NULL);
-
- if (PURPLE_PROTOCOL_IMPLEMENTS(protocol, whiteboard_new))
- wb = purple_protocol_iface_whiteboard_new(protocol, account, who);
- else
- wb = g_object_new(PURPLE_TYPE_WHITEBOARD,
- PROP_ACCOUNT_S, account,
- PROP_WHO_S, who,
- NULL
- );
More information about the Commits
mailing list