| 157 |
157 |
| 158 static void add_account(AccountsWindow *dialog, GaimAccount *account); |
158 static void add_account(AccountsWindow *dialog, GaimAccount *account); |
| 159 static void set_account(GtkListStore *store, GtkTreeIter *iter, |
159 static void set_account(GtkListStore *store, GtkTreeIter *iter, |
| 160 GaimAccount *account); |
160 GaimAccount *account); |
| 161 static char* |
161 static char* |
| 162 convert_buddy_icon(GaimAccount *account, const char *path); |
162 convert_buddy_icon(GaimPlugin *plugin, const char *path); |
| 163 |
163 |
| 164 /************************************************************************** |
164 /************************************************************************** |
| 165 * Add/Modify Account dialog |
165 * Add/Modify Account dialog |
| 166 **************************************************************************/ |
166 **************************************************************************/ |
| 167 static void add_login_options(AccountPrefsDialog *dialog, GtkWidget *parent); |
167 static void add_login_options(AccountPrefsDialog *dialog, GtkWidget *parent); |
| 273 } |
273 } |
| 274 #endif /* FILECHOOSER */ |
274 #endif /* FILECHOOSER */ |
| 275 |
275 |
| 276 if (dialog->icon_path) |
276 if (dialog->icon_path) |
| 277 g_free(dialog->icon_path); |
277 g_free(dialog->icon_path); |
| 278 dialog->icon_path = convert_buddy_icon(dialog->account, filename); |
278 dialog->icon_path = convert_buddy_icon(dialog->plugin, filename); |
| 279 gtk_image_set_from_file(GTK_IMAGE(dialog->icon_entry), dialog->icon_path); |
279 gtk_image_set_from_file(GTK_IMAGE(dialog->icon_entry), dialog->icon_path); |
| 280 gtk_widget_show(dialog->icon_entry); |
280 gtk_widget_show(dialog->icon_entry); |
| 281 |
281 |
| 282 gtk_widget_destroy(dialog->icon_filesel); |
282 gtk_widget_destroy(dialog->icon_filesel); |
| 283 dialog->icon_filesel = NULL; |
283 dialog->icon_filesel = NULL; |
| 465 } |
465 } |
| 466 if ((rtmp = strchr(tmp, '\r')) || (rtmp = strchr(tmp, '\n'))) |
466 if ((rtmp = strchr(tmp, '\r')) || (rtmp = strchr(tmp, '\n'))) |
| 467 *rtmp = '\0'; |
467 *rtmp = '\0'; |
| 468 if (dialog->icon_path) |
468 if (dialog->icon_path) |
| 469 g_free(dialog->icon_path); |
469 g_free(dialog->icon_path); |
| 470 dialog->icon_path = convert_buddy_icon(dialog->account, tmp); |
470 dialog->icon_path = convert_buddy_icon(dialog->plugin, tmp); |
| 471 gtk_image_set_from_file(GTK_IMAGE(dialog->icon_entry), dialog->icon_path); |
471 gtk_image_set_from_file(GTK_IMAGE(dialog->icon_entry), dialog->icon_path); |
| 472 gtk_widget_show(dialog->icon_entry); |
472 gtk_widget_show(dialog->icon_entry); |
| 473 g_free(tmp); |
473 g_free(tmp); |
| 474 } |
474 } |
| 475 gtk_drag_finish(dc, TRUE, FALSE, t); |
475 gtk_drag_finish(dc, TRUE, FALSE, t); |
| 493 return FALSE; |
493 return FALSE; |
| 494 } |
494 } |
| 495 #endif |
495 #endif |
| 496 |
496 |
| 497 static char* |
497 static char* |
| 498 convert_buddy_icon(GaimAccount *account, const char *path) |
498 convert_buddy_icon(GaimPlugin *plugin, const char *path) |
| 499 { |
499 { |
| 500 #if GTK_CHECK_VERSION(2,2,0) |
500 #if GTK_CHECK_VERSION(2,2,0) |
| 501 int width, height; |
501 int width, height; |
| 502 char **pixbuf_formats = NULL; |
502 char **pixbuf_formats = NULL; |
| 503 GdkPixbufFormat *format; |
503 GdkPixbufFormat *format; |
| 504 GdkPixbuf *pixbuf; |
504 GdkPixbuf *pixbuf; |
| 505 GaimPluginProtocolInfo *prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gaim_find_prpl(account->protocol_id)); |
505 GaimPluginProtocolInfo *prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(plugin); |
| 506 char **prpl_formats = g_strsplit (prpl_info->icon_spec.format,",",0); |
506 char **prpl_formats = g_strsplit (prpl_info->icon_spec.format,",",0); |
| 507 #if !GTK_CHECK_VERSION(2,4,0) |
507 #if !GTK_CHECK_VERSION(2,4,0) |
| 508 GdkPixbufLoader *loader; |
508 GdkPixbufLoader *loader; |
| 509 FILE *file; |
509 FILE *file; |
| 510 struct stat st; |
510 struct stat st; |