void gaim_gtkxfer_dialog_remove_xfer(GaimGtkXferDialog *dialog, GaimXfer *xfer) { GaimGtkXferUiData *data; g_return_if_fail(dialog != NULL); g_return_if_fail(xfer != NULL); data = GAIM_GTKXFER(xfer); if (data == NULL) return; if (!data->in_list) return; data->in_list = FALSE; gtk_list_store_remove(GTK_LIST_STORE(dialog->model), &data->iter); dialog->num_transfers--; if (dialog->num_transfers == 0 && !dialog->keep_open) gaim_gtkxfer_dialog_hide(dialog); else ensure_row_selected(dialog); gaim_xfer_unref(xfer); }
void pidgin_xfer_dialog_remove_xfer(PidginXferDialog *dialog, PurpleXfer *xfer) { PidginXferUiData *data; g_return_if_fail(dialog != NULL); g_return_if_fail(xfer != NULL); data = PIDGINXFER(xfer); if (data == NULL) return; if (!data->in_list) return; data->in_list = FALSE; gtk_list_store_remove(GTK_LIST_STORE(dialog->model), &data->iter); dialog->num_transfers--; ensure_row_selected(dialog); update_title_progress(dialog); purple_xfer_unref(xfer); }
void gaim_gtkxfer_dialog_add_xfer(GaimGtkXferDialog *dialog, GaimXfer *xfer) { GaimGtkXferUiData *data; GaimXferType type; GdkPixbuf *pixbuf; char *size_str, *remaining_str; char *lfilename, *utf8; g_return_if_fail(dialog != NULL); g_return_if_fail(xfer != NULL); gaim_xfer_ref(xfer); data = GAIM_GTKXFER(xfer); data->in_list = TRUE; gaim_gtkxfer_dialog_show(dialog); data->start_time = time(NULL); data->end_time = -1; type = gaim_xfer_get_type(xfer); size_str = gaim_str_size_to_units(gaim_xfer_get_size(xfer)); remaining_str = gaim_str_size_to_units(gaim_xfer_get_bytes_remaining(xfer)); pixbuf = gtk_widget_render_icon(dialog->window, (type == GAIM_XFER_RECEIVE ? GAIM_STOCK_DOWNLOAD : GAIM_STOCK_UPLOAD), GTK_ICON_SIZE_MENU, NULL); gtk_list_store_append(dialog->model, &data->iter); lfilename = g_path_get_basename(gaim_xfer_get_local_filename(xfer)); utf8 = g_filename_to_utf8(lfilename, -1, NULL, NULL, NULL); g_free(lfilename); lfilename = utf8; gtk_list_store_set(dialog->model, &data->iter, COLUMN_STATUS, pixbuf, COLUMN_PROGRESS, 0.0, COLUMN_FILENAME, (type == GAIM_XFER_RECEIVE) ? gaim_xfer_get_filename(xfer) : lfilename, COLUMN_SIZE, size_str, COLUMN_REMAINING, _("Waiting for transfer to begin"), COLUMN_DATA, xfer, -1); g_free(lfilename); gtk_tree_view_columns_autosize(GTK_TREE_VIEW(dialog->tree)); g_object_unref(pixbuf); g_free(size_str); g_free(remaining_str); dialog->num_transfers++; ensure_row_selected(dialog); }
void pidgin_xfer_dialog_add_xfer(PidginXferDialog *dialog, PurpleXfer *xfer) { PidginXferUiData *data; PurpleXferType type; GdkPixbuf *pixbuf; char *size_str, *remaining_str; char *lfilename, *utf8; g_return_if_fail(dialog != NULL); g_return_if_fail(xfer != NULL); purple_xfer_ref(xfer); data = PIDGINXFER(xfer); data->in_list = TRUE; pidgin_xfer_dialog_show(dialog); data->last_updated_time = 0; type = purple_xfer_get_type(xfer); size_str = purple_str_size_to_units(purple_xfer_get_size(xfer)); remaining_str = purple_str_size_to_units(purple_xfer_get_bytes_remaining(xfer)); pixbuf = gtk_widget_render_icon(dialog->window, (type == PURPLE_XFER_RECEIVE ? PIDGIN_STOCK_DOWNLOAD : PIDGIN_STOCK_UPLOAD), GTK_ICON_SIZE_MENU, NULL); gtk_list_store_append(dialog->model, &data->iter); lfilename = g_path_get_basename(purple_xfer_get_local_filename(xfer)); utf8 = g_filename_to_utf8(lfilename, -1, NULL, NULL, NULL); g_free(lfilename); lfilename = utf8; gtk_list_store_set(dialog->model, &data->iter, COLUMN_STATUS, pixbuf, COLUMN_PROGRESS, 0.0, COLUMN_FILENAME, (type == PURPLE_XFER_RECEIVE) ? purple_xfer_get_filename(xfer) : lfilename, COLUMN_SIZE, size_str, COLUMN_REMAINING, _("Waiting for transfer to begin"), COLUMN_DATA, xfer, -1); g_free(lfilename); gtk_tree_view_columns_autosize(GTK_TREE_VIEW(dialog->tree)); g_object_unref(pixbuf); g_free(size_str); g_free(remaining_str); dialog->num_transfers++; ensure_row_selected(dialog); update_title_progress(dialog); }