aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@src.gnome.org>2009-01-07 00:48:36 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2009-01-07 00:48:36 +0800
commitd374b59bc0a0baf9fdfcb3528162cbf389b7f26c (patch)
treeaec6df9cb672e573b8fa544ba65eeed709a9b7e7
parentdcc292dc2b1fb67d63403618803a5e82e8ebfc9d (diff)
downloadgsoc2013-empathy-d374b59bc0a0baf9fdfcb3528162cbf389b7f26c.tar
gsoc2013-empathy-d374b59bc0a0baf9fdfcb3528162cbf389b7f26c.tar.gz
gsoc2013-empathy-d374b59bc0a0baf9fdfcb3528162cbf389b7f26c.tar.bz2
gsoc2013-empathy-d374b59bc0a0baf9fdfcb3528162cbf389b7f26c.tar.lz
gsoc2013-empathy-d374b59bc0a0baf9fdfcb3528162cbf389b7f26c.tar.xz
gsoc2013-empathy-d374b59bc0a0baf9fdfcb3528162cbf389b7f26c.tar.zst
gsoc2013-empathy-d374b59bc0a0baf9fdfcb3528162cbf389b7f26c.zip
Use new singleton policy for EmpathyAccountManager.
svn path=/trunk/; revision=2074
-rw-r--r--libempathy-gtk/empathy-account-chooser.c2
-rw-r--r--libempathy-gtk/empathy-chat.c2
-rw-r--r--libempathy/empathy-account-manager.c7
-rw-r--r--libempathy/empathy-account-manager.h2
-rw-r--r--libempathy/empathy-contact-manager.c2
-rw-r--r--libempathy/empathy-dispatcher.c2
-rw-r--r--libempathy/empathy-tp-contact-factory.c2
-rw-r--r--src/empathy-accounts-dialog.c2
-rw-r--r--src/empathy-main-window.c12
-rw-r--r--src/empathy-status-icon.c2
10 files changed, 17 insertions, 18 deletions
diff --git a/libempathy-gtk/empathy-account-chooser.c b/libempathy-gtk/empathy-account-chooser.c
index a3a5b837a..612d07f13 100644
--- a/libempathy-gtk/empathy-account-chooser.c
+++ b/libempathy-gtk/empathy-account-chooser.c
@@ -135,7 +135,7 @@ empathy_account_chooser_init (EmpathyAccountChooser *chooser)
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),
diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c
index 606eb3d18..31b676edb 100644
--- a/libempathy-gtk/empathy-chat.c
+++ b/libempathy-gtk/empathy-chat.c
@@ -1530,7 +1530,7 @@ empathy_chat_init (EmpathyChat *chat)
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",
diff --git a/libempathy/empathy-account-manager.c b/libempathy/empathy-account-manager.c
index b56a67d98..aa45c3209 100644
--- a/libempathy/empathy-account-manager.c
+++ b/libempathy/empathy-account-manager.c
@@ -96,7 +96,10 @@ account_data_new_default (MissionControl *mc,
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 @@ empathy_account_manager_class_init (EmpathyAccountManagerClass *klass)
/* public methods */
EmpathyAccountManager *
-empathy_account_manager_new (void)
+empathy_account_manager_dup_singleton (void)
{
return g_object_new (EMPATHY_TYPE_ACCOUNT_MANAGER, NULL);
}
diff --git a/libempathy/empathy-account-manager.h b/libempathy/empathy-account-manager.h
index a6ebd5f73..58d977fc5 100644
--- a/libempathy/empathy-account-manager.h
+++ b/libempathy/empathy-account-manager.h
@@ -51,7 +51,7 @@ GType empathy_account_manager_get_type (void);
/* 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
diff --git a/libempathy/empathy-contact-manager.c b/libempathy/empathy-contact-manager.c
index 2e50a53bd..213c625a3 100644
--- a/libempathy/empathy-contact-manager.c
+++ b/libempathy/empathy-contact-manager.c
@@ -217,7 +217,7 @@ empathy_contact_manager_init (EmpathyContactManager *manager)
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,
diff --git a/libempathy/empathy-dispatcher.c b/libempathy/empathy-dispatcher.c
index 56c2e4bf4..29345e0a3 100644
--- a/libempathy/empathy-dispatcher.c
+++ b/libempathy/empathy-dispatcher.c
@@ -739,7 +739,7 @@ empathy_dispatcher_init (EmpathyDispatcher *dispatcher)
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",
diff --git a/libempathy/empathy-tp-contact-factory.c b/libempathy/empathy-tp-contact-factory.c
index ffb3c8896..f7a6638f9 100644
--- a/libempathy/empathy-tp-contact-factory.c
+++ b/libempathy/empathy-tp-contact-factory.c
@@ -1522,7 +1522,7 @@ empathy_tp_contact_factory_init (EmpathyTpContactFactory *tp_factory)
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),
diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c
index 0816128ea..a9af44827 100644
--- a/src/empathy-accounts-dialog.c
+++ b/src/empathy-accounts-dialog.c
@@ -1099,7 +1099,7 @@ empathy_accounts_dialog_show (GtkWindow *parent,
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",
diff --git a/src/empathy-main-window.c b/src/empathy-main-window.c
index bc795dbe0..8a377d794 100644
--- a/src/empathy-main-window.c
+++ b/src/empathy-main-window.c
@@ -467,16 +467,14 @@ main_window_contact_presence_changed_cb (EmpathyContactMonitor *monitor,
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 @@ main_window_contact_presence_changed_cb (EmpathyContactMonitor *monitor,
CA_PROP_EVENT_DESCRIPTION, _("Contact logged in"),
NULL);
}
- goto out;
+ return;
}
if (previous > MC_PRESENCE_OFFLINE && current < MC_PRESENCE_AVAILABLE) {
@@ -499,8 +497,6 @@ main_window_contact_presence_changed_cb (EmpathyContactMonitor *monitor,
NULL);
}
}
-out:
- g_object_unref (acc_manager);
}
GtkWidget *
@@ -573,7 +569,7 @@ empathy_main_window_show (void)
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",
diff --git a/src/empathy-status-icon.c b/src/empathy-status-icon.c
index 3a517db91..07fc3aa02 100644
--- a/src/empathy-status-icon.c
+++ b/src/empathy-status-icon.c
@@ -395,7 +395,7 @@ empathy_status_icon_init (EmpathyStatusIcon *icon)
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 ();