empathy r1533 - trunk/libempathy



Author: xclaesse
Date: Mon Oct 13 07:53:00 2008
New Revision: 1533
URL: http://svn.gnome.org/viewvc/empathy?rev=1533&view=rev

Log:
add a favorite and tp-channel property to EmpathyChatroom

Modified:
   trunk/libempathy/empathy-chatroom.c

Modified: trunk/libempathy/empathy-chatroom.c
==============================================================================
--- trunk/libempathy/empathy-chatroom.c	(original)
+++ trunk/libempathy/empathy-chatroom.c	Mon Oct 13 07:53:00 2008
@@ -34,6 +34,11 @@
 	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 @@
 	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 @@
 							       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 @@
 
 	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 @@
 	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 @@
 		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;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]