* Danielle Madeley <danielle.madeley@collabora.co.uk>
*/
-#include <config.h>
-
-#include <string.h>
-#include <stdlib.h>
+#include "config.h"
+#include "empathy-accounts-dialog.h"
-#include <gtk/gtk.h>
#include <glib/gi18n-lib.h>
-#include <dbus/dbus-glib.h>
-#include <gio/gdesktopappinfo.h>
-
-#include <telepathy-glib/account-manager.h>
-#include <telepathy-glib/defs.h>
-#include <telepathy-glib/util.h>
-
-#include <libempathy/empathy-utils.h>
-#include <libempathy/empathy-connection-managers.h>
-#include <libempathy/empathy-pkg-kit.h>
-
-#include <libempathy-gtk/empathy-ui-utils.h>
-#include <libempathy-gtk/empathy-protocol-chooser.h>
-#include <libempathy-gtk/empathy-account-widget.h>
-#include <libempathy-gtk/empathy-account-widget-irc.h>
-#include <libempathy-gtk/empathy-account-widget-sip.h>
-#include <libempathy-gtk/empathy-cell-renderer-activatable.h>
-#include <libempathy-gtk/empathy-user-info.h>
-#include <libempathy-gtk/empathy-images.h>
-#include <libempathy-gtk/empathy-local-xmpp-assistant-widget.h>
-#include <libempathy-gtk/empathy-new-account-dialog.h>
#include "empathy-accounts-common.h"
-#include "empathy-accounts-dialog.h"
+#include "empathy-account-widget-sip.h"
#include "empathy-import-dialog.h"
#include "empathy-import-utils.h"
+#include "empathy-local-xmpp-assistant-widget.h"
+#include "empathy-new-account-dialog.h"
+#include "empathy-pkg-kit.h"
+#include "empathy-ui-utils.h"
+#include "empathy-user-info.h"
+#include "empathy-utils.h"
#define DEBUG_FLAG EMPATHY_DEBUG_ACCOUNT
-#include <libempathy/empathy-debug.h>
+#include "empathy-debug.h"
/* Flashing delay for icons (milliseconds). */
#define FLASH_TIMEOUT 500
* EmpathyAccountsDialog object. */
gboolean force_change_row;
GtkTreeRowReference *destination_row;
+
+ GHashTable *icons_cache;
} EmpathyAccountsDialogPriv;
enum {
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
NULL, NULL);
+ gtk_window_set_resizable (GTK_WINDOW (subdialog), FALSE);
+
priv->setting_widget = (EmpathyAccountWidget *)
empathy_account_widget_new_for_protocol (settings, FALSE);
return empathy_icon_name_for_presence (presence);
}
+static GdkPixbuf *
+ensure_icon (EmpathyAccountsDialog *self,
+ const gchar *icon_name)
+{
+ EmpathyAccountsDialogPriv *priv = GET_PRIV (self);
+ GdkPixbuf *pixbuf;
+
+ pixbuf = g_hash_table_lookup (priv->icons_cache, icon_name);
+ if (pixbuf == NULL)
+ {
+ pixbuf = empathy_pixbuf_from_icon_name (icon_name, GTK_ICON_SIZE_BUTTON);
+
+ if (pixbuf == NULL)
+ return NULL;
+
+ g_hash_table_insert (priv->icons_cache, g_strdup (icon_name),
+ pixbuf);
+ }
+
+ return g_object_ref (pixbuf);
+}
+
static void
accounts_dialog_model_status_pixbuf_data_func (GtkTreeViewColumn *tree_column,
GtkCellRenderer *cell,
EmpathyAccountsDialog *dialog)
{
TpAccount *account;
+ const gchar *icon_name;
+ GdkPixbuf *pixbuf;
gtk_tree_model_get (model, iter, COL_ACCOUNT, &account, -1);
+ icon_name = get_status_icon_for_account (dialog, account);
+ pixbuf = ensure_icon (dialog, icon_name);
+
g_object_set (cell,
- "icon-name", get_status_icon_for_account (dialog, account),
+ "pixbuf", pixbuf,
NULL);
if (account != NULL)
g_object_unref (account);
+
+ if (pixbuf != NULL)
+ g_object_unref (pixbuf);
}
static void
-1);
icon_name = empathy_account_settings_get_icon_name (settings);
- pixbuf = empathy_pixbuf_from_icon_name (icon_name, GTK_ICON_SIZE_BUTTON);
+ pixbuf = ensure_icon (dialog, icon_name);
g_object_set (cell,
"visible", TRUE,
/* first row */
priv->label_name = gtk_label_new (NULL);
+ gtk_label_set_ellipsize (GTK_LABEL (priv->label_name), PANGO_ELLIPSIZE_END);
gtk_grid_attach (GTK_GRID (grid), priv->label_name, 1, 0, 1, 1);
/* second row */
priv->initial_selection = NULL;
}
+ tp_clear_pointer (&priv->icons_cache, g_hash_table_unref);
+
G_OBJECT_CLASS (empathy_accounts_dialog_parent_class)->dispose (obj);
}
EMPATHY_TYPE_ACCOUNTS_DIALOG,
EmpathyAccountsDialogPriv);
dialog->priv = priv;
+
+ priv->icons_cache = g_hash_table_new_full (g_str_hash, g_str_equal,
+ g_free, g_object_unref);
}
/* public methods */