[empathy/mc5: 23/483] Get the icon name from the account object directly



commit ddcb104dfa874375ea17cac4de2f273af7327fc4
Author: Sjoerd Simons <sjoerd simons collabora co uk>
Date:   Sun Jul 5 10:43:50 2009 +0100

    Get the icon name from the account object directly

 libempathy-gtk/empathy-account-chooser.c |    2 +-
 libempathy-gtk/empathy-log-window.c      |    2 +-
 libempathy-gtk/empathy-ui-utils.c        |   10 ----------
 libempathy-gtk/empathy-ui-utils.h        |    1 -
 libempathy/empathy-account.c             |   11 +++++++++++
 libempathy/empathy-account.h             |    1 +
 src/empathy-accounts-dialog.c            |    2 +-
 7 files changed, 15 insertions(+), 14 deletions(-)
---
diff --git a/libempathy-gtk/empathy-account-chooser.c b/libempathy-gtk/empathy-account-chooser.c
index 7dccb21..719cc76 100644
--- a/libempathy-gtk/empathy-account-chooser.c
+++ b/libempathy-gtk/empathy-account-chooser.c
@@ -610,7 +610,7 @@ account_chooser_update_iter (EmpathyAccountChooser *chooser,
 			    COL_ACCOUNT_POINTER, &account,
 			    -1);
 
-	icon_name = empathy_icon_name_from_account (account);
+	icon_name = empathy_account_get_icon_name (account);
 	if (priv->filter) {
 		is_enabled = priv->filter (account, priv->filter_data);
 	}
diff --git a/libempathy-gtk/empathy-log-window.c b/libempathy-gtk/empathy-log-window.c
index f05017c..7add301 100644
--- a/libempathy-gtk/empathy-log-window.c
+++ b/libempathy-gtk/empathy-log-window.c
@@ -419,7 +419,7 @@ log_window_find_populate (EmpathyLogWindow *window,
 
 		date_readable = empathy_log_manager_get_date_readable (hit->date);
 		account_name = empathy_account_get_display_name (hit->account);
-		account_icon = empathy_icon_name_from_account (hit->account);
+		account_icon = empathy_account_get_icon_name (hit->account);
 
 		gtk_list_store_append (store, &iter);
 		gtk_list_store_set (store, &iter,
diff --git a/libempathy-gtk/empathy-ui-utils.c b/libempathy-gtk/empathy-ui-utils.c
index 3c8c527..00e6a0c 100644
--- a/libempathy-gtk/empathy-ui-utils.c
+++ b/libempathy-gtk/empathy-ui-utils.c
@@ -183,16 +183,6 @@ empathy_builder_unref_and_keep_widget (GtkBuilder *gui,
 }
 
 const gchar *
-empathy_icon_name_from_account (EmpathyAccount *account)
-{
-	McProfile *profile;
-
-	profile = empathy_account_get_profile (account);
-
-	return mc_profile_get_icon_name (profile);
-}
-
-const gchar *
 empathy_icon_name_for_presence (TpConnectionPresenceType presence)
 {
 	switch (presence) {
diff --git a/libempathy-gtk/empathy-ui-utils.h b/libempathy-gtk/empathy-ui-utils.h
index 10f889b..fe676b1 100644
--- a/libempathy-gtk/empathy-ui-utils.h
+++ b/libempathy-gtk/empathy-ui-utils.h
@@ -59,7 +59,6 @@ GtkWidget     *empathy_builder_unref_and_keep_widget    (GtkBuilder       *gui,
 							 GtkWidget        *root);
 
 /* Pixbufs */
-const gchar * empathy_icon_name_from_account            (EmpathyAccount   *account);
 const gchar * empathy_icon_name_for_presence            (TpConnectionPresenceType  presence);
 const gchar * empathy_icon_name_for_contact             (EmpathyContact   *contact);
 GdkPixbuf *   empathy_pixbuf_from_data                  (gchar            *data,
diff --git a/libempathy/empathy-account.c b/libempathy/empathy-account.c
index 3bae8f5..c6a2184 100644
--- a/libempathy/empathy-account.c
+++ b/libempathy/empathy-account.c
@@ -77,6 +77,7 @@ struct _EmpathyAccountPriv
 
   gchar *cm_name;
   gchar *proto_name;
+  gchar *icon_name;
 };
 
 #define GET_PRIV(obj)  EMPATHY_GET_PRIV (obj, EmpathyAccount)
@@ -256,6 +257,7 @@ empathy_account_finalize (GObject *object)
 
   g_free (priv->cm_name);
   g_free (priv->proto_name);
+  g_free (priv->icon_name);
 
   /* free any data held directly by the object here */
   if (G_OBJECT_CLASS (empathy_account_parent_class)->finalize != NULL)
@@ -349,6 +351,14 @@ empathy_account_get_protocol (EmpathyAccount *account)
   return priv->proto_name;
 }
 
+const gchar *
+empathy_account_get_icon_name (EmpathyAccount *account)
+{
+  EmpathyAccountPriv *priv = GET_PRIV (account);
+
+  return priv->icon_name;
+}
+
 void
 empathy_account_set_enabled (EmpathyAccount *account, gboolean enabled)
 {
@@ -460,6 +470,7 @@ _empathy_account_new (McAccount *mc_account)
 
       priv->proto_name = g_strdup (mc_protocol_get_name (protocol));
       priv->cm_name = g_strdup (mc_manager_get_unique_name (manager));
+      priv->icon_name = g_strdup_printf ("im-%s", priv->proto_name);
 
       g_object_unref (protocol);
       g_object_unref (manager);
diff --git a/libempathy/empathy-account.h b/libempathy/empathy-account.h
index 66141ae..9587921 100644
--- a/libempathy/empathy-account.h
+++ b/libempathy/empathy-account.h
@@ -63,6 +63,7 @@ const gchar *empathy_account_get_display_name (EmpathyAccount *account);
 
 const gchar *empathy_account_get_connection_manager (EmpathyAccount *account);
 const gchar *empathy_account_get_protocol (EmpathyAccount *account);
+const gchar *empathy_account_get_icon_name (EmpathyAccount *account);
 
 void empathy_account_set_enabled (EmpathyAccount *account,
   gboolean enabled);
diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c
index 98e8485..f427b99 100644
--- a/src/empathy-accounts-dialog.c
+++ b/src/empathy-accounts-dialog.c
@@ -466,7 +466,7 @@ accounts_dialog_model_pixbuf_data_func (GtkTreeViewColumn    *tree_column,
 			    COL_ACCOUNT_POINTER, &account,
 			    -1);
 
-	icon_name = empathy_icon_name_from_account (account);
+	icon_name = empathy_account_get_icon_name (account);
 	pixbuf = empathy_pixbuf_from_icon_name (icon_name, GTK_ICON_SIZE_BUTTON);
 
 	if (pixbuf) {



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