]> git.0d.be Git - empathy.git/commitdiff
Make protocol icons work also with account == NULL
authorCosimo Cecchi <cosimoc@gnome.org>
Fri, 31 Jul 2009 09:44:35 +0000 (11:44 +0200)
committerCosimo Cecchi <cosimoc@gnome.org>
Fri, 31 Jul 2009 09:46:42 +0000 (11:46 +0200)
libempathy/empathy-account-settings.c
libempathy/empathy-account-settings.h
src/empathy-accounts-dialog.c

index 1c5bc719ad20e0d0700d10a0fe864bb4a961f40e..256d05ba40f9cfbd2f1c2e1f22a0b26f70cd6165 100644 (file)
@@ -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;
 }
index 06e5e69e3826d97e5b45ccb9165331e173fcf615..8ae69221228a49c0dd5c3550c118b1dd9c9500ad 100644 (file)
@@ -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 (
index 7a9dffb79cc3e39469fdc5c7366a6ad6a089b5a5..974b6dcc4f74228c9815035e0f898ad9b78b4804 100644 (file)
@@ -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 ||