comparison src/gtkaccount.c @ 9309:ade6b9c0dc8a

[gaim-migrate @ 10117] I'm a big fan of compiling for whatever version of Gtk I happen to be using. Btw, I think you're leaking a strv there buddy. committer: Tailor Script <tailor@pidgin.im>
author Tim Ringenbach <marv@pidgin.im>
date Sat, 19 Jun 2004 06:47:34 +0000
parents b3bda982996b
children 317b5b7af25c
comparison
equal deleted inserted replaced
9308:b3bda982996b 9309:ade6b9c0dc8a
387 g_free(dialog->buddy_icon_path); 387 g_free(dialog->buddy_icon_path);
388 dialog->buddy_icon_path = NULL; 388 dialog->buddy_icon_path = NULL;
389 gtk_image_set_from_file(GTK_IMAGE(dialog->buddy_icon_entry), ""); 389 gtk_image_set_from_file(GTK_IMAGE(dialog->buddy_icon_entry), "");
390 } 390 }
391 391
392 #if GTK_CHECK_VERSION(2,4,0)
392 gboolean str_array_match(char **a, char **b) 393 gboolean str_array_match(char **a, char **b)
393 { 394 {
394 int i, j; 395 int i, j;
395 for (i = 0; a[i] != NULL; i++) 396 for (i = 0; a[i] != NULL; i++)
396 for (j = 0; b[j] != NULL; j++) 397 for (j = 0; b[j] != NULL; j++)
397 if (!g_ascii_strcasecmp(a[i], b[j])) 398 if (!g_ascii_strcasecmp(a[i], b[j]))
398 return TRUE; 399 return TRUE;
399 return FALSE; 400 return FALSE;
400 } 401 }
402 #endif
401 403
402 static void 404 static void
403 convert_and_set_buddy_icon(GaimAccount *account, const char *path) 405 convert_and_set_buddy_icon(GaimAccount *account, const char *path)
404 { 406 {
407 #if GTK_CHECK_VERSION(2,4,0)
405 int width, height; 408 int width, height;
409 char **prpl_formats = g_strsplit (prpl_info->icon_spec.format,",",0);
410 char **pixbuf_formats;
411 GdkPixbufFormat *format;
406 GaimPluginProtocolInfo *prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gaim_find_prpl(account->protocol_id)); 412 GaimPluginProtocolInfo *prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gaim_find_prpl(account->protocol_id));
407 char **prpl_formats = g_strsplit (prpl_info->icon_spec.format,",",0); 413
408 GdkPixbufFormat *format = gdk_pixbuf_get_file_info (path, &width, &height); 414 format = gdk_pixbuf_get_file_info (path, &width, &height);
409 char **pixbuf_formats = gdk_pixbuf_format_get_extensions(format); 415 pixbuf_formats = gdk_pixbuf_format_get_extensions(format);
410 416
411 if (str_array_match(pixbuf_formats, prpl_formats)) { 417 if (str_array_match(pixbuf_formats, prpl_formats)) {
418 #endif
412 gaim_account_set_buddy_icon(account, path); 419 gaim_account_set_buddy_icon(account, path);
420 #if GTK_CHECK_VERSION(2,4,0)
413 } else { 421 } else {
414 int i; 422 int i;
415 GError *error = NULL; 423 GError *error = NULL;
416 GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(path, &error); 424 GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(path, &error);
417 GdkPixbuf *scale; 425 GdkPixbuf *scale;
441 } 449 }
442 g_free(filename); 450 g_free(filename);
443 g_free(random); 451 g_free(random);
444 g_object_unref(pixbuf); 452 g_object_unref(pixbuf);
445 } 453 }
454 #endif
446 } 455 }
447 456
448 static void 457 static void
449 add_login_options(AccountPrefsDialog *dialog, GtkWidget *parent) 458 add_login_options(AccountPrefsDialog *dialog, GtkWidget *parent)
450 { 459 {