empathy r2074 - in trunk: libempathy libempathy-gtk src



Author: xclaesse
Date: Tue Jan  6 16:48:36 2009
New Revision: 2074
URL: http://svn.gnome.org/viewvc/empathy?rev=2074&view=rev

Log:
Use new singleton policy for EmpathyAccountManager.

Modified:
   trunk/libempathy-gtk/empathy-account-chooser.c
   trunk/libempathy-gtk/empathy-chat.c
   trunk/libempathy/empathy-account-manager.c
   trunk/libempathy/empathy-account-manager.h
   trunk/libempathy/empathy-contact-manager.c
   trunk/libempathy/empathy-dispatcher.c
   trunk/libempathy/empathy-tp-contact-factory.c
   trunk/src/empathy-accounts-dialog.c
   trunk/src/empathy-main-window.c
   trunk/src/empathy-status-icon.c

Modified: trunk/libempathy-gtk/empathy-account-chooser.c
==============================================================================
--- trunk/libempathy-gtk/empathy-account-chooser.c	(original)
+++ trunk/libempathy-gtk/empathy-account-chooser.c	Tue Jan  6 16:48:36 2009
@@ -135,7 +135,7 @@
 	priv->filter = NULL;
 	priv->filter_data = NULL;
 
-	priv->manager = empathy_account_manager_new ();
+	priv->manager = empathy_account_manager_dup_singleton ();
 
 	g_signal_connect (priv->manager, "account-created",
 			  G_CALLBACK (account_chooser_account_created_cb),

Modified: trunk/libempathy-gtk/empathy-chat.c
==============================================================================
--- trunk/libempathy-gtk/empathy-chat.c	(original)
+++ trunk/libempathy-gtk/empathy-chat.c	Tue Jan  6 16:48:36 2009
@@ -1530,7 +1530,7 @@
 	priv->contacts_width = -1;
 	priv->sent_messages = NULL;
 	priv->sent_messages_index = -1;
-	priv->account_manager = empathy_account_manager_new ();
+	priv->account_manager = empathy_account_manager_dup_singleton ();
 
 	g_signal_connect (priv->account_manager,
 			  "account-connection-changed",

Modified: trunk/libempathy/empathy-account-manager.c
==============================================================================
--- trunk/libempathy/empathy-account-manager.c	(original)
+++ trunk/libempathy/empathy-account-manager.c	Tue Jan  6 16:48:36 2009
@@ -96,7 +96,10 @@
   actual_c = mission_control_get_connection_status (mc, account, &err);
 
   if (err != NULL)
-    actual_c = TP_CONNECTION_STATUS_DISCONNECTED;
+    {
+      actual_c = TP_CONNECTION_STATUS_DISCONNECTED;
+      g_error_free (err);
+    }
 
   return account_data_new (actual_p, actual_c, mc_account_is_enabled (account));
 }
@@ -538,7 +541,7 @@
 /* public methods */
 
 EmpathyAccountManager *
-empathy_account_manager_new (void)
+empathy_account_manager_dup_singleton (void)
 {
   return g_object_new (EMPATHY_TYPE_ACCOUNT_MANAGER, NULL);
 }

Modified: trunk/libempathy/empathy-account-manager.h
==============================================================================
--- trunk/libempathy/empathy-account-manager.h	(original)
+++ trunk/libempathy/empathy-account-manager.h	Tue Jan  6 16:48:36 2009
@@ -51,7 +51,7 @@
 
 /* public methods */
 
-EmpathyAccountManager * empathy_account_manager_new (void);
+EmpathyAccountManager * empathy_account_manager_dup_singleton (void);
 int                     empathy_account_manager_get_connected_accounts 
                                 (EmpathyAccountManager *manager);
 int                     empathy_account_manager_get_connecting_accounts

Modified: trunk/libempathy/empathy-contact-manager.c
==============================================================================
--- trunk/libempathy/empathy-contact-manager.c	(original)
+++ trunk/libempathy/empathy-contact-manager.c	Tue Jan  6 16:48:36 2009
@@ -217,7 +217,7 @@
 					     empathy_account_equal,
 					     (GDestroyNotify) g_object_unref,
 					     (GDestroyNotify) g_object_unref);
-	priv->account_manager = empathy_account_manager_new ();
+	priv->account_manager = empathy_account_manager_dup_singleton ();
 	priv->contact_monitor = empathy_contact_monitor_new_for_proxy (EMPATHY_CONTACT_LIST (manager));
 
 	g_signal_connect (priv->account_manager,

Modified: trunk/libempathy/empathy-dispatcher.c
==============================================================================
--- trunk/libempathy/empathy-dispatcher.c	(original)
+++ trunk/libempathy/empathy-dispatcher.c	Tue Jan  6 16:48:36 2009
@@ -739,7 +739,7 @@
 
 	dispatcher->priv = priv;
 	priv->mc = empathy_mission_control_new ();
-	priv->account_manager = empathy_account_manager_new ();
+	priv->account_manager = empathy_account_manager_dup_singleton ();
 
 	g_signal_connect (priv->account_manager,
 			  "account-connection-changed",

Modified: trunk/libempathy/empathy-tp-contact-factory.c
==============================================================================
--- trunk/libempathy/empathy-tp-contact-factory.c	(original)
+++ trunk/libempathy/empathy-tp-contact-factory.c	Tue Jan  6 16:48:36 2009
@@ -1522,7 +1522,7 @@
 		EMPATHY_TYPE_TP_CONTACT_FACTORY, EmpathyTpContactFactoryPriv);
 
 	tp_factory->priv = priv;
-	priv->account_manager = empathy_account_manager_new ();
+	priv->account_manager = empathy_account_manager_dup_singleton ();
 
 	g_signal_connect (priv->account_manager, "account-connection-changed",
 			  G_CALLBACK (tp_contact_factory_account_connection_cb),

Modified: trunk/src/empathy-accounts-dialog.c
==============================================================================
--- trunk/src/empathy-accounts-dialog.c	(original)
+++ trunk/src/empathy-accounts-dialog.c	Tue Jan  6 16:48:36 2009
@@ -1099,7 +1099,7 @@
 			  dialog);
 
 	/* Set up signalling */
-	dialog->account_manager = empathy_account_manager_new ();
+	dialog->account_manager = empathy_account_manager_dup_singleton ();
 	dialog->mc = empathy_mission_control_new ();
 
 	g_signal_connect (dialog->account_manager, "account-created",

Modified: trunk/src/empathy-main-window.c
==============================================================================
--- trunk/src/empathy-main-window.c	(original)
+++ trunk/src/empathy-main-window.c	Tue Jan  6 16:48:36 2009
@@ -467,16 +467,14 @@
 					 McPresence previous,
 					 EmpathyMainWindow *window)
 {
-	EmpathyAccountManager *acc_manager;
 	McAccount *account;
 	gboolean should_play;
 
-	acc_manager = empathy_account_manager_new ();
 	account = empathy_contact_get_account (contact);
-	should_play = !empathy_account_manager_is_account_just_connected (acc_manager, account);
+	should_play = !empathy_account_manager_is_account_just_connected (window->account_manager, account);
 
 	if (!should_play) {
-		goto out;
+		return;
 	}
 
 	if (previous < MC_PRESENCE_AVAILABLE && current > MC_PRESENCE_OFFLINE) {
@@ -487,7 +485,7 @@
 						CA_PROP_EVENT_DESCRIPTION, _("Contact logged in"),
 						NULL);
 		}
-		goto out;
+		return;
 	}
 
 	if (previous > MC_PRESENCE_OFFLINE && current < MC_PRESENCE_AVAILABLE) {
@@ -499,8 +497,6 @@
 						NULL);
 		}
 	}
-out:
-	g_object_unref (acc_manager);
 }
 
 GtkWidget *
@@ -573,7 +569,7 @@
 	g_object_unref (glade);
 
 	window->mc = empathy_mission_control_new ();
-	window->account_manager = empathy_account_manager_new ();
+	window->account_manager = empathy_account_manager_dup_singleton ();
 
 	g_signal_connect (window->account_manager,
 			  "account-connection-changed",

Modified: trunk/src/empathy-status-icon.c
==============================================================================
--- trunk/src/empathy-status-icon.c	(original)
+++ trunk/src/empathy-status-icon.c	Tue Jan  6 16:48:36 2009
@@ -395,7 +395,7 @@
 
 	icon->priv = priv;
 	priv->icon = gtk_status_icon_new ();
-	priv->account_manager = empathy_account_manager_new ();
+	priv->account_manager = empathy_account_manager_dup_singleton ();
 	priv->idle = empathy_idle_new ();
 	priv->event_manager = empathy_event_manager_new ();
 



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