comparison src/gtkaccount.c @ 13090:0aa231ebbfd5

[gaim-migrate @ 15452] Changes to some pixbuf stuff. I added a 'gaim_gtk_create_gaim_icon_with_status()' function to util.c, and changed 'gaim_gtk_create_prpl_icon_with_status()' to accept a scale factor because almost everywhere this function was used we would scale the pixbuf to a smaller size as soon as we got it. So there's a bit less code duplication. Also, I think I added some g_object_unref()'s in one or two places where it was missing. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Wed, 01 Feb 2006 22:38:34 +0000
parents 5efbb0162f86
children cc85a78191cc
comparison
equal deleted inserted replaced
13089:b553326bc468 13090:0aa231ebbfd5
1826 { 1826 {
1827 GaimAccount *account; 1827 GaimAccount *account;
1828 GaimGtkPulseData *pulse_data; 1828 GaimGtkPulseData *pulse_data;
1829 GtkTreeModel *model; 1829 GtkTreeModel *model;
1830 GtkTreeIter iter; 1830 GtkTreeIter iter;
1831 GdkPixbuf *pixbuf, *scale = NULL; 1831 GdkPixbuf *pixbuf;
1832 size_t index; 1832 size_t index;
1833 1833
1834 /* Don't need to do anything if the accounts window is not visible */ 1834 /* Don't need to do anything if the accounts window is not visible */
1835 if (accounts_window == NULL) 1835 if (accounts_window == NULL)
1836 return; 1836 return;
1852 g_object_unref(G_OBJECT(pulse_data->online_pixbuf)); 1852 g_object_unref(G_OBJECT(pulse_data->online_pixbuf));
1853 1853
1854 g_free(pulse_data); 1854 g_free(pulse_data);
1855 } 1855 }
1856 1856
1857 pixbuf = gaim_gtk_create_prpl_icon(account); 1857 pixbuf = gaim_gtk_create_prpl_icon(account, 0.5);
1858 1858 if ((pixbuf != NULL) && gaim_account_is_disconnected(account))
1859 if (pixbuf != NULL) 1859 gdk_pixbuf_saturate_and_pixelate(pixbuf, pixbuf, 0.0, FALSE);
1860 { 1860
1861 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16,
1862 GDK_INTERP_BILINEAR);
1863
1864 if (gaim_account_is_disconnected(account))
1865 gdk_pixbuf_saturate_and_pixelate(scale, scale, 0.0, FALSE);
1866 }
1867 gtk_list_store_set(accounts_window->model, &iter, 1861 gtk_list_store_set(accounts_window->model, &iter,
1868 COLUMN_ICON, scale, 1862 COLUMN_ICON, pixbuf,
1869 COLUMN_PULSE_DATA, NULL, 1863 COLUMN_PULSE_DATA, NULL,
1870 -1); 1864 -1);
1871 1865
1872 1866
1873 if (pixbuf != NULL) g_object_unref(G_OBJECT(pixbuf)); 1867 if (pixbuf != NULL)
1874 if (scale != NULL) g_object_unref(G_OBJECT(scale)); 1868 g_object_unref(G_OBJECT(pixbuf));
1875 } 1869 }
1876 } 1870 }
1877 1871
1878 /* 1872 /*
1879 * Get the GtkTreeIter of the specified account in the 1873 * Get the GtkTreeIter of the specified account in the
2257 2251
2258 static void 2252 static void
2259 set_account(GtkListStore *store, GtkTreeIter *iter, GaimAccount *account) 2253 set_account(GtkListStore *store, GtkTreeIter *iter, GaimAccount *account)
2260 { 2254 {
2261 GdkPixbuf *pixbuf; 2255 GdkPixbuf *pixbuf;
2262 GdkPixbuf *scale; 2256
2263 2257 pixbuf = gaim_gtk_create_prpl_icon(account, 0.5);
2264 scale = NULL; 2258 if ((pixbuf != NULL) && gaim_account_is_disconnected(account))
2265 2259 gdk_pixbuf_saturate_and_pixelate(pixbuf, pixbuf, 0.0, FALSE);
2266 pixbuf = gaim_gtk_create_prpl_icon(account);
2267
2268 if (pixbuf != NULL)
2269 {
2270 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16, GDK_INTERP_BILINEAR);
2271
2272 if (gaim_account_is_disconnected(account))
2273 gdk_pixbuf_saturate_and_pixelate(scale, scale, 0.0, FALSE);
2274 }
2275 2260
2276 gtk_list_store_set(store, iter, 2261 gtk_list_store_set(store, iter,
2277 COLUMN_ICON, scale, 2262 COLUMN_ICON, pixbuf,
2278 COLUMN_SCREENNAME, gaim_account_get_username(account), 2263 COLUMN_SCREENNAME, gaim_account_get_username(account),
2279 COLUMN_ENABLED, gaim_account_get_enabled(account, GAIM_GTK_UI), 2264 COLUMN_ENABLED, gaim_account_get_enabled(account, GAIM_GTK_UI),
2280 COLUMN_PROTOCOL, gaim_account_get_protocol_name(account), 2265 COLUMN_PROTOCOL, gaim_account_get_protocol_name(account),
2281 COLUMN_DATA, account, 2266 COLUMN_DATA, account,
2282 -1); 2267 -1);
2283 2268
2284 if (pixbuf != NULL) g_object_unref(G_OBJECT(pixbuf)); 2269 if (pixbuf != NULL)
2285 if (scale != NULL) g_object_unref(G_OBJECT(scale)); 2270 g_object_unref(G_OBJECT(pixbuf));
2286 } 2271 }
2287 2272
2288 static void 2273 static void
2289 add_account_to_liststore(GaimAccount *account, gpointer user_data) 2274 add_account_to_liststore(GaimAccount *account, gpointer user_data)
2290 { 2275 {