aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@src.gnome.org>2008-10-13 15:53:00 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2008-10-13 15:53:00 +0800
commite2908ad8676eea131c22e81780468d47f8fd6ad0 (patch)
tree90b8a6da2bc6f85f0bf65c5e8093d59e99ad9e83 /libempathy
parent209589bdc82e75c177660530bdb116ba2b9cfcda (diff)
downloadgsoc2013-empathy-e2908ad8676eea131c22e81780468d47f8fd6ad0.tar
gsoc2013-empathy-e2908ad8676eea131c22e81780468d47f8fd6ad0.tar.gz
gsoc2013-empathy-e2908ad8676eea131c22e81780468d47f8fd6ad0.tar.bz2
gsoc2013-empathy-e2908ad8676eea131c22e81780468d47f8fd6ad0.tar.lz
gsoc2013-empathy-e2908ad8676eea131c22e81780468d47f8fd6ad0.tar.xz
gsoc2013-empathy-e2908ad8676eea131c22e81780468d47f8fd6ad0.tar.zst
gsoc2013-empathy-e2908ad8676eea131c22e81780468d47f8fd6ad0.zip
add a favorite and tp-channel property to EmpathyChatroom
svn path=/trunk/; revision=1533
Diffstat (limited to 'libempathy')
-rw-r--r--libempathy/empathy-chatroom.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/libempathy/empathy-chatroom.c b/libempathy/empathy-chatroom.c
index 91f86d04e..5c25de3ca 100644
--- a/libempathy/empathy-chatroom.c
+++ b/libempathy/empathy-chatroom.c
@@ -34,6 +34,11 @@ typedef struct {
gchar *room;
gchar *name;
gboolean auto_connect;
+ gboolean favorite;
+ /* FIXME: This is crack. We should store EmapthyTpChat but can't
+ * as it's not created in the dispatcher. At some point it should be
+ * automatically created by tp-glib */
+ TpChannel *tp_channel;
} EmpathyChatroomPriv;
@@ -53,6 +58,8 @@ enum {
PROP_ROOM,
PROP_NAME,
PROP_AUTO_CONNECT,
+ PROP_FAVORITE,
+ PROP_TP_CHANNEL
};
G_DEFINE_TYPE (EmpathyChatroom, empathy_chatroom, G_TYPE_OBJECT);
@@ -98,6 +105,30 @@ empathy_chatroom_class_init (EmpathyChatroomClass *klass)
FALSE,
G_PARAM_READWRITE));
+ g_object_class_install_property (object_class,
+ PROP_FAVORITE,
+ g_param_spec_boolean ("favorite",
+ "Favorite",
+ "TRUE if the chatroom is in user's favorite list",
+ FALSE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_NAME |
+ G_PARAM_STATIC_NICK |
+ G_PARAM_STATIC_BLURB));
+
+ g_object_class_install_property (object_class,
+ PROP_TP_CHANNEL,
+ g_param_spec_object ("tp-channel",
+ "TpChannel object",
+ "The TpChannel associated with this chatroom if we are in the"
+ " room. NULL otherwise.",
+ TP_TYPE_CHANNEL,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_NAME |
+ G_PARAM_STATIC_NICK |
+ G_PARAM_STATIC_BLURB));
g_type_class_add_private (object_class, sizeof (EmpathyChatroomPriv));
}
@@ -118,6 +149,12 @@ chatroom_finalize (GObject *object)
priv = GET_PRIV (object);
+ if (priv->tp_channel != NULL)
+ {
+ g_object_unref (priv->tp_channel);
+ priv->tp_channel = NULL;
+ }
+
g_object_unref (priv->account);
g_free (priv->room);
g_free (priv->name);
@@ -148,6 +185,12 @@ chatroom_get_property (GObject *object,
case PROP_AUTO_CONNECT:
g_value_set_boolean (value, priv->auto_connect);
break;
+ case PROP_FAVORITE:
+ g_value_set_boolean (value, priv->favorite);
+ break;
+ case PROP_TP_CHANNEL:
+ g_value_set_object (value, priv->tp_channel);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
@@ -181,6 +224,17 @@ chatroom_set_property (GObject *object,
empathy_chatroom_set_auto_connect (EMPATHY_CHATROOM (object),
g_value_get_boolean (value));
break;
+ case PROP_FAVORITE:
+ priv->favorite = g_value_get_boolean (value);
+ break;
+ case PROP_TP_CHANNEL:
+ if (priv->tp_channel != NULL)
+ {
+ g_object_unref (priv->tp_channel);
+ }
+
+ priv->tp_channel = g_value_dup_object (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;