[empathy/mc5: 440/483] Cache the icon inside EmpathyAccountSettings
- From: Sjoerd Simons <sjoerds src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [empathy/mc5: 440/483] Cache the icon inside EmpathyAccountSettings
- Date: Fri, 21 Aug 2009 17:21:35 +0000 (UTC)
commit 6f47d10791dac97495b73200e05122b6406ea74b
Author: Sjoerd Simons <sjoerd simons collabora co uk>
Date: Wed Aug 19 12:59:06 2009 +0100
Cache the icon inside EmpathyAccountSettings
At some point we should set the Icon property in the account manager,
for now just cache it in the settings so we can pass it by reference
instead of needing to dup it as that's the API we want to have in the future
libempathy/empathy-account-settings.c | 16 +++++++++-------
src/empathy-accounts-dialog.c | 4 ----
2 files changed, 9 insertions(+), 11 deletions(-)
---
diff --git a/libempathy/empathy-account-settings.c b/libempathy/empathy-account-settings.c
index 209f017..4bafac2 100644
--- a/libempathy/empathy-account-settings.c
+++ b/libempathy/empathy-account-settings.c
@@ -58,6 +58,7 @@ struct _EmpathyAccountSettingsPriv
gchar *cm_name;
gchar *protocol;
gchar *display_name;
+ gchar *icon_name;
gboolean ready;
GHashTable *parameters;
@@ -171,6 +172,8 @@ empathy_account_settings_constructed (GObject *object)
g_strdup (empathy_account_get_protocol (priv->account));
}
+ priv->icon_name = g_strdup_printf ("im-%s", priv->protocol);
+
g_assert (priv->cm_name != NULL && priv->protocol != NULL);
empathy_account_settings_check_readyness (self);
@@ -309,6 +312,7 @@ empathy_account_settings_finalize (GObject *object)
g_free (priv->cm_name);
g_free (priv->protocol);
g_free (priv->display_name);
+ g_free (priv->icon_name);
g_hash_table_destroy (priv->parameters);
@@ -343,6 +347,10 @@ empathy_account_settings_check_readyness (EmpathyAccountSettings *self)
g_free (priv->display_name);
priv->display_name =
g_strdup (empathy_account_get_display_name (priv->account));
+
+ g_free (priv->icon_name);
+ priv->icon_name =
+ (gchar *) empathy_account_get_icon_name (priv->account);
}
priv->tp_protocol = tp_connection_manager_get_protocol (priv->manager,
@@ -446,13 +454,7 @@ empathy_account_settings_get_icon_name (EmpathyAccountSettings *settings)
{
EmpathyAccountSettingsPriv *priv = GET_PRIV (settings);
- if (priv->account != NULL)
- return g_strdup (empathy_account_get_icon_name (priv->account));
-
- if (priv->tp_protocol != NULL)
- return g_strdup_printf ("im-%s", priv->tp_protocol->name);
-
- return NULL;
+ return priv->icon_name;
}
const gchar *
diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c
index f74de13..9132395 100644
--- a/src/empathy-accounts-dialog.c
+++ b/src/empathy-accounts-dialog.c
@@ -192,8 +192,6 @@ account_dialog_create_settings_widget (EmpathyAccountsDialog *dialog,
empathy_account_settings_get_protocol (settings));
accounts_dialog_update_name_label (dialog, settings);
-
- g_free (icon_name);
}
static void
@@ -396,8 +394,6 @@ accounts_dialog_model_pixbuf_data_func (GtkTreeViewColumn *tree_column,
icon_name = empathy_account_settings_get_icon_name (settings);
pixbuf = empathy_pixbuf_from_icon_name (icon_name, GTK_ICON_SIZE_BUTTON);
- g_free (icon_name);
-
if (pixbuf)
{
if (status == TP_CONNECTION_STATUS_DISCONNECTED ||
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]