[empathy] main-window: use tp_connection_get_account()



commit 010b9fefd050ad4d4c2627cad084b55573a455a3
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Fri Aug 19 12:12:22 2011 +0200

    main-window: use tp_connection_get_account()
    
    https://bugzilla.gnome.org/show_bug.cgi?id=656866

 src/empathy-main-window.c |   16 ++++------------
 1 files changed, 4 insertions(+), 12 deletions(-)
---
diff --git a/src/empathy-main-window.c b/src/empathy-main-window.c
index e3588c2..167e338 100644
--- a/src/empathy-main-window.c
+++ b/src/empathy-main-window.c
@@ -901,7 +901,7 @@ static void
 main_window_balance_update_balance (GtkAction   *action,
 				    TpConnection *conn)
 {
-	TpAccount *account = g_object_get_data (G_OBJECT (action), "account");
+	TpAccount *account = tp_connection_get_account (conn);
 	GtkWidget *label;
 	int amount = 0;
 	guint scale = G_MAXINT32;
@@ -977,7 +977,6 @@ main_window_setup_balance_create_action (EmpathyMainWindow *window,
 	g_object_bind_property (account, "icon-name", action, "icon-name",
 		G_BINDING_SYNC_CREATE);
 
-	g_object_set_data (G_OBJECT (action), "account", account);
 	g_signal_connect (action, "activate",
 		G_CALLBACK (main_window_balance_activate_cb), window);
 
@@ -1016,15 +1015,12 @@ main_window_setup_balance_create_action (EmpathyMainWindow *window,
 
 static GtkWidget *
 main_window_setup_balance_create_widget (EmpathyMainWindow *window,
-					 GtkAction         *action)
+					 GtkAction         *action,
+					 TpAccount *account)
 {
 	EmpathyMainWindowPriv *priv = GET_PRIV (window);
-	TpAccount *account;
 	GtkWidget *hbox, *image, *label, *button;
 
-	account = g_object_get_data (G_OBJECT (action), "account");
-	g_return_val_if_fail (TP_IS_ACCOUNT (account), NULL);
-
 	hbox = gtk_hbox_new (FALSE, 6);
 
 	/* protocol icon */
@@ -1074,10 +1070,6 @@ main_window_setup_balance (EmpathyMainWindow *window,
 	if (conn == NULL)
 		return;
 
-	/* need to prepare the connection:
-	 * store the account on the connection */
-	g_object_set_data (G_OBJECT (conn), "account", account);
-
 	if (!tp_proxy_is_prepared (conn, TP_CONNECTION_FEATURE_BALANCE))
 		return;
 
@@ -1093,7 +1085,7 @@ main_window_setup_balance (EmpathyMainWindow *window,
 	gtk_action_set_visible (priv->view_balance_show_in_roster, TRUE);
 
 	/* create the display widget */
-	main_window_setup_balance_create_widget (window, action);
+	main_window_setup_balance_create_widget (window, action, account);
 
 	/* check the current balance and monitor for any changes */
 	uri = tp_connection_get_balance_uri (conn);



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