[empathy/mc5: 234/483] Make protocol icons work also with account == NULL



commit 0279ad1b9504f81dbe6773eab9fdbd6ffdbfca3d
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Fri Jul 31 11:44:35 2009 +0200

    Make protocol icons work also with account == NULL

 libempathy/empathy-account-settings.c |    7 +++++--
 libempathy/empathy-account-settings.h |    2 +-
 src/empathy-accounts-dialog.c         |   11 ++++++++---
 3 files changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/libempathy/empathy-account-settings.c b/libempathy/empathy-account-settings.c
index 1c5bc71..256d05b 100644
--- a/libempathy/empathy-account-settings.c
+++ b/libempathy/empathy-account-settings.c
@@ -447,13 +447,16 @@ empathy_account_settings_get_protocol (EmpathyAccountSettings *settings)
   return priv->protocol;
 }
 
-const gchar *
+gchar *
 empathy_account_settings_get_icon_name (EmpathyAccountSettings *settings)
 {
   EmpathyAccountSettingsPriv *priv = GET_PRIV (settings);
 
   if (priv->account != NULL)
-    return empathy_account_get_icon_name (priv->account);
+    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;
 }
diff --git a/libempathy/empathy-account-settings.h b/libempathy/empathy-account-settings.h
index 06e5e69..8ae6922 100644
--- a/libempathy/empathy-account-settings.h
+++ b/libempathy/empathy-account-settings.h
@@ -127,7 +127,7 @@ void empathy_account_settings_set_uint64 (EmpathyAccountSettings *settings,
 void empathy_account_settings_set_boolean (EmpathyAccountSettings *settings,
     const gchar *param, gboolean value);
 
-const gchar *empathy_account_settings_get_icon_name (
+gchar *empathy_account_settings_get_icon_name (
   EmpathyAccountSettings *settings);
 
 const gchar *empathy_account_settings_get_display_name (
diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c
index 7a9dffb..974b6dc 100644
--- a/src/empathy-accounts-dialog.c
+++ b/src/empathy-accounts-dialog.c
@@ -175,6 +175,7 @@ account_dialog_create_settings_widget (EmpathyAccountsDialog *dialog,
     EmpathyAccountSettings *settings)
 {
   EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog);
+  gchar *icon_name;
 
   priv->settings_widget = get_account_setup_widget (settings);
 
@@ -182,14 +183,16 @@ account_dialog_create_settings_widget (EmpathyAccountsDialog *dialog,
       priv->settings_widget);
   gtk_widget_show (priv->settings_widget);
 
+  icon_name = empathy_account_settings_get_icon_name (settings);
 
   gtk_image_set_from_icon_name (GTK_IMAGE (priv->image_type),
-      empathy_account_settings_get_icon_name (settings),
-      GTK_ICON_SIZE_DIALOG);
+      icon_name, GTK_ICON_SIZE_DIALOG);
   gtk_widget_set_tooltip_text (priv->image_type,
       empathy_account_settings_get_protocol (settings));
 
   accounts_dialog_update_name_label (dialog, settings);
+
+  g_free (icon_name);
 }
 
 static void
@@ -379,7 +382,7 @@ accounts_dialog_model_pixbuf_data_func (GtkTreeViewColumn *tree_column,
     EmpathyAccountsDialog *dialog)
 {
   EmpathyAccountSettings  *settings;
-  const gchar        *icon_name;
+  gchar              *icon_name;
   GdkPixbuf          *pixbuf;
   TpConnectionStatus  status;
   EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog);
@@ -392,6 +395,8 @@ 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]