empathy r906 - trunk/libempathy



Author: xclaesse
Date: Fri Apr 11 14:11:03 2008
New Revision: 906
URL: http://svn.gnome.org/viewvc/empathy?rev=906&view=rev

Log:
Remove empathy_inspect_* and add empathy_channel_get_account


Modified:
   trunk/libempathy/empathy-utils.c
   trunk/libempathy/empathy-utils.h

Modified: trunk/libempathy/empathy-utils.c
==============================================================================
--- trunk/libempathy/empathy-utils.c	(original)
+++ trunk/libempathy/empathy-utils.c	Fri Apr 11 14:11:03 2008
@@ -338,69 +338,6 @@
 	return mc;
 }
 
-gchar *
-empathy_inspect_channel (McAccount *account,
-		         TpChan    *tp_chan)
-{
-	g_return_val_if_fail (MC_IS_ACCOUNT (account), NULL);
-	g_return_val_if_fail (TELEPATHY_IS_CHAN (tp_chan), NULL);
-
-	return empathy_inspect_handle (account,
-				       tp_chan->handle,
-				       tp_chan->handle_type);
-}
-
-gchar *
-empathy_inspect_handle (McAccount *account,
-			guint      handle,
-			guint      handle_type)
-{
-	MissionControl  *mc;
-	TpConn          *tp_conn;
-	GArray          *handles;
-	gchar          **names;
-	gchar           *name;
-	GError          *error = NULL;
-
-	g_return_val_if_fail (MC_IS_ACCOUNT (account), NULL);
-	g_return_val_if_fail (handle != 0, NULL);
-	g_return_val_if_fail (handle_type != 0, NULL);
-
-	mc = empathy_mission_control_new ();
-	tp_conn = mission_control_get_connection (mc, account, NULL);
-	g_object_unref (mc);
-
-	if (!tp_conn) {
-		return NULL;
-	}
-
-	/* Get the handle's name */
-	handles = g_array_new (FALSE, FALSE, sizeof (guint));
-	g_array_append_val (handles, handle);
-	if (!tp_conn_inspect_handles (DBUS_G_PROXY (tp_conn),
-				      handle_type,
-				      handles,
-				      &names,
-				      &error)) {
-		empathy_debug (DEBUG_DOMAIN, 
-			      "Couldn't get id: %s",
-			      error ? error->message : "No error given");
-
-		g_clear_error (&error);
-		g_array_free (handles, TRUE);
-		g_object_unref (tp_conn);
-		
-		return NULL;
-	}
-
-	g_array_free (handles, TRUE);
-	name = *names;
-	g_free (names);
-	g_object_unref (tp_conn);
-
-	return name;
-}
-
 void
 empathy_call_with_contact (EmpathyContact *contact)
 {
@@ -448,7 +385,7 @@
 				  object_path, TP_IFACE_CHANNEL_TYPE_STREAMED_MEDIA,
 				  TP_HANDLE_TYPE_NONE, 0, NULL);
 
-	group = empathy_tp_group_new (account, channel);
+	group = empathy_tp_group_new (channel);
 	empathy_run_until_ready (group);
 
 	factory = empathy_contact_factory_new ();
@@ -682,4 +619,18 @@
 				      NULL, NULL);
 }
 
+McAccount *
+empathy_channel_get_account (TpChannel *channel)
+{
+	TpConnection   *connection;
+	McAccount      *account;
+	MissionControl *mc;
 
+	g_object_get (channel, "connection", &connection, NULL);
+	mc = empathy_mission_control_new ();
+	account = mission_control_get_account_for_tpconnection (mc, connection, NULL);
+	g_object_unref (connection);
+	g_object_unref (mc);
+
+	return account;
+}

Modified: trunk/libempathy/empathy-utils.h
==============================================================================
--- trunk/libempathy/empathy-utils.h	(original)
+++ trunk/libempathy/empathy-utils.h	Fri Apr 11 14:11:03 2008
@@ -83,11 +83,6 @@
 gboolean     empathy_account_equal                  (gconstpointer    a,
 						    gconstpointer    b);
 MissionControl *empathy_mission_control_new         (void);
-gchar *      empathy_inspect_handle                 (McAccount       *account,
-						     guint            handle,
-						     guint            handle_type);
-gchar *      empathy_inspect_channel                (McAccount       *account,
-						     TpChan          *tp_chan);
 void         empathy_call_with_contact              (EmpathyContact  *contact);
 void         empathy_call_with_contact_id           (McAccount       *account,
 						     const gchar     *contact_id);
@@ -108,6 +103,7 @@
 						     EmpathyRunUntilReadyFunc  func,
 						     gpointer         user_data,
 						     GMainLoop      **loop);
+McAccount *  empathy_channel_get_account            (TpChannel       *channel);
 
 G_END_DECLS
 



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