diff options
author | Sjoerd Simons <sjoerd.simons@collabora.co.uk> | 2011-05-30 00:02:32 +0800 |
---|---|---|
committer | Sjoerd Simons <sjoerd.simons@collabora.co.uk> | 2011-05-30 00:02:32 +0800 |
commit | b0bd73cfa5658971f12c86a1f3711cab663a3f40 (patch) | |
tree | a6b46c0c799f4eb271e865ef61bf9233d329c089 /libempathy-gtk | |
parent | 8a43221ed3a42fb8949b7568a29723197f204364 (diff) | |
download | gsoc2013-empathy-b0bd73cfa5658971f12c86a1f3711cab663a3f40.tar gsoc2013-empathy-b0bd73cfa5658971f12c86a1f3711cab663a3f40.tar.gz gsoc2013-empathy-b0bd73cfa5658971f12c86a1f3711cab663a3f40.tar.bz2 gsoc2013-empathy-b0bd73cfa5658971f12c86a1f3711cab663a3f40.tar.lz gsoc2013-empathy-b0bd73cfa5658971f12c86a1f3711cab663a3f40.tar.xz gsoc2013-empathy-b0bd73cfa5658971f12c86a1f3711cab663a3f40.tar.zst gsoc2013-empathy-b0bd73cfa5658971f12c86a1f3711cab663a3f40.zip |
Use pixbuf for PixbufCellRenderer in protocol chooser
If an icon-name is given to a PixbufCellRenderer it will re-load the
image from the icon theme every time the size gets requested for a
different cell. Which happens a *LOT*.
Instead load the icon the row is added to the model, such that the
cell renderer can simply request the size of the pixbuf. This massive
speeds up the performance of the protocol chooser combobox.
Diffstat (limited to 'libempathy-gtk')
-rw-r--r-- | libempathy-gtk/empathy-account-chooser.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/libempathy-gtk/empathy-account-chooser.c b/libempathy-gtk/empathy-account-chooser.c index 2b0478e79..2df4a153a 100644 --- a/libempathy-gtk/empathy-account-chooser.c +++ b/libempathy-gtk/empathy-account-chooser.c @@ -609,7 +609,7 @@ account_chooser_setup (EmpathyAccountChooser *chooser) gtk_cell_layout_clear (GTK_CELL_LAYOUT (combobox)); store = gtk_list_store_new (COL_ACCOUNT_COUNT, - G_TYPE_STRING, /* Image */ + GDK_TYPE_PIXBUF, /* Image */ G_TYPE_STRING, /* Name */ G_TYPE_BOOLEAN, /* Enabled */ G_TYPE_UINT, /* Row type */ @@ -625,10 +625,9 @@ account_chooser_setup (EmpathyAccountChooser *chooser) renderer = gtk_cell_renderer_pixbuf_new (); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combobox), renderer, FALSE); gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combobox), renderer, - "icon-name", COL_ACCOUNT_IMAGE, + "pixbuf", COL_ACCOUNT_IMAGE, "sensitive", COL_ACCOUNT_ENABLED, NULL); - g_object_set (renderer, "stock-size", GTK_ICON_SIZE_BUTTON, NULL); renderer = gtk_cell_renderer_text_new (); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combobox), renderer, TRUE); @@ -763,6 +762,7 @@ account_chooser_filter_ready_cb (gboolean is_enabled, GtkListStore *store; GtkComboBox *combobox; const gchar *icon_name; + GdkPixbuf *pixbuf; chooser = fr_data->chooser; priv = GET_PRIV (chooser); @@ -772,13 +772,18 @@ account_chooser_filter_ready_cb (gboolean is_enabled, store = GTK_LIST_STORE (gtk_combo_box_get_model (combobox)); icon_name = tp_account_get_icon_name (account); + pixbuf = empathy_pixbuf_from_icon_name (icon_name, + GTK_ICON_SIZE_BUTTON); gtk_list_store_set (store, iter, - COL_ACCOUNT_IMAGE, icon_name, + COL_ACCOUNT_IMAGE, pixbuf, COL_ACCOUNT_TEXT, tp_account_get_display_name (account), COL_ACCOUNT_ENABLED, is_enabled, -1); + if (pixbuf != NULL) + g_object_unref (pixbuf); + /* set first connected account as active account */ if (priv->account_manually_set == FALSE && priv->set_active_item == FALSE && is_enabled) { |