Mercurial > pidgin.yaz
comparison src/gtkstatusbox.c @ 14144:92f5e6f3acfb
[gaim-migrate @ 16786]
More/better assertion fixes. Especially when starting Gaim with
an account that doesn't have the global buddy icon preference
set, or when trying to set an icon using a file that is not an image.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Wed, 16 Aug 2006 07:19:41 +0000 |
parents | 11394a70de37 |
children | d994f64248ef |
comparison
equal
deleted
inserted
replaced
14143:11394a70de37 | 14144:92f5e6f3acfb |
---|---|
1177 icon_alc.height = MAX(1,req.height); | 1177 icon_alc.height = MAX(1,req.height); |
1178 icon_alc.width = icon_alc.height; | 1178 icon_alc.width = icon_alc.height; |
1179 icon_alc.x = allocation->width - icon_alc.width; | 1179 icon_alc.x = allocation->width - icon_alc.width; |
1180 icon_alc.y += 3; | 1180 icon_alc.y += 3; |
1181 | 1181 |
1182 if ((status_box->buddy_icon_path != NULL) && | 1182 if (status_box->icon_size != icon_alc.height) |
1183 (status_box->icon_size != icon_alc.height)) | 1183 { |
1184 { | 1184 if ((status_box->buddy_icon_path != NULL) && |
1185 scaled = gdk_pixbuf_new_from_file_at_scale(status_box->buddy_icon_path, | 1185 (*status_box->buddy_icon_path != '\0')) |
1186 icon_alc.height, icon_alc.width, FALSE, NULL); | 1186 { |
1187 status_box->buddy_icon_hover = gdk_pixbuf_copy(scaled); | 1187 scaled = gdk_pixbuf_new_from_file_at_scale(status_box->buddy_icon_path, |
1188 do_colorshift(status_box->buddy_icon_hover, status_box->buddy_icon_hover, 30); | 1188 icon_alc.height, icon_alc.width, FALSE, NULL); |
1189 g_object_unref(status_box->buddy_icon); | 1189 status_box->buddy_icon_hover = gdk_pixbuf_copy(scaled); |
1190 status_box->buddy_icon = scaled; | 1190 do_colorshift(status_box->buddy_icon_hover, status_box->buddy_icon_hover, 30); |
1191 gtk_image_set_from_pixbuf(GTK_IMAGE(status_box->icon), status_box->buddy_icon); | 1191 g_object_unref(status_box->buddy_icon); |
1192 status_box->buddy_icon = scaled; | |
1193 gtk_image_set_from_pixbuf(GTK_IMAGE(status_box->icon), status_box->buddy_icon); | |
1194 } | |
1192 status_box->icon_size = icon_alc.height; | 1195 status_box->icon_size = icon_alc.height; |
1193 } | 1196 } |
1194 gtk_widget_size_allocate((GTK_GAIM_STATUS_BOX(widget))->icon_box, &icon_alc); | 1197 gtk_widget_size_allocate((GTK_GAIM_STATUS_BOX(widget))->icon_box, &icon_alc); |
1195 | 1198 |
1196 | 1199 |
1335 { | 1338 { |
1336 GdkPixbuf *scaled; | 1339 GdkPixbuf *scaled; |
1337 g_free(box->buddy_icon_path); | 1340 g_free(box->buddy_icon_path); |
1338 box->buddy_icon_path = g_strdup(filename); | 1341 box->buddy_icon_path = g_strdup(filename); |
1339 | 1342 |
1340 if (filename != NULL) | 1343 if ((filename != NULL) && (*filename != '\0')) |
1341 { | 1344 { |
1345 if (box->buddy_icon != NULL) | |
1346 g_object_unref(box->buddy_icon); | |
1342 scaled = gdk_pixbuf_new_from_file_at_scale(filename, | 1347 scaled = gdk_pixbuf_new_from_file_at_scale(filename, |
1343 box->icon_size, box->icon_size, FALSE, NULL); | 1348 box->icon_size, box->icon_size, FALSE, NULL); |
1344 box->buddy_icon_hover = gdk_pixbuf_copy(scaled); | 1349 if (scaled != NULL) |
1345 do_colorshift(box->buddy_icon_hover, box->buddy_icon_hover, 30); | 1350 { |
1346 g_object_unref(box->buddy_icon); | 1351 box->buddy_icon_hover = gdk_pixbuf_copy(scaled); |
1347 box->buddy_icon = scaled; | 1352 do_colorshift(box->buddy_icon_hover, box->buddy_icon_hover, 30); |
1348 gtk_image_set_from_pixbuf(GTK_IMAGE(box->icon), box->buddy_icon); | 1353 box->buddy_icon = scaled; |
1354 gtk_image_set_from_pixbuf(GTK_IMAGE(box->icon), box->buddy_icon); | |
1355 } | |
1349 } | 1356 } |
1350 | 1357 |
1351 gaim_prefs_set_string("/gaim/gtk/accounts/buddyicon", filename); | 1358 gaim_prefs_set_string("/gaim/gtk/accounts/buddyicon", filename); |
1352 } | 1359 } |
1353 | 1360 |