Mercurial > pidgin.yaz
comparison src/gtkaccount.c @ 14035:8bda65b88e49
[gaim-migrate @ 16638]
A bunch of small changes. Mostly remove "if not null" checks before
calling g_free, g_list_free, g_slist_free and g_strdup. Also use
g_list_foreach() to call g_free to free strings in an array. And
some whitespace changes here and there.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Sat, 05 Aug 2006 08:27:39 +0000 |
parents | e1fd2a8bd40b |
children | 223570831b0b |
comparison
equal
deleted
inserted
replaced
14034:0839a7b71325 | 14035:8bda65b88e49 |
---|---|
202 GdkPixbuf *scale; | 202 GdkPixbuf *scale; |
203 | 203 |
204 gaim_gtk_buddy_icon_get_scale_size(pixbuf, | 204 gaim_gtk_buddy_icon_get_scale_size(pixbuf, |
205 &dialog->prpl_info->icon_spec, &width, &height); | 205 &dialog->prpl_info->icon_spec, &width, &height); |
206 scale = gdk_pixbuf_scale_simple(pixbuf, width, height, GDK_INTERP_BILINEAR); | 206 scale = gdk_pixbuf_scale_simple(pixbuf, width, height, GDK_INTERP_BILINEAR); |
207 | 207 |
208 g_object_unref(G_OBJECT(pixbuf)); | 208 g_object_unref(G_OBJECT(pixbuf)); |
209 pixbuf = scale; | 209 pixbuf = scale; |
210 } | 210 } |
211 | 211 |
212 gtk_image_set_from_pixbuf(GTK_IMAGE(dialog->icon_entry), pixbuf); | 212 gtk_image_set_from_pixbuf(GTK_IMAGE(dialog->icon_entry), pixbuf); |
229 | 229 |
230 if (dialog->plugin != NULL) | 230 if (dialog->plugin != NULL) |
231 { | 231 { |
232 dialog->prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(dialog->plugin); | 232 dialog->prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(dialog->plugin); |
233 | 233 |
234 if (dialog->protocol_id != NULL) | 234 g_free(dialog->protocol_id); |
235 g_free(dialog->protocol_id); | |
236 | |
237 dialog->protocol_id = g_strdup(dialog->plugin->info->id); | 235 dialog->protocol_id = g_strdup(dialog->plugin->info->id); |
238 } | 236 } |
239 | 237 |
240 if (dialog->account != NULL) | 238 if (dialog->account != NULL) |
241 gaim_account_clear_settings(dialog->account); | 239 gaim_account_clear_settings(dialog->account); |
315 g_free(current_folder); | 313 g_free(current_folder); |
316 } | 314 } |
317 | 315 |
318 #endif /* FILECHOOSER */ | 316 #endif /* FILECHOOSER */ |
319 | 317 |
320 if (dialog->icon_path) | 318 g_free(dialog->icon_path); |
321 g_free(dialog->icon_path); | |
322 dialog->icon_path = convert_buddy_icon(dialog->plugin, filename); | 319 dialog->icon_path = convert_buddy_icon(dialog->plugin, filename); |
323 set_dialog_icon(dialog); | 320 set_dialog_icon(dialog); |
324 gtk_widget_show(dialog->icon_entry); | 321 gtk_widget_show(dialog->icon_entry); |
325 | 322 |
326 gtk_widget_destroy(dialog->icon_filesel); | 323 gtk_widget_destroy(dialog->icon_filesel); |
480 } | 477 } |
481 | 478 |
482 static void | 479 static void |
483 icon_reset_cb(GtkWidget *button, AccountPrefsDialog *dialog) | 480 icon_reset_cb(GtkWidget *button, AccountPrefsDialog *dialog) |
484 { | 481 { |
485 if (dialog->icon_path) | 482 g_free(dialog->icon_path); |
486 g_free(dialog->icon_path); | |
487 dialog->icon_path = NULL; | 483 dialog->icon_path = NULL; |
488 | 484 |
489 gtk_widget_hide(dialog->icon_entry); | 485 gtk_widget_hide(dialog->icon_entry); |
490 } | 486 } |
491 | 487 |
510 "g_filename_from_uri error")); | 506 "g_filename_from_uri error")); |
511 return; | 507 return; |
512 } | 508 } |
513 if ((rtmp = strchr(tmp, '\r')) || (rtmp = strchr(tmp, '\n'))) | 509 if ((rtmp = strchr(tmp, '\r')) || (rtmp = strchr(tmp, '\n'))) |
514 *rtmp = '\0'; | 510 *rtmp = '\0'; |
515 if (dialog->icon_path) | 511 g_free(dialog->icon_path); |
516 g_free(dialog->icon_path); | |
517 dialog->icon_path = convert_buddy_icon(dialog->plugin, tmp); | 512 dialog->icon_path = convert_buddy_icon(dialog->plugin, tmp); |
518 set_dialog_icon(dialog); | 513 set_dialog_icon(dialog); |
519 gtk_widget_show(dialog->icon_entry); | 514 gtk_widget_show(dialog->icon_entry); |
520 g_free(tmp); | 515 g_free(tmp); |
521 } | 516 } |
1421 { | 1416 { |
1422 g_hash_table_remove(account_pref_wins, dialog->account); | 1417 g_hash_table_remove(account_pref_wins, dialog->account); |
1423 | 1418 |
1424 gtk_widget_destroy(dialog->window); | 1419 gtk_widget_destroy(dialog->window); |
1425 | 1420 |
1426 if (dialog->user_split_entries != NULL) | 1421 g_list_free(dialog->user_split_entries); |
1427 g_list_free(dialog->user_split_entries); | 1422 g_list_free(dialog->protocol_opt_entries); |
1428 | 1423 g_free(dialog->protocol_id); |
1429 if (dialog->protocol_opt_entries != NULL) | |
1430 g_list_free(dialog->protocol_opt_entries); | |
1431 | |
1432 if (dialog->protocol_id != NULL) | |
1433 g_free(dialog->protocol_id); | |
1434 | 1424 |
1435 if (dialog->icon_path != NULL) | 1425 if (dialog->icon_path != NULL) |
1436 { | 1426 { |
1437 const char *icon = gaim_account_get_buddy_icon(dialog->account); | 1427 const char *icon = gaim_account_get_buddy_icon(dialog->account); |
1438 if (dialog->icon_path != NULL && (icon == NULL || strcmp(dialog->icon_path, icon))) | 1428 if (dialog->icon_path != NULL && (icon == NULL || strcmp(dialog->icon_path, icon))) |
2570 | 2560 |
2571 static void | 2561 static void |
2572 free_add_user_data(GaimGtkAccountAddUserData *data) | 2562 free_add_user_data(GaimGtkAccountAddUserData *data) |
2573 { | 2563 { |
2574 g_free(data->username); | 2564 g_free(data->username); |
2575 | 2565 g_free(data->alias); |
2576 if (data->alias != NULL) | |
2577 g_free(data->alias); | |
2578 | |
2579 g_free(data); | 2566 g_free(data); |
2580 } | 2567 } |
2581 | 2568 |
2582 static void | 2569 static void |
2583 add_user_cb(GaimGtkAccountAddUserData *data) | 2570 add_user_cb(GaimGtkAccountAddUserData *data) |
2643 gc = gaim_account_get_connection(account); | 2630 gc = gaim_account_get_connection(account); |
2644 | 2631 |
2645 data = g_new0(GaimGtkAccountAddUserData, 1); | 2632 data = g_new0(GaimGtkAccountAddUserData, 1); |
2646 data->account = account; | 2633 data->account = account; |
2647 data->username = g_strdup(remote_user); | 2634 data->username = g_strdup(remote_user); |
2648 data->alias = (alias != NULL ? g_strdup(alias) : NULL); | 2635 data->alias = g_strdup(alias); |
2649 | 2636 |
2650 buffer = make_info(account, gc, remote_user, id, alias, msg); | 2637 buffer = make_info(account, gc, remote_user, id, alias, msg); |
2651 | 2638 |
2652 gaim_request_action(NULL, NULL, _("Add buddy to your list?"), | 2639 gaim_request_action(NULL, NULL, _("Add buddy to your list?"), |
2653 buffer, GAIM_DEFAULT_ACTION_NONE, data, 2, | 2640 buffer, GAIM_DEFAULT_ACTION_NONE, data, 2, |